Class: SpreeFosdickIntegration::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/spree_fosdick_integration/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_pathsObject



7
8
9
10
11
# File 'lib/generators/spree_fosdick_integration/install/install_generator.rb', line 7

def self.source_paths
  paths = self.superclass.source_paths
  paths << File.expand_path('../templates', __FILE__)
  paths.flatten
end

Instance Method Details

#add_migrationsObject



13
14
15
# File 'lib/generators/spree_fosdick_integration/install/install_generator.rb', line 13

def add_migrations
  run 'bundle exec rake railties:install:migrations FROM=spree_fosdick_integration'
end

#copy_initializerObject



26
27
28
29
# File 'lib/generators/spree_fosdick_integration/install/install_generator.rb', line 26

def copy_initializer
  copy_file 'fosdick.yml.template', 'config/fosdick.yml'
  copy_file 'fosdick.rb', 'config/initializers/fosdick.rb'
end

#run_migrationsObject



17
18
19
20
21
22
23
24
# File 'lib/generators/spree_fosdick_integration/install/install_generator.rb', line 17

def run_migrations
  run_migrations = options[: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