Class: StoryPull
Instance Attribute Summary
Attributes inherited from Command
#args, #known_options, #options, #unknown_options
Instance Method Summary collapse
-
#cmd ⇒ Object
Returns a command appropriate for executing at the command line For example: git checkout master git pull git checkout <story branch>.
- #parser ⇒ Object
- #run! ⇒ Object
Methods inherited from Command
#initialize, #parse, run!, #story_branch, #story_id, #story_ids
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#cmd ⇒ Object
Returns a command appropriate for executing at the command line For example:
git checkout master
git pull
git checkout <story branch>
23 24 25 26 27 28 29 30 |
# File 'lib/pivotal-github/story_pull.rb', line 23 def cmd lines = ["git checkout #{development_branch}"] c = ['git pull'] c << argument_string() unless .empty? lines << c.join(' ') lines << ["git checkout #{story_branch}"] lines.join("\n") end |
#parser ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pivotal-github/story_pull.rb', line 5 def parser OptionParser.new do |opts| opts. = "Usage: git story-pull [options]" opts.on("-d", "--development BRANCH", "development branch (defaults to master)") do |opt| self..development = opt end opts.on_tail("-h", "--help", "this usage guide") do puts opts.to_s; exit 0 end end end |
#run! ⇒ Object
32 33 34 |
# File 'lib/pivotal-github/story_pull.rb', line 32 def run! system cmd end |