Sha256: cf880fd49f7959b953b5ada7777075850900b11c197ce890a8dc0d65ae440501

Contents?: true

Size: 1001 Bytes

Versions: 8

Compression:

Stored size: 1001 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

8 entries across 8 versions & 1 rubygems

Version Path
roo_on_rails-1.10.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.9.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.8.1 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.8.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.7.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.6.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.5.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb
roo_on_rails-1.4.0 lib/roo_on_rails/checks/heroku/preboot_enabled.rb