Class: MobileWorkflow::Cli::HerokuBackend
- Inherits:
-
Object
- Object
- MobileWorkflow::Cli::HerokuBackend
- Defined in:
- lib/mobile_workflow/cli/heroku_backend.rb
Instance Method Summary collapse
- #configure_activestorage ⇒ Object
- #create ⇒ Object
- #deploy ⇒ Object
- #destroy ⇒ Object
-
#initialize(app_name:) ⇒ HerokuBackend
constructor
A new instance of HerokuBackend.
- #notifications_endpoint ⇒ Object
- #seed_db ⇒ Object
- #sync_dotenv ⇒ Object
Constructor Details
#initialize(app_name:) ⇒ HerokuBackend
Returns a new instance of HerokuBackend.
6 7 8 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 6 def initialize(app_name:) @heroku_app_name = app_name.gsub('_', '-') end |
Instance Method Details
#configure_activestorage ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 15 def configure_activestorage heroku_command "heroku buildpacks:add -i 1 https://github.com/heroku/heroku-buildpack-activestorage-preview --app #{@heroku_app_name}" heroku_command "heroku labs:enable runtime-dyno-metadata --app #{@heroku_app_name}" # Gives access to heroku variables which can be used to construct URLs # Force recompile after buildpacks change heroku_command "git commit --allow-empty -m 'empty commit'" deploy end |
#create ⇒ Object
10 11 12 13 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 10 def create heroku_command "heroku create #{@heroku_app_name}" heroku_command 'git push --set-upstream heroku master' end |
#deploy ⇒ Object
24 25 26 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 24 def deploy heroku_command 'git push' end |
#destroy ⇒ Object
38 39 40 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 38 def destroy heroku_command "heroku destroy #{@heroku_app_name} --confirm #{@heroku_app_name}" end |
#notifications_endpoint ⇒ Object
42 43 44 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 42 def notifications_endpoint "https://#{@heroku_app_name}.herokuapp.com/sns_notifications" end |
#seed_db ⇒ Object
28 29 30 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 28 def seed_db heroku_command 'heroku run rails db:seed' end |
#sync_dotenv ⇒ Object
32 33 34 35 36 |
# File 'lib/mobile_workflow/cli/heroku_backend.rb', line 32 def sync_dotenv env = File.read('.env').split.join(' ') puts "Setting env: #{env}" heroku_command "heroku config:set #{env} --app #{@heroku_app_name}" end |