Class: Trek::Generators::Install::ScalingoGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Trek::Generators::Install::ScalingoGenerator
- Includes:
- Helpers
- Defined in:
- lib/generators/trek/install/scalingo_generator.rb
Constant Summary collapse
- BUILDPACK_URL =
"https://github.com/etaminstudio/trek-buildpack#v0.1.0".freeze
Instance Method Summary collapse
- #create_aptfile ⇒ Object
- #create_procfile ⇒ Object
- #final_instructions ⇒ Object
-
#remove_buildpacks ⇒ Object
The trek-buildpack replaces the apt + ruby buildpack combination.
Instance Method Details
#create_aptfile ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/trek/install/scalingo_generator.rb', line 20 def create_aptfile create_file "Aptfile" do <<~TEXT libjemalloc2 libvips-tools --no-install-recommends libwebp-dev TEXT end end |
#create_procfile ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/generators/trek/install/scalingo_generator.rb', line 30 def create_procfile create_file "Procfile" do <<~TEXT web: bundle exec rails server -p $PORT -e $RAILS_ENV -b 0.0.0.0 # worker: bundle exec sidekiq -C config/sidekiq.yml postdeploy: bundle exec rails db:migrate TEXT end end |
#final_instructions ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/generators/trek/install/scalingo_generator.rb', line 40 def final_instructions say "" say "Configure the Scalingo app environment:" say "" say " scalingo --app <app> env-set BUILDPACK_URL=#{BUILDPACK_URL}" say " scalingo --app <app> env-set 'DATABASE_URL=$SCALINGO_POSTGRESQL_URL'" say "" say "and make sure config/database.yml reads DATABASE_URL in production." say "" say "See https://trek.etamin.studio/deploy for details." say "" end |
#remove_buildpacks ⇒ Object
The trek-buildpack replaces the apt + ruby buildpack combination. It
pins Node from the .node-version that rails new already generates.
16 17 18 |
# File 'lib/generators/trek/install/scalingo_generator.rb', line 16 def remove_buildpacks remove_file ".buildpacks" end |