Class: R10K::Root
Instance Attribute Summary collapse
-
#basedir ⇒ Object
readonly
Returns the value of attribute basedir.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
Instance Method Summary collapse
- #full_path ⇒ Object
-
#initialize(hash) ⇒ Root
constructor
A new instance of Root.
- #modules ⇒ Object
- #sync!(options = {}) ⇒ Object
- #sync_modules!(options = {}) ⇒ Object
Methods included from Logging
formatter, included, level, level=, #logger, outputter
Constructor Details
#initialize(hash) ⇒ Root
Returns a new instance of Root.
26 27 28 |
# File 'lib/r10k/root.rb', line 26 def initialize(hash) parse_initialize_hash(hash) end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
Returns the value of attribute basedir.
16 17 18 |
# File 'lib/r10k/root.rb', line 16 def basedir @basedir end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/r10k/root.rb', line 12 def name @name end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
24 25 26 |
# File 'lib/r10k/root.rb', line 24 def ref @ref end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
20 21 22 |
# File 'lib/r10k/root.rb', line 20 def remote @remote end |
Instance Method Details
#full_path ⇒ Object
59 60 61 |
# File 'lib/r10k/root.rb', line 59 def full_path @full_path ||= File.(File.join @basedir, @name) end |
#modules ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/r10k/root.rb', line 44 def modules librarian = R10K::Librarian.new("#{full_path}/Puppetfile") module_data = librarian.load @modules = module_data.map do |mod| name = mod[0] args = mod[1] R10K::Module.new(name, "#{full_path}/modules", args) end rescue Errno::ENOENT logger.warn "#{self}: #{full_path} does not exist, cannot enumerate modules." [] end |
#sync!(options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/r10k/root.rb', line 30 def sync!( = {}) synchro = R10K::Synchro::Git.new(@remote) recursive_needed = !(synchro.cloned?(full_path)) synchro.sync(full_path, @ref, ) sync_modules!() if recursive_needed end |
#sync_modules!(options = {}) ⇒ Object
38 39 40 41 42 |
# File 'lib/r10k/root.rb', line 38 def sync_modules!( = {}) modules.each do |mod| mod.sync!() end end |