Class: Boring::Payments::Stripe::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_checkouts_resourcesObject



17
18
19
20
21
22
# File 'lib/generators/boring/payments/stripe/install/install_generator.rb', line 17

def add_checkouts_resources
  say "Adding stripe checkout resources"
  copy_file("controllers/stripe/checkouts_controller.rb", "app/controllers/stripe/checkouts_controller.rb")
  copy_file("views/stripe/checkouts/create.js.erb", "app/views/stripe/checkouts/create.js.erb")
  copy_file("views/stripe/checkouts/show.html.erb", "app/views/stripe/checkouts/show.html.erb")
end

#add_stripe_gemObject



10
11
12
13
14
15
# File 'lib/generators/boring/payments/stripe/install/install_generator.rb', line 10

def add_stripe_gem
  say "Adding stripe gem", :green
  Bundler.with_unbundled_env do
    run "bundle add stripe"
  end
end

#add_stripe_initializerObject



32
33
34
35
# File 'lib/generators/boring/payments/stripe/install/install_generator.rb', line 32

def add_stripe_initializer
  say "Adding stripe initalizers"
  copy_file("stripe.rb", "config/initializers/stripe.rb")
end

#add_stripe_routesObject



24
25
26
27
28
29
30
# File 'lib/generators/boring/payments/stripe/install/install_generator.rb', line 24

def add_stripe_routes
  route <<~ROUTE
    namespace :stripe do
      resource :checkout, only: [:create, :show]
    end
  ROUTE
end

#show_readmeObject



37
38
39
# File 'lib/generators/boring/payments/stripe/install/install_generator.rb', line 37

def show_readme
  readme "README"
end