Class: R10K::Source::Base
- Inherits:
-
Object
- Object
- R10K::Source::Base
- Defined in:
- lib/r10k/source/base.rb
Overview
This class defines a common interface for source implementations.
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.
Constructor Details
#initialize(name, basedir, options = {}) ⇒ Base
Initialize the given source.
34 35 36 37 38 39 40 |
# File 'lib/r10k/source/base.rb', line 34 def initialize(name, basedir, = {}) @name = name @basedir = Pathname.new(basedir).cleanpath.to_s @prefix = .delete(:prefix) @puppetfile_name = .delete(:puppetfile_name) = end |
Instance Attribute Details
#basedir ⇒ Object (readonly)
8 9 10 |
# File 'lib/r10k/source/base.rb', line 8 def basedir @basedir end |
#name ⇒ Object (readonly)
12 13 14 |
# File 'lib/r10k/source/base.rb', line 12 def name @name end |
#prefix ⇒ Object (readonly)
17 18 19 |
# File 'lib/r10k/source/base.rb', line 17 def prefix @prefix end |
#puppetfile_name ⇒ Object (readonly)
22 23 24 |
# File 'lib/r10k/source/base.rb', line 22 def puppetfile_name @puppetfile_name end |
Instance Method Details
#accept(visitor) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/r10k/source/base.rb', line 67 def accept(visitor) visitor.visit(:source, self) do environments.each do |env| env.accept(visitor) end end end |
#environments ⇒ Array<R10K::Environment::Base>
This method is abstract.
Enumerate the environments associated with this SVN source.
63 64 65 |
# File 'lib/r10k/source/base.rb', line 63 def environments raise NotImplementedError, _("%{class} has not implemented method %{method}") % {class: self.class, method: __method__} end |
#preload! ⇒ void
This method is abstract.
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.
53 54 55 |
# File 'lib/r10k/source/base.rb', line 53 def preload! end |