class Cucumber::ProjectInitializer
Generates generic file structure for a cucumber project
Public Instance Methods
run()
click to toggle source
# File lib/cucumber/project_initializer.rb, line 5 def run create_directory('features') create_directory('features/step_definitions') create_directory('features/support') create_file('features/support/env.rb') end
Private Instance Methods
create_directory(dir_name)
click to toggle source
# File lib/cucumber/project_initializer.rb, line 14 def create_directory(dir_name) create_directory_or_file dir_name, true end
create_directory_or_file(file_name, directory)
click to toggle source
# File lib/cucumber/project_initializer.rb, line 22 def create_directory_or_file(file_name, directory) file_type = if directory :mkdir_p else :touch end report_exists(file_name) || return if File.exists?(file_name) report_creating(file_name) FileUtils.send file_type, file_name end
create_file(file_name)
click to toggle source
# File lib/cucumber/project_initializer.rb, line 18 def create_file(file_name) create_directory_or_file file_name, false end
report_creating(file)
click to toggle source
# File lib/cucumber/project_initializer.rb, line 39 def report_creating(file) puts " create #{file}" end
report_exists(file)
click to toggle source
# File lib/cucumber/project_initializer.rb, line 35 def report_exists(file) puts " exist #{file}" end