Sha256: dd61c0fd955eb94af0e0f28a559ddab9ce989139ef14c6e963914717fe56245c

Contents?: true

Size: 1.31 KB

Versions: 20

Compression:

Stored size: 1.31 KB

Contents

require 'roo_on_rails/checks/env_specific'
require 'roo_on_rails/checks/heroku/app_exists'
require 'roo_on_rails/checks/papertrail/token'
require 'roo_on_rails/checks/papertrail/system_exists'

module RooOnRails
  module Checks
    module Papertrail
      # Checks that the Papertrail system for an app in named like the app
      #
      # Input context
      # - heroku.app.{env}
      # - papertrail.system_id.{env}: a Papertrail system ID
      # - papertrail.client
      #
      # Output context:
      # - None
      class SystemNamed < EnvSpecific
        requires Heroku::AppExists
        requires Token
        requires SystemExists

        def intro
          'Checking that the app is named in Papertrail'
        end

        def call
          data = context.papertrail.client.get_system(system_id)

          fail! "wrong name for Papertrail system '#{system_id}' found" if data.name != app_name

          pass "system #{system_id} named #{app_name}"
        end

        def fix
          context.papertrail.client.update_system(system_id, app_name)
        end

        private

        def system_id
          context.papertrail.system_id[env]
        end

        def app_name
          context.heroku.app[env]
        end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
roo_on_rails-2.2.2 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-2.2.1 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-2.2.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-2.1.2 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-2.1.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-2.0.0.pre.pre.2 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-2.0.0.pre.pre.1 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.22.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.21.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.20.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.19.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.18.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.17.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.16.2 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.16.1 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.16.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.15.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.14.0 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.13.1 lib/roo_on_rails/checks/papertrail/system_named.rb
roo_on_rails-1.13.0 lib/roo_on_rails/checks/papertrail/system_named.rb