Sha256: ba8aa16a23c8a3cbba58c5bf8a257d912c9a3d543c1677e34e2e76fc9f6bdec2

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require "oj"
require 'time'
require "mixlib/authentication"
require "mixlib/authentication/signedheaderauth"
require 'digest/sha1'
require 'openssl'
require 'net/http'

require "lambom/shell_mixin"
require "lambom/config"
require "lambom/api"
require "lambom/converger"


module Lambom
    $debug = false

    class << self
        def run(argv)
            puts "DEBUG ENABLED" if $debug
            puts "args recibidos #{argv.inspect}" if $debug
            raise 'Must run as root' unless Process.uid == 0

            #cargar config
            conf = Lambom::Config.new.load
            
            # sobreescribimos a configuracion ca linea de comandos
            conf.merge(argv)

            attributes = {}
            # descargar atributos do servidor (a menos que nos pasen json_file => file.json)
            if argv.has_key?(:json_file)
                json_attributes = IO.read(argv[:json_file])
            else
                json_attributes = Lambom::ApiClient.new(conf).get_server_config
            end

            # executar converxencia
            Lambom::Converger.new(conf,json_attributes).run
        end


        def enable_debug
            $debug = true
        end
    end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lambom-0.2.2 lib/lambom.rb
lambom-0.2.1 lib/lambom.rb
lambom-0.2.0 lib/lambom.rb
lambom-0.1.2 lib/lambom.rb