Sha256: d9ea87d32d5d3216ceb7d3b6441fa9a6aa6586e9f861e2411fe652f23d7ace17

Contents?: true

Size: 1009 Bytes

Versions: 4

Compression:

Stored size: 1009 Bytes

Contents

require 'roo_on_rails/checks/env_specific'
require 'roo_on_rails/checks/git/origin'
require 'roo_on_rails/checks/heroku/app_exists'

module RooOnRails
  module Checks
    module Heroku
      # Input context
      # - heroku.api_client: a connected PlatformAPI client
      # - heroku.app.{env}: an existing app name.
      class PrebootEnabled < EnvSpecific
        requires Git::Origin, Heroku::AppExists
        
        def intro
          "Checking preboot status on #{bold app_name}"
        end

        def call
          status = client.app_feature.info(app_name, 'preboot')
          if status['enabled']
            pass 'preboot enabled'
          else
            fail! 'preboot disabled'
          end
        end

        private

        def fix
          client.app_feature.update(app_name, 'preboot', enabled: true)
        end

        def app_name
          context.heroku.app[env]
        end

        def client
          context.heroku.api_client
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roo_on_rails-1.3.1 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.3.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.2.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.1.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb