Class: Bolt::Boltdir
- Inherits:
-
Object
- Object
- Bolt::Boltdir
- Defined in:
- lib/bolt/boltdir.rb
Constant Summary collapse
- BOLTDIR_NAME =
'Boltdir'
Instance Attribute Summary collapse
-
#config_file ⇒ Object
readonly
Returns the value of attribute config_file.
-
#hiera_config ⇒ Object
readonly
Returns the value of attribute hiera_config.
-
#inventory_file ⇒ Object
readonly
Returns the value of attribute inventory_file.
-
#modulepath ⇒ Object
readonly
Returns the value of attribute modulepath.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#puppetfile ⇒ Object
readonly
Returns the value of attribute puppetfile.
-
#rerunfile ⇒ Object
readonly
Returns the value of attribute rerunfile.
Class Method Summary collapse
- .default_boltdir ⇒ Object
-
.find_boltdir(dir) ⇒ Object
Search recursively up the directory hierarchy for the Boltdir.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(path) ⇒ Boltdir
constructor
A new instance of Boltdir.
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ Boltdir
Returns a new instance of Boltdir.
32 33 34 35 36 37 38 39 40 |
# File 'lib/bolt/boltdir.rb', line 32 def initialize(path) @path = Pathname.new(path). @config_file = @path + 'bolt.yaml' @inventory_file = @path + 'inventory.yaml' @modulepath = [(@path + 'modules').to_s, (@path + 'site-modules').to_s, (@path + 'site').to_s] @hiera_config = @path + 'hiera.yaml' @puppetfile = @path + 'Puppetfile' @rerunfile = @path + '.rerun.json' end |
Instance Attribute Details
#config_file ⇒ Object (readonly)
Returns the value of attribute config_file.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def config_file @config_file end |
#hiera_config ⇒ Object (readonly)
Returns the value of attribute hiera_config.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def hiera_config @hiera_config end |
#inventory_file ⇒ Object (readonly)
Returns the value of attribute inventory_file.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def inventory_file @inventory_file end |
#modulepath ⇒ Object (readonly)
Returns the value of attribute modulepath.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def modulepath @modulepath end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def path @path end |
#puppetfile ⇒ Object (readonly)
Returns the value of attribute puppetfile.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def puppetfile @puppetfile end |
#rerunfile ⇒ Object (readonly)
Returns the value of attribute rerunfile.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def rerunfile @rerunfile end |
Class Method Details
.default_boltdir ⇒ Object
11 12 13 |
# File 'lib/bolt/boltdir.rb', line 11 def self.default_boltdir Boltdir.new(File.join('~', '.puppetlabs', 'bolt')) end |
.find_boltdir(dir) ⇒ Object
Search recursively up the directory hierarchy for the Boltdir. Look for a directory called Boltdir or a file called bolt.yaml (for a control repo type Boltdir). Otherwise, repeat the check on each directory up the hierarchy, falling back to the default if we reach the root.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bolt/boltdir.rb', line 19 def self.find_boltdir(dir) dir = Pathname.new(dir) if (dir + BOLTDIR_NAME).directory? new(dir + BOLTDIR_NAME) elsif (dir + 'bolt.yaml').file? new(dir) elsif dir.root? default_boltdir else find_boltdir(dir.parent) end end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
46 47 48 |
# File 'lib/bolt/boltdir.rb', line 46 def eql?(other) path == other.path end |
#to_s ⇒ Object
42 43 44 |
# File 'lib/bolt/boltdir.rb', line 42 def to_s @path.to_s end |