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



521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/heroku/samorau.rb', line 521

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

  response = data[:provision_response]
  data.merge!(: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 DeprovisionCheck, data
end

#run_in_env(env) ⇒ Object



543
544
545
546
547
# File 'lib/heroku/samorau.rb', line 543

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