Class: Promote::Config
- Inherits:
-
Object
- Object
- Promote::Config
- Defined in:
- lib/promote/config.rb
Instance Attribute Summary collapse
-
#bags ⇒ Object
Returns the value of attribute bags.
-
#chef_server_url ⇒ Object
Returns the value of attribute chef_server_url.
-
#client_key ⇒ Object
Returns the value of attribute client_key.
-
#cookbook_directory ⇒ Object
Returns the value of attribute cookbook_directory.
-
#data_bag_directory ⇒ Object
Returns the value of attribute data_bag_directory.
-
#environment_directory ⇒ Object
Returns the value of attribute environment_directory.
-
#node_name ⇒ Object
Returns the value of attribute node_name.
-
#repo_root ⇒ Object
Returns the value of attribute repo_root.
-
#role_directory ⇒ Object
Returns the value of attribute role_directory.
-
#temp_directory ⇒ Object
Returns the value of attribute temp_directory.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #reset_temp_dir ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/promote/config.rb', line 3 def initialize( = {}) .each do |k, v| self.send("#{k}=", v) if self.respond_to?(k) end self.repo_root ||= Dir.pwd self.cookbook_directory ||= File.join(repo_root, "cookbooks") self.environment_directory ||= File.join(repo_root, "environments") self.data_bag_directory ||= File.join(repo_root, "data_bags") self.role_directory ||= File.join(repo_root, "roles") self.temp_directory ||= "/tmp/promote" self.bags ||= ['secrets_*'] end |
Instance Attribute Details
#bags ⇒ Object
Returns the value of attribute bags.
42 43 44 |
# File 'lib/promote/config.rb', line 42 def bags @bags end |
#chef_server_url ⇒ Object
Returns the value of attribute chef_server_url.
41 42 43 |
# File 'lib/promote/config.rb', line 41 def chef_server_url @chef_server_url end |
#client_key ⇒ Object
Returns the value of attribute client_key.
40 41 42 |
# File 'lib/promote/config.rb', line 40 def client_key @client_key end |
#cookbook_directory ⇒ Object
Returns the value of attribute cookbook_directory.
34 35 36 |
# File 'lib/promote/config.rb', line 34 def cookbook_directory @cookbook_directory end |
#data_bag_directory ⇒ Object
Returns the value of attribute data_bag_directory.
36 37 38 |
# File 'lib/promote/config.rb', line 36 def data_bag_directory @data_bag_directory end |
#environment_directory ⇒ Object
Returns the value of attribute environment_directory.
35 36 37 |
# File 'lib/promote/config.rb', line 35 def environment_directory @environment_directory end |
#node_name ⇒ Object
Returns the value of attribute node_name.
39 40 41 |
# File 'lib/promote/config.rb', line 39 def node_name @node_name end |
#repo_root ⇒ Object
Returns the value of attribute repo_root.
33 34 35 |
# File 'lib/promote/config.rb', line 33 def repo_root @repo_root end |
#role_directory ⇒ Object
Returns the value of attribute role_directory.
37 38 39 |
# File 'lib/promote/config.rb', line 37 def role_directory @role_directory end |
#temp_directory ⇒ Object
Returns the value of attribute temp_directory.
38 39 40 |
# File 'lib/promote/config.rb', line 38 def temp_directory @temp_directory end |
Instance Method Details
#reset_temp_dir ⇒ Object
16 17 18 19 |
# File 'lib/promote/config.rb', line 16 def reset_temp_dir FileUtils.rm_rf(temp_directory) if Dir.exist?(temp_directory) Dir.mkdir(temp_directory) end |
#to_hash ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/promote/config.rb', line 21 def to_hash hash = {} instance_variables.each do |key| hash[key[1..-1].to_sym] = instance_variable_get key end hash end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/promote/config.rb', line 29 def to_s to_hash.to_s end |