Class: AppCommand::GitBranch
- Inherits:
-
Convoy::ActionCommand::Base
- Object
- Convoy::ActionCommand::Base
- AppCommand::GitBranch
- Defined in:
- lib/routes/git_branch.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#list_local_branches ⇒ Object
List local branches.
-
#list_remote_branches ⇒ Object
List remote branches.
- #opts_routing ⇒ Object
- #opts_validate ⇒ Object
Instance Method Details
#execute ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/routes/git_branch.rb', line 5 def execute @opts = @sort = App::Git::SORT_REFNAME @git = App::Git.new opts_validate opts_routing end |
#list_local_branches ⇒ Object
List local branches.
43 44 45 |
# File 'lib/routes/git_branch.rb', line 43 def list_local_branches @git.show_branches(@sort, App::Git::LOCAL) end |
#list_remote_branches ⇒ Object
List remote branches.
49 50 51 |
# File 'lib/routes/git_branch.rb', line 49 def list_remote_branches @git.show_branches(@sort, App::Git::REMOTE) end |
#opts_routing ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/routes/git_branch.rb', line 25 def opts_routing if @opts[:local] list_local_branches elsif @opts[:remote] list_remote_branches else if @opts[:sortDate] system('bp g b -ld') else system('bp g b -l') end end end |
#opts_validate ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/routes/git_branch.rb', line 15 def opts_validate if @opts[:remote] && @opts[:local] # @todo Change to new style error messages. abort('Cannot list both local & remote branches simultaneously. Please choose one option only.') end @sort = App::Git::SORT_DATE if @opts[:sortDate] end |