Class: Visionbundles::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Visionbundles::Generators::InstallGenerator
- Defined in:
- lib/generators/install_generator.rb
Instance Method Summary collapse
-
#add_capistrano_rvm ⇒ Object
add gem for capistrano + rvm.
-
#check ⇒ Object
check the argument deploy_template, should be single or mutiple.
-
#copy_deploy_template ⇒ Object
copy the capistrano setting from template.
-
#create_database_example_config ⇒ Object
copy exists database config to predefine folder.
Instance Method Details
#add_capistrano_rvm ⇒ Object
add gem for capistrano + rvm
24 25 26 27 28 29 30 |
# File 'lib/generators/install_generator.rb', line 24 def add_capistrano_rvm unless File.readlines("Gemfile").grep(/rvm-capistrano/).any? gem_group :development do gem 'rvm-capistrano' end end end |
#check ⇒ Object
check the argument deploy_template, should be single or mutiple
9 10 11 12 13 14 15 16 |
# File 'lib/generators/install_generator.rb', line 9 def check unless %w(single multiple).include?(deploy_template) puts "You have to choice a template: single or multiple" puts "\trails g visionbundles:install single" puts "\trails g visionbundles:install mutiple" exit end end |
#copy_deploy_template ⇒ Object
copy the capistrano setting from template
19 20 21 |
# File 'lib/generators/install_generator.rb', line 19 def copy_deploy_template copy_file "deploy_#{deploy_template}.rb", "config/deploy.rb" end |
#create_database_example_config ⇒ Object
copy exists database config to predefine folder
33 34 35 36 37 38 39 |
# File 'lib/generators/install_generator.rb', line 33 def create_database_example_config if File.exists?('config/database.yml') copy_file "#{Rails.root}/config/database.example.yml", "preconfig/database.yml" else copy_file "database.yml", "preconfig/database.yml" end end |