module Cucumber::CompatibilityKit

def all_examples

def all_examples
  gherkin_examples + markdown_examples
end

def example_path(example_name)

def example_path(example_name)
  path = File.join(examples_path, example_name)
  return path if File.directory?(path)
  raise ArgumentError.new
end

def examples_path

def examples_path
  File.expand_path("#{File.dirname(__FILE__)}/../features/")
end

def gherkin_examples

def gherkin_examples
  Dir
    .entries(examples_path)
    .select do |file|
      folder = File.join(examples_path, file)
      file != '.' && file != '..' &&
        File.directory?(folder) &&
        is_gherkin_example?(folder)
    end
end

def is_gherkin_example?(example_folder)

def is_gherkin_example?(example_folder)
  Dir.entries(example_folder).select { |file| File.extname(file) == '.feature' }.count > 0
end

def is_markdown_example?(example_folder)

def is_markdown_example?(example_folder)
  Dir.entries(example_folder).select { |file| File.extname(file) == '.md' }.count > 0
end

def markdown_examples

def markdown_examples
  Dir
  .entries(examples_path)
  .select do |file|
    folder = File.join(examples_path, file)
    file != '.' && file != '..' &&
      File.directory?(folder) &&
      is_markdown_example?(folder)
  end
end