class MobileWorkflow::Cli::HerokuBackend
Public Class Methods
new(app_name:)
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 3 def initialize(app_name:) @heroku_app_name = app_name.gsub("_", "-") end
Public Instance Methods
configure_activestorage()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 12 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()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 7 def create heroku_command "heroku create #{@heroku_app_name}" heroku_command "git push --set-upstream heroku master" end
deploy()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 21 def deploy heroku_command "git push" end
destroy()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 35 def destroy heroku_command "heroku destroy #{@heroku_app_name} --confirm #{@heroku_app_name}" end
notifications_endpoint()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 39 def notifications_endpoint "https://#{@heroku_app_name}.herokuapp.com/sns_notifications" end
seed_db()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 25 def seed_db heroku_command "heroku run rails db:seed" end
sync_dotenv()
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 29 def sync_dotenv env = File.read(".env").split.join(" ") puts "Setting env: #{env}" heroku_command "heroku config:set #{env} --app #{@heroku_app_name}" end
Private Instance Methods
heroku_command(command)
click to toggle source
# File lib/mobile_workflow/cli/heroku_backend.rb, line 44 def heroku_command(command) puts "Running: #{command}" output = `#{command}` puts "Output: #{output}" return output end