Class: Heroku::Samorau::AllCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/heroku/samorau.rb

Overview

On Testing:

I've opted to not write tests for this
due to the simple nature it's currently in.
If this becomes more complex in even the
least amount, find me (blake) and I'll
help get tests in.

Instance Attribute Summary

Attributes inherited from Check

#data, #screen

Instance Method Summary collapse

Methods inherited from Check

#call, #check, #error, #initialize, #run, #test, #to_proc

Constructor Details

This class inherits a constructor from Heroku::Samorau::Check

Instance Method Details

#call!Object



433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/heroku/samorau.rb', line 433

def call!
  args = data[:args]
  run CreateCheck, data

  response = data[:create_response]
  id = response["id"]
  config = response["config"] || Hash.new

  if args
    screen.message "\n\n"
    screen.message "Starting #{args.first}..."
    screen.message ""

    run_in_env(config) { system(*args) }

    screen.message ""
    screen.message "End of #{args.first}"
  end

  run DeleteCheck, data.merge(:id => id)
end

#run_in_env(env) ⇒ Object



455
456
457
458
459
# File 'lib/heroku/samorau.rb', line 455

def run_in_env(env)
  env.each {|key, value| ENV[key] = value }
  yield
  env.keys.each {|key| ENV.delete(key) }
end