Class: Shopapp::DeployGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Shopapp::DeployGenerator
- Defined in:
- lib/generators/shopapp/deploy/deploy_generator.rb
Instance Method Summary collapse
- #app_code ⇒ Object
- #create_capfile ⇒ Object
- #create_config_deploy_production_rb ⇒ Object
- #create_config_deploy_rb ⇒ Object
Instance Method Details
#app_code ⇒ Object
7 8 9 10 |
# File 'lib/generators/shopapp/deploy/deploy_generator.rb', line 7 def app_code (Rails.configuration.settings['shopapp_name'] || Rails.application.class.parent_name).to_s.downcase.parameterize.underscore end |
#create_capfile ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/generators/shopapp/deploy/deploy_generator.rb', line 12 def create_capfile create_file "Capfile", " require \"capistrano/setup\"\n require \"capistrano/deploy\"\n\n require \"capistrano/scm/git\"\n install_plugin Capistrano::SCM::Git\n\n require 'capistrano/rvm'\n require \"capistrano/bundler\"\n require \"capistrano/rails/assets\"\n require \"capistrano/rails/migrations\"\n require \"capistrano/passenger\"\n # require \"capistrano/yarn\"\n\n Dir.glob(\"lib/capistrano/tasks/*.rake\").each { |r| import r }\n FILECONTENT\nend\n" |
#create_config_deploy_production_rb ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/generators/shopapp/deploy/deploy_generator.rb', line 45 def create_config_deploy_production_rb create_file "config/deploy/production.rb", " set :stage, :production\n set :rails_env, :production\n set :branch, \"master\"\n\n server \"\#{app_code}.shoplift.fi\", user: \"\#{app_code}\", roles: %w{app db web}\n FILECONTENT\nend\n" |
#create_config_deploy_rb ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/generators/shopapp/deploy/deploy_generator.rb', line 31 def create_config_deploy_rb create_file "config/deploy.rb", " lock \"~> 3.11.0\"\n\n set :application, \"Prolift\"\n set :repo_url, \"[email protected]:shoplift/\#{app_code}.git\"\n set :rvm_ruby_version, '2.5.1'\n append :linked_files, 'config/local.yml'\n\n set :deploy_to, \"/home/shoplift/\#{app_code}\"\n set :passenger_restart_with_touch, true\n FILECONTENT\nend\n" |