Class: Cherrybase::Executor
- Inherits:
-
Object
- Object
- Cherrybase::Executor
- Defined in:
- lib/executor.rb
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize(baser = Cherrybase::Baser.new) ⇒ Executor
constructor
A new instance of Executor.
- #showHelp ⇒ Object
- #showUsage ⇒ Object
Constructor Details
#initialize(baser = Cherrybase::Baser.new) ⇒ Executor
Returns a new instance of Executor.
6 7 8 |
# File 'lib/executor.rb', line 6 def initialize(baser = Cherrybase::Baser.new) @baser = baser end |
Instance Method Details
#execute(args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/executor.rb', line 10 def execute(args) begin input = Cherrybase::Args.new().parse(args) if (input['continue']) @baser.continue(true) else if (input['abort']) @baser.abort else if input['help'] showHelp() else @baser.init(input['branch'], input['starting-commit'], input['ending-commit']) @baser.continue end end end rescue RuntimeError => err puts "\n#{err}\n\n" showUsage() end end |
#showHelp ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/executor.rb', line 37 def showHelp() puts "NAME" puts "\tcherrybase - cherry-pick a range of commits from one branch to the current branch" puts "SYNOPSIS" puts "\tcherrybase [<branch> [<commit> | <commit>..<commit>]] | --continue | --abort" puts "DESCRIPTION" puts "\tThe idea is to cherry-pick across multiple commits and have similar functionality as the rebase command." end |
#showUsage ⇒ Object
33 34 35 |
# File 'lib/executor.rb', line 33 def showUsage() puts "Usage: cherrybase [<branch> [<commit> | <commit>..<commit>]] | --continue | --abort" end |