class StoryCommit

Public Instance Methods

cmd() click to toggle source

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.

# File lib/pivotal-github/story_commit.rb, line 30
def cmd
  c = ['git commit']
  c << '-a' if all?
  c << %(-m "#{options.message}") if message?
  c << %(-m "#{message}") unless story_ids.empty?
  c << argument_string(unknown_options) unless unknown_options.empty?
  c.join(' ')
end
parser() click to toggle source
# File lib/pivotal-github/story_commit.rb, line 5
def parser
  OptionParser.new do |opts|
    opts.banner = "Usage: git story-commit [options]"
    opts.on("-m", "--message MESSAGE",
            "add a commit message (including story #)") do |opt|
      self.options.message = opt
    end
    opts.on("-f", "--finish", "mark story as finished") do |opt|
      self.options.finish = opt
    end
    opts.on("-d", "--deliver", "mark story as delivered") do |opt|
      self.options.deliver = opt
    end
    opts.on("-a", "--all", "commit all changed files") do |opt|
      self.options.all = opt
    end
    opts.on_tail("-h", "--help", "this usage guide") do
      puts opts.to_s; exit 0
    end
  end
end
run!() click to toggle source
# File lib/pivotal-github/story_commit.rb, line 39
def run!
  system cmd
end

Private Instance Methods

all?() click to toggle source
# File lib/pivotal-github/story_commit.rb, line 49
def all?
  options.all
end
message?() click to toggle source
# File lib/pivotal-github/story_commit.rb, line 45
def message?
  !options.message.nil?
end