Class: SpreeBraintreeVzero::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- SpreeBraintreeVzero::Generators::InstallGenerator
- Defined in:
- lib/generators/spree_braintree_vzero/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_javascripts ⇒ Object
6 7 8 9 |
# File 'lib/generators/spree_braintree_vzero/install/install_generator.rb', line 6 def add_javascripts append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_braintree_vzero\n" append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_braintree_vzero\n" end |
#add_migrations ⇒ Object
20 21 22 |
# File 'lib/generators/spree_braintree_vzero/install/install_generator.rb', line 20 def add_migrations run 'bundle exec rake railties:install:migrations FROM=spree_braintree_vzero' end |
#add_schedule ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/generators/spree_braintree_vzero/install/install_generator.rb', line 11 def add_schedule create_file 'config/schedule.rb' unless File.exist?('config/schedule.rb') append_file 'config/schedule.rb' do "\nevery '0 4,10,16,22 * * * *' do rake 'spree_braintree_vzero:update_states' end" end end |
#run_migrations ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/generators/spree_braintree_vzero/install/install_generator.rb', line 24 def run_migrations run_migrations = [:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) if run_migrations run 'bundle exec rake db:migrate' else puts 'Skipping rake db:migrate, don\'t forget to run it!' end end |