Class: R10K::Source::Base
- Inherits:
-
Object
- Object
- R10K::Source::Base
- Includes:
- Logging
- Defined in:
- lib/r10k/source/base.rb
Overview
This class defines a common interface for source implementations.
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
- #basedir ⇒ Object readonly
- #name ⇒ Object readonly
- #prefix ⇒ Object readonly
- #puppetfile_name ⇒ Object readonly
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#environments ⇒ Array<R10K::Environment::Base>
abstract
Enumerate the environments associated with this SVN source.
-
#initialize(name, basedir, options = {}) ⇒ Base
constructor
Initialize the given source.
-
#preload! ⇒ void
abstract
Perform any actions needed for loading environments that may have side effects.
-
#reload! ⇒ void
abstract
Perform actions to reload environments after the ‘preload!`.
Methods included from Logging
debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level
Constructor Details
#initialize(name, basedir, options = {}) ⇒ Base
Initialize the given source.
42 43 44 45 46 47 48 49 |
# File 'lib/r10k/source/base.rb', line 42 def initialize(name, basedir, = {}) @name = name @basedir = Pathname.new(basedir).cleanpath.to_s @prefix = .delete(:prefix) @strip_component = .delete(:strip_component) @puppetfile_name = .delete(:puppetfile_name) @options = end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
12 13 14 |
# File 'lib/r10k/source/base.rb', line 12 def basedir @basedir end |
#name ⇒ Object (readonly)
16 17 18 |
# File 'lib/r10k/source/base.rb', line 16 def name @name end |
#prefix ⇒ Object (readonly)
21 22 23 |
# File 'lib/r10k/source/base.rb', line 21 def prefix @prefix end |
#puppetfile_name ⇒ Object (readonly)
26 27 28 |
# File 'lib/r10k/source/base.rb', line 26 def puppetfile_name @puppetfile_name end |
Instance Method Details
#accept(visitor) ⇒ Object
86 87 88 89 90 91 92 |
# File 'lib/r10k/source/base.rb', line 86 def accept(visitor) visitor.visit(:source, self) do environments.each do |env| env.accept(visitor) end end end |
#environments ⇒ Array<R10K::Environment::Base>
Enumerate the environments associated with this SVN source.
82 83 84 |
# File 'lib/r10k/source/base.rb', line 82 def environments raise NotImplementedError, _("%{class} has not implemented method %{method}") % {class: self.class, method: __method__} end |
#preload! ⇒ void
This method returns an undefined value.
Perform any actions needed for loading environments that may have side effects.
Actions done during preloading may include things like updating caches or performing network queries. If an environment has not been preloaded but #environments is invoked, it should return the best known state of environments or return an empty list.
62 63 64 |
# File 'lib/r10k/source/base.rb', line 62 def preload! end |
#reload! ⇒ void
This method returns an undefined value.
Perform actions to reload environments after the ‘preload!`. Similar to preload!, and likely to include network queries and rerunning environment generation.
73 74 |
# File 'lib/r10k/source/base.rb', line 73 def reload! end |