Class: RooOnRails::Harness

Inherits:
Object
  • Object
show all
Includes:
Thor::Shell
Defined in:
lib/roo_on_rails/harness.rb

Instance Method Summary collapse

Constructor Details

#initialize(try_fix: false, environments: nil, context: Hashie::Mash.new, dry_run: false) ⇒ Harness

Returns a new instance of Harness.



11
12
13
14
15
16
# 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

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
# 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