Class: Gitx::Configuration
- Inherits:
-
Object
- Object
- Gitx::Configuration
- Defined in:
- lib/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.
14 15 16 17 18 |
# File 'lib/gitx/configuration.rb', line 14 def initialize(root_dir) @config = Thor::CoreExt::HashWithIndifferentAccess.new(DEFAULT_CONFIG) config_file_path = File.join(root_dir, CONFIG_FILE) @config.merge!(::YAML.load_file(config_file_path)) if File.exist?(config_file_path) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
12 13 14 |
# File 'lib/gitx/configuration.rb', line 12 def config @config end |
Instance Method Details
#aggregate_branch?(branch) ⇒ Boolean
24 25 26 |
# File 'lib/gitx/configuration.rb', line 24 def aggregate_branch?(branch) aggregate_branches.include?(branch) end |
#aggregate_branches ⇒ Object
20 21 22 |
# File 'lib/gitx/configuration.rb', line 20 def aggregate_branches config[:aggregate_branches] end |
#reserved_branch?(branch) ⇒ Boolean
32 33 34 |
# File 'lib/gitx/configuration.rb', line 32 def reserved_branch?(branch) reserved_branches.include?(branch) end |
#reserved_branches ⇒ Object
28 29 30 |
# File 'lib/gitx/configuration.rb', line 28 def reserved_branches config[:reserved_branches] end |
#taggable_branch?(branch) ⇒ Boolean
40 41 42 |
# File 'lib/gitx/configuration.rb', line 40 def taggable_branch?(branch) taggable_branches.include?(branch) end |
#taggable_branches ⇒ Object
36 37 38 |
# File 'lib/gitx/configuration.rb', line 36 def taggable_branches config[:taggable_branches] end |