Class: LessonsIndexer::Addons::GitManager::Brancher
- Inherits:
-
Object
- Object
- LessonsIndexer::Addons::GitManager::Brancher
- Defined in:
- lib/lessons_indexer/addons/git_manager.rb
Instance Attribute Summary collapse
-
#ignore_master ⇒ Object
readonly
Returns the value of attribute ignore_master.
Instance Method Summary collapse
- #get_branches ⇒ Object
-
#initialize(ignore_master = true) ⇒ Brancher
constructor
A new instance of Brancher.
- #within_branch(branch) ⇒ Object
Constructor Details
#initialize(ignore_master = true) ⇒ Brancher
Returns a new instance of Brancher.
21 22 23 |
# File 'lib/lessons_indexer/addons/git_manager.rb', line 21 def initialize(ignore_master = true) @ignore_master = ignore_master end |
Instance Attribute Details
#ignore_master ⇒ Object (readonly)
Returns the value of attribute ignore_master.
19 20 21 |
# File 'lib/lessons_indexer/addons/git_manager.rb', line 19 def ignore_master @ignore_master end |
Instance Method Details
#get_branches ⇒ Object
25 26 27 28 |
# File 'lib/lessons_indexer/addons/git_manager.rb', line 25 def get_branches branches = %x{git branch}.split("\n").map {|br| br.strip.gsub(/\A\*\s*/, '') } ignore_master ? branches.reject {|el| el == 'master'} : branches end |
#within_branch(branch) ⇒ Object
30 31 32 33 |
# File 'lib/lessons_indexer/addons/git_manager.rb', line 30 def within_branch(branch) %x{git checkout #{branch} --force} yield if block_given? end |