Class: Lambom::Converger

Inherits:
Object
  • Object
show all
Includes:
ShellMixin
Defined in:
lib/lambom/converger.rb

Constant Summary collapse

DEFAULT_CHEF_PATH =
'/var/chef'
CACHE_PATH =
"#{DEFAULT_CHEF_PATH}/cache"
ENV_VARS_DELETE =
%w{
                 GEM_PATH 
                 RUBY_VERSION 
                 GEM_HOME 
                 MY_RUBY_HOME
                 rvm_bin_path
                 rvm_path
                 rvm_gem_options
                 rvm_prefix
                 rvm_version
}
CHEF_CONF_FILE =
"#{Lambom::Config::CONFIG_DIR}/solo.rb"
CHEF_CONF_DEV =
<<EOF
cookbook_path ["/mnt/opscode/cookbooks", "/mnt/others/cookbooks", "/mnt/riyic/cookbooks"]
file_cache_path "#{CACHE_PATH}"
EOF
CHEF_CONF_OTHER =
<<EOF
cookbook_path ["#{DEFAULT_CHEF_PATH}/cookbooks", "#{DEFAULT_CHEF_PATH}/site-cookbooks"]
file_cache_path "#{CACHE_PATH}"
EOF
CHEF_CONF =
{
    :development => CHEF_CONF_DEV,
    :other => CHEF_CONF_OTHER,
}

Constants included from ShellMixin

ShellMixin::DEFAULT_TIMEOUT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ShellMixin

#run_cmd

Constructor Details

#initialize(conf) ⇒ Converger

Returns a new instance of Converger.



38
39
40
41
42
43
# File 'lib/lambom/converger.rb', line 38

def initialize(conf)
    @conf = conf
    @name = conf.server || String.random(8)
    @json_file = conf.json_file
    @berksfile = conf.berksfile
end

Instance Attribute Details

#attributes_jsonObject (readonly)

Returns the value of attribute attributes_json.



46
47
48
# File 'lib/lambom/converger.rb', line 46

def attributes_json
  @attributes_json
end

#confObject (readonly)

Returns the value of attribute conf.



46
47
48
# File 'lib/lambom/converger.rb', line 46

def conf
  @conf
end

Instance Method Details

#runObject



48
49
50
51
52
53
54
55
56
# File 'lib/lambom/converger.rb', line 48

def run
    preparar_entorno

    descargar_atributos unless conf.json_file

    descargar_cookbooks unless conf.cached || conf.environment == 'development'

    ejecutar_converger
end