Sha256: 2d15ed2cdc8d4d4054c33b3983e10d99e56a08e35d96c1a0fe90f6984c4b6400

Contents?: true

Size: 1.45 KB

Versions: 40

Compression:

Stored size: 1.45 KB

Contents

module MobileWorkflow::Cli
  class HerokuBackend
    def initialize(app_name:)
      @heroku_app_name = app_name.gsub("_", "-")
    end
  
    def create
      heroku_command "heroku create #{@heroku_app_name}"
      heroku_command "git push --set-upstream heroku master"
    end
  
    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
  
    def deploy
      heroku_command "git push"
    end
    
    def seed_db
      heroku_command "heroku run rails db:seed"
    end
  
    def sync_dotenv
      env = File.read(".env").split.join(" ")
      puts "Setting env: #{env}"
      heroku_command "heroku config:set #{env} --app #{@heroku_app_name}"
    end
  
    def destroy
      heroku_command "heroku destroy #{@heroku_app_name} --confirm #{@heroku_app_name}"
    end
  
    def notifications_endpoint
      "https://#{@heroku_app_name}.herokuapp.com/sns_notifications"
    end
  
    private
    def heroku_command(command)
      puts "Running: #{command}"
      output = `#{command}`
      puts "Output: #{output}"
      return output
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
mobile_workflow-0.10.2 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.10.1 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.10.0 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.9.0 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.8.9 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.9 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.8 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.7 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.6 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.5 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.4 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.3 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.2 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.1 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.7.0 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.6.31 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.6.30 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.6.29 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.6.28 lib/mobile_workflow/cli/heroku_backend.rb
mobile_workflow-0.6.27 lib/mobile_workflow/cli/heroku_backend.rb