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.
-
#resource_types ⇒ Object
readonly
Returns the value of attribute resource_types.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
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, type = 'option') ⇒ Boltdir
constructor
A new instance of Boltdir.
- #to_s ⇒ Object
Constructor Details
#initialize(path, type = 'option') ⇒ Boltdir
Returns a new instance of Boltdir.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/bolt/boltdir.rb', line 33 def initialize(path, type = 'option') @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' @resource_types = @path + '.resource_types' @type = type 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 |
#resource_types ⇒ Object (readonly)
Returns the value of attribute resource_types.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def resource_types @resource_types end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/bolt/boltdir.rb', line 9 def type @type end |
Class Method Details
.default_boltdir ⇒ Object
12 13 14 |
# File 'lib/bolt/boltdir.rb', line 12 def self.default_boltdir Boltdir.new(File.join('~', '.puppetlabs', 'bolt'), 'user') 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.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/bolt/boltdir.rb', line 20 def self.find_boltdir(dir) dir = Pathname.new(dir) if (dir + BOLTDIR_NAME).directory? new(dir + BOLTDIR_NAME, 'embedded') elsif (dir + 'bolt.yaml').file? new(dir, 'local') elsif dir.root? default_boltdir else find_boltdir(dir.parent) end end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
49 50 51 |
# File 'lib/bolt/boltdir.rb', line 49 def eql?(other) path == other.path end |
#to_s ⇒ Object
45 46 47 |
# File 'lib/bolt/boltdir.rb', line 45 def to_s @path.to_s end |