Class: StripeWrapper::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_filesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/generators/stripe_wrapper/install/install_generator.rb', line 14

def copy_files
  # controllers
  source = File.join(Gem.loaded_specs["stripe_wrapper"].full_gem_path, "app", "controllers", "stripe_wrapper")
  target = File.join(Rails.root, "app", "controllers", "stripe_wrapper")
  FileUtils.cp_r source, target
  # models
  source = File.join(Gem.loaded_specs["stripe_wrapper"].full_gem_path, "app", "models", "stripe_wrapper")
  target = File.join(Rails.root, "app", "models", "stripe_wrapper")
  FileUtils.cp_r source, target
  # views
  source = File.join(Gem.loaded_specs["stripe_wrapper"].full_gem_path, "app", "views", "stripe_wrapper")
  target = File.join(Rails.root, "app", "views", "stripe_wrapper")
  FileUtils.cp_r source, target
  # locales
  source = File.join(Gem.loaded_specs["stripe_wrapper"].full_gem_path, "config", "locales", "en.yml")
  target = File.join(Rails.root, "config", "locales", "stripe_wrapper.en.yml")
  FileUtils.cp source, target
  source = File.join(Gem.loaded_specs["stripe_wrapper"].full_gem_path, "config", "locales", "es.yml")
  target = File.join(Rails.root, "config", "locales", "stripe_wrapper.es.yml")
  FileUtils.cp source, target
end

#install_migrationObject



6
7
8
# File 'lib/generators/stripe_wrapper/install/install_generator.rb', line 6

def install_migration
  rake 'stripe_wrapper:install:migrations'
end

#mount_engineObject



10
11
12
# File 'lib/generators/stripe_wrapper/install/install_generator.rb', line 10

def mount_engine
  route 'mount StripeWrapper::Engine => "/stripe_wrapper", as: "stripe_wrapper"'
end