Class: ApplyConfig
- Inherits:
-
Object
- Object
- ApplyConfig
- Defined in:
- lib/commands/apply-config.rb
Instance Method Summary collapse
- #do(gitRoot, test = false, stepNum = nil, task = nil) ⇒ Object
-
#initialize ⇒ ApplyConfig
constructor
A new instance of ApplyConfig.
- #log(msg) ⇒ Object
Constructor Details
#initialize ⇒ ApplyConfig
Returns a new instance of ApplyConfig.
7 8 9 |
# File 'lib/commands/apply-config.rb', line 7 def initialize () @log = Logger.new(Canzea::config[:logging_root] + '/plans.log') end |
Instance Method Details
#do(gitRoot, test = false, stepNum = nil, task = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/commands/apply-config.rb', line 11 def do (gitRoot, test = false, stepNum = nil, task = nil) ps = PlanStep.new # Read the configuration file and make calls out to run log "Processing #{gitRoot}/configure.json" steps = JSON.parse(File.read("#{gitRoot}/configure.json")) index = 1 steps["steps"].each { | step | # Needs to be after each step because new env vars could be set (i.e./ CONSUL_URL) AddEnv.new.injectEnvironmentVariables() ref = "Step #{index.to_s.rjust(2, "0")} / #{steps['steps'].length}" role = step['role'] solution = step['solution'] ENV['ES_STEP'] = "#{index}"; if (stepNum == nil or index >= Integer(stepNum)) log " [#{ref}] Configure for #{role} and #{solution}" ps.runPhaseConfigure role, solution, test, (task == nil ? 1:task), ref task = 1 else log " [#{ref}] Configure for #{role} and #{solution} SKIP" end index = index + 1 } end |
#log(msg) ⇒ Object
45 46 47 48 |
# File 'lib/commands/apply-config.rb', line 45 def log (msg) puts msg @log.info(msg) end |