Class: StoryCommit
- Defined in:
- lib/pivotal-github/story_commit.rb
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.
- #parser ⇒ Object
- #run! ⇒ Object
Methods inherited from Command
#initialize, #message, #message_ids, #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. We take care to insert the story number and, if necessary, an indication that the commit finishes the story.
30 31 32 33 34 35 36 37 |
# File 'lib/pivotal-github/story_commit.rb', line 30 def cmd c = ['git commit'] c << '-a' if all? c << %(-m "#{.}") if c << %(-m "#{}") unless story_ids.empty? c << argument_string() unless .empty? c.join(' ') end |
#parser ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pivotal-github/story_commit.rb', line 5 def parser OptionParser.new do |opts| opts. = "Usage: git story-commit [options]" opts.on("-m", "--message MESSAGE", "add a commit message (including story #)") do |opt| self.. = opt end opts.on("-f", "--finish", "mark story as finished") do |opt| self..finish = opt end opts.on("-d", "--deliver", "mark story as delivered") do |opt| self..deliver = opt end opts.on("-a", "--all", "commit all changed files") do |opt| self..all = opt end opts.on_tail("-h", "--help", "this usage guide") do puts opts.to_s; exit 0 end end end |
#run! ⇒ Object
39 40 41 |
# File 'lib/pivotal-github/story_commit.rb', line 39 def run! system cmd end |