Class: Thegarage::Gitx::Configuration
- Inherits:
-
Object
- Object
- Thegarage::Gitx::Configuration
- Defined in:
- lib/thegarage/gitx/configuration.rb
Constant Summary collapse
- DEFAULT_CONFIG =
{ 'aggregate_branches' => %w( staging prototype ), 'reserved_branches' => %w( HEAD master next_release staging prototype ), 'taggable_branches' => %w( master staging ) }
- CONFIG_FILE =
'.gitx.yml'
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #aggregate_branch?(branch) ⇒ Boolean
- #aggregate_branches ⇒ Object
-
#initialize(root_dir) ⇒ Configuration
constructor
A new instance of Configuration.
- #reserved_branch?(branch) ⇒ Boolean
- #reserved_branches ⇒ Object
- #taggable_branch?(branch) ⇒ Boolean
- #taggable_branches ⇒ Object
Constructor Details
#initialize(root_dir) ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 |
# File 'lib/thegarage/gitx/configuration.rb', line 15 def initialize(root_dir) @config = Thor::CoreExt::HashWithIndifferentAccess.new(DEFAULT_CONFIG) config_file_path = File.join(root_dir, CONFIG_FILE) if File.exists?(config_file_path) @config.merge!(::YAML::load_file(config_file_path)) end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/thegarage/gitx/configuration.rb', line 13 def config @config end |
Instance Method Details
#aggregate_branch?(branch) ⇒ Boolean
26 27 28 |
# File 'lib/thegarage/gitx/configuration.rb', line 26 def aggregate_branch?(branch) aggregate_branches.include?(branch) end |
#aggregate_branches ⇒ Object
23 24 25 |
# File 'lib/thegarage/gitx/configuration.rb', line 23 def aggregate_branches config[:aggregate_branches] end |
#reserved_branch?(branch) ⇒ Boolean
34 35 36 |
# File 'lib/thegarage/gitx/configuration.rb', line 34 def reserved_branch?(branch) reserved_branches.include?(branch) end |
#reserved_branches ⇒ Object
30 31 32 |
# File 'lib/thegarage/gitx/configuration.rb', line 30 def reserved_branches config[:reserved_branches] end |
#taggable_branch?(branch) ⇒ Boolean
42 43 44 |
# File 'lib/thegarage/gitx/configuration.rb', line 42 def taggable_branch?(branch) taggable_branches.include?(branch) end |
#taggable_branches ⇒ Object
38 39 40 |
# File 'lib/thegarage/gitx/configuration.rb', line 38 def taggable_branches config[:taggable_branches] end |