Class: R10K::Deployment::Environment
- Inherits:
-
Object
- Object
- R10K::Deployment::Environment
- Includes:
- Logging
- Defined in:
- lib/r10k/deployment/environment.rb
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#basedir ⇒ Object
readonly
Returns the value of attribute basedir.
-
#dirname ⇒ Object
readonly
Returns the value of attribute dirname.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
Instance Method Summary collapse
-
#initialize(ref, remote, basedir, dirname = nil, source_name = "") ⇒ Environment
constructor
A new instance of Environment.
- #modules ⇒ Object
- #puppetfile ⇒ Object
- #sync ⇒ Object
- #sync_modules ⇒ Object
Methods included from Logging
formatter, included, level, level=, levels, #logger, #logger_name, outputter, parse_level
Constructor Details
#initialize(ref, remote, basedir, dirname = nil, source_name = "") ⇒ Environment
Returns a new instance of Environment.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/r10k/deployment/environment.rb', line 31 def initialize(ref, remote, basedir, dirname = nil, source_name = "") @ref = ref @remote = remote @basedir = basedir alternate_name = source_name.empty? ? ref : source_name + "_" + ref @dirname = sanitize_dirname(dirname || alternate_name) @working_dir = R10K::Git::WorkingDir.new(@ref, @remote, @basedir, @dirname) @full_path = File.join(@basedir, @dirname) end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
Returns the value of attribute basedir.
20 21 22 |
# File 'lib/r10k/deployment/environment.rb', line 20 def basedir @basedir end |
#dirname ⇒ Object (readonly)
Returns the value of attribute dirname.
24 25 26 |
# File 'lib/r10k/deployment/environment.rb', line 24 def dirname @dirname end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
12 13 14 |
# File 'lib/r10k/deployment/environment.rb', line 12 def ref @ref end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
16 17 18 |
# File 'lib/r10k/deployment/environment.rb', line 16 def remote @remote end |
Instance Method Details
#modules ⇒ Object
63 64 65 66 |
# File 'lib/r10k/deployment/environment.rb', line 63 def modules puppetfile.load puppetfile.modules end |
#puppetfile ⇒ Object
59 60 61 |
# File 'lib/r10k/deployment/environment.rb', line 59 def puppetfile @puppetfile ||= R10K::Puppetfile.new(@full_path) end |
#sync ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/r10k/deployment/environment.rb', line 43 def sync recursive_needed = !(@working_dir.cloned?) @working_dir.sync if recursive_needed logger.debug "Environment #{@full_path} is a fresh clone; automatically updating modules." sync_modules end end |
#sync_modules ⇒ Object
53 54 55 56 57 |
# File 'lib/r10k/deployment/environment.rb', line 53 def sync_modules modules.each do |mod| mod.sync end end |