Class: Locomotive::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Locomotive::InstallGenerator
- Defined in:
- lib/generators/locomotive/install/install_generator.rb
Instance Method Summary collapse
- #copy_initializers ⇒ Object
- #enable_heroku ⇒ Object
- #insert_engine_routes ⇒ Object
- #install_aws ⇒ Object
- #remove_index_html ⇒ Object
- #show_readme ⇒ Object
- #use_puma_as_app_server ⇒ Object
Instance Method Details
#copy_initializers ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 8 def copy_initializers @source_paths = nil # reset it for the find_in_source_paths method Locomotive::InstallGenerator.source_root(File.('../templates', __FILE__)) template 'locomotive.rb', 'config/initializers/locomotive.rb' template 'devise.rb', 'config/initializers/devise.rb' template 'dragonfly.rb', 'config/initializers/dragonfly.rb' template 'mongoid.yml', 'config/mongoid.yml' end |
#enable_heroku ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 43 def enable_heroku if .heroku? inject_into_file 'Gemfile', after: "source 'https://rubygems.org'\n" do "\nif ENV['HEROKU_APP_NAME']\nruby '2.2.2'\nend\n" end template 'heroku.rb', 'config/initializers/heroku.rb' template 'mongoid_heroku.yml', 'config/mongoid.yml', force: true inject_into_file 'config/environments/production.rb', after: " # config.action_mailer.raise_delivery_errors = false\n" do "config.action_mailer.raise_delivery_errors = true\nconfig.action_mailer.delivery_method = :smtp\nconfig.action_mailer.smtp_settings = {\n:address => 'smtp.sendgrid.net',\n:port => 25,\n:authentication => :plain,\n:user_name => ENV['SENDGRID_USERNAME'],\n:password => ENV['SENDGRID_PASSWORD'],\n:domain => ENV['SENDGRID_DOMAIN']\n}\n" end gem 'platform-api', '~> 0.3.0' end end |
#insert_engine_routes ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 31 def insert_engine_routes route %( # Locomotive Back-office mount Locomotive::Engine => '/locomotive', as: 'locomotive' # you can change the value of the path, by default set to "/locomotive" # Locomotive API mount Locomotive::API.to_app => '/locomotive(/:site_handle)/api' # Render site mount Locomotive::Steam.to_app => '/', anchor: false) end |
#install_aws ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 22 def install_aws if .heroku? || yes?('Do you want to store your assets on Amazon S3?') template 'carrierwave_aws.rb', 'config/initializers/carrierwave.rb' gem 'carrierwave-aws' else template 'carrierwave.rb', 'config/initializers/carrierwave.rb' end end |
#remove_index_html ⇒ Object
74 75 76 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 74 def remove_index_html remove_file 'public/index.html' end |
#show_readme ⇒ Object
86 87 88 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 86 def show_readme readme 'README' end |
#use_puma_as_app_server ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/generators/locomotive/install/install_generator.rb', line 78 def use_puma_as_app_server inject_into_file 'Gemfile', after: "# gem 'unicorn'\n" do "# Use Puma as the app server\ngem 'puma'\n" end end |