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/cookbooks/supermarket", "/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.



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

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.



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

def attributes_json
  @attributes_json
end

#confObject (readonly)

Returns the value of attribute conf.



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

def conf
  @conf
end

Instance Method Details

#runObject



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

def run
  preparar_entorno

  descargar_atributos unless conf.json_file

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

  ejecutar_converger
end