class RooOnRails::Harness

Public Class Methods

new(try_fix: false, environments: nil, context: Hashie::Mash.new, dry_run: false) click to toggle source
# File lib/roo_on_rails/harness.rb, line 11
def initialize(try_fix: false, environments: nil, context: Hashie::Mash.new, dry_run: false)
  @try_fix = try_fix
  @context = context
  @dry_run = dry_run
  @environments = environments
end

Public Instance Methods

run() click to toggle source
# File lib/roo_on_rails/harness.rb, line 18
def run
  checks = [
    Checks::EnvironmentIndependent.new(fix: @try_fix, context: @context, dry_run: @dry_run),
  ]
  environments.each do |env|
    checks << Checks::Environment.new(env: env.strip, fix: @try_fix, context: @context, dry_run: @dry_run)
  end

  return if checks.map(&:run).all?
  say 'At least one check failed.', %i[bold red]
end

Private Instance Methods

environments() click to toggle source
# File lib/roo_on_rails/harness.rb, line 32
def environments
  as_string = @environments || ENV.fetch('ROO_ON_RAILS_ENVIRONMENTS', 'staging,production')
  as_string.split(',')
end