Class: ShoppingCart::ConfigGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/shopping_cart/config_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_migrationsObject



12
13
14
# File 'lib/generators/shopping_cart/config_generator.rb', line 12

def copy_migrations
  rake 'shopping_cart:install:migrations'
end

#create_initializer_fileObject



5
6
7
8
# File 'lib/generators/shopping_cart/config_generator.rb', line 5

def create_initializer_file
  create_file "config/initializers/shopping_cart.rb",
              "ShoppingCart.user_class = 'User'\n#ShoppingCart.order_steps = %i(shipping payment)"
end

#mount_routesObject



18
19
20
21
22
# File 'lib/generators/shopping_cart/config_generator.rb', line 18

def mount_routes
  inject_into_file 'config/routes.rb', before: "root" do
    "mount ShoppingCart::Engine => '/shopping_cart'\n"
  end
end