Sha256: d0a817638e2d5e1b97e959b84bb7970c0ad0195c3f3ab0b8a5d2595611a652c9

Contents?: true

Size: 795 Bytes

Versions: 3

Compression:

Stored size: 795 Bytes

Contents

# By default, command runs only when story is finished
class FinishedCommand < Command

  def run!
    check_finishes unless run?
    system cmd
  end

  private

    # Checks to see if the most recent commit finishes the story
    # We look for 'Finishes' or 'Delivers' and issue a warning if neither is
    # in the most recent commit. (Also supports 'Finished' and 'Delivered'.)
    def check_finishes
      unless `git log -1` =~ /Finishe(s|d)|Deliver(s|ed)|Fixe(s|d)/i
        warning =  "Warning: Unfinished story\n"
        warning += "Run `git commit --amend` to add 'Finishes' or 'Delivers' "
        warning += "to the commit message\n"
        warning += "Use --run to override"
        $stderr.puts warning
        exit 1
      end
    end

    def run?
      options.run
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pivotal-github-0.6.8 lib/pivotal-github/finished_command.rb
pivotal-github-0.6.7 lib/pivotal-github/finished_command.rb
pivotal-github-0.6.6 lib/pivotal-github/finished_command.rb