class SolidusBillingAddress::Generators::InstallGenerator

Public Class Methods

source_paths() click to toggle source
# File lib/generators/solidus_billing_address/install/install_generator.rb, line 8
def self.source_paths
  paths = superclass.source_paths
  paths << File.expand_path('templates', __dir__)
  paths.flatten
end

Public Instance Methods

add_javascripts() click to toggle source
# File lib/generators/solidus_billing_address/install/install_generator.rb, line 14
def add_javascripts
  append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_billing_address\n"
  append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_billing_address\n"
end
add_migrations() click to toggle source
# File lib/generators/solidus_billing_address/install/install_generator.rb, line 24
def add_migrations
  run 'bundle exec rake railties:install:migrations FROM=solidus_billing_address'
end
add_stylesheets() click to toggle source
# File lib/generators/solidus_billing_address/install/install_generator.rb, line 19
def add_stylesheets
  inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_billing_address\n", before: %r{\*/}, verbose: true
  inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_billing_address\n", before: %r{\*/}, verbose: true
end
generate_initializer() click to toggle source
# File lib/generators/solidus_billing_address/install/install_generator.rb, line 28
def generate_initializer
  template 'config/initializers/solidus_billing_address.rb', 'config/initializers/solidus_billing_address.rb'
end
run_migrations() click to toggle source
# File lib/generators/solidus_billing_address/install/install_generator.rb, line 32
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!' # rubocop:disable Rails/Output
  end
end