Sha256: b27bb1fd0e7124ae12242820ab2758d199b55d1aab99ac2bbbcebde3dad8c1f6

Contents?: true

Size: 1.31 KB

Versions: 25

Compression:

Stored size: 1.31 KB

Contents

require 'pivotal-github/command'

class StoryCommit < Command

  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

  # 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.
  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

  def run!
    system cmd
  end

  private

    def message?
      !options.message.nil?
    end

    def all?
      options.all
    end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
pivotal-github-1.2.2 lib/pivotal-github/story_commit.rb
pivotal-github-1.2.0 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.7 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.6 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.5 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.4 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.3 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.2 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.1 lib/pivotal-github/story_commit.rb
pivotal-github-1.1.0 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.12 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.11 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.10 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.9 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.8 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.7 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.6 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.5 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.4 lib/pivotal-github/story_commit.rb
pivotal-github-1.0.3 lib/pivotal-github/story_commit.rb