Sha256: 718b1ed196bae63a49e1b4407d950b720f00e3511c7b7a12809ac4d746232754

Contents?: true

Size: 1.28 KB

Versions: 22

Compression:

Stored size: 1.28 KB

Contents

require 'json'
require 'logger'
require 'commands/add-env'
require 'plan-step-class'

class ApplyConfig
    def initialize ()
        @log = Logger.new(Canzea::config[:logging_root] + '/plans.log')
    end

    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']

            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

    def log (msg)
        puts msg
        @log.info(msg)
    end

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
canzea-0.1.96 lib/commands/apply-config.rb
canzea-0.1.95 lib/commands/apply-config.rb
canzea-0.1.94 lib/commands/apply-config.rb
canzea-0.1.93 lib/commands/apply-config.rb
canzea-0.1.91 lib/commands/apply-config.rb
canzea-0.1.90 lib/commands/apply-config.rb
canzea-0.1.89 lib/commands/apply-config.rb
canzea-0.1.88 lib/commands/apply-config.rb
canzea-0.1.87 lib/commands/apply-config.rb
canzea-0.1.86 lib/commands/apply-config.rb
canzea-0.1.85 lib/commands/apply-config.rb
canzea-0.1.84 lib/commands/apply-config.rb
canzea-0.1.83 lib/commands/apply-config.rb
canzea-0.1.82 lib/commands/apply-config.rb
canzea-0.1.81 lib/commands/apply-config.rb
canzea-0.1.80 lib/commands/apply-config.rb
canzea-0.1.78 lib/commands/apply-config.rb
canzea-0.1.77 lib/commands/apply-config.rb
canzea-0.1.76 lib/commands/apply-config.rb
canzea-0.1.74 lib/commands/apply-config.rb