Class: Cucumber::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Cucumber::InstallGenerator
- Defined in:
- lib/generators/cucumber/install/install_generator.rb
Constant Summary collapse
- DEFAULT_SHEBANG =
File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
Instance Attribute Summary collapse
-
#framework ⇒ Object
readonly
Returns the value of attribute framework.
Instance Method Summary collapse
- #create_database ⇒ Object
- #create_feature_support ⇒ Object
- #create_scripts ⇒ Object
- #create_step_definitions ⇒ Object
- #create_tasks ⇒ Object
- #create_templates ⇒ Object
Instance Attribute Details
#framework ⇒ Object (readonly)
Returns the value of attribute framework.
16 17 18 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 16 def framework @framework end |
Instance Method Details
#create_database ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 53 def create_database return unless File.exist?('config/database.yml') unless File.read('config/database.yml').include? 'cucumber:' gsub_file 'config/database.yml', /^test:.*\n/, "test: &test\n" gsub_file 'config/database.yml', /\z/, "\ncucumber:\n <<: *test" # Since gsub_file doesn't ask the user, just inform user that the file was overwritten. puts " force config/database.yml" end end |
#create_feature_support ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 36 def create_feature_support empty_directory 'features/support' copy_file 'support/paths.rb', 'features/support/paths.rb' copy_file 'support/selectors.rb', 'features/support/selectors.rb' if spork? template 'support/rails_spork.rb.erb', 'features/support/env.rb' else template 'support/rails.rb.erb', 'features/support/env.rb' end end |
#create_scripts ⇒ Object
22 23 24 25 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 22 def create_scripts copy_file 'script/cucumber', 'script/cucumber' chmod 'script/cucumber', 0755 end |
#create_step_definitions ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 27 def create_step_definitions empty_directory 'features/step_definitions' template "step_definitions/web_steps.rb.erb", 'features/step_definitions/web_steps.rb' if language template "step_definitions/web_steps_#{language}.rb.erb", "features/step_definitions/web_steps_#{language}.rb" end end |
#create_tasks ⇒ Object
48 49 50 51 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 48 def create_tasks empty_directory 'lib/tasks' template 'tasks/cucumber.rake.erb', 'lib/tasks/cucumber.rake' end |
#create_templates ⇒ Object
18 19 20 |
# File 'lib/generators/cucumber/install/install_generator.rb', line 18 def create_templates template 'config/cucumber.yml.erb', 'config/cucumber.yml' end |