Sha256: 9317a4695d7353edcf3a75d6d99842eba9cbe4e0cd5941caa999e95b002c6eb8

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 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 --force to override"
        $stderr.puts warning
        exit 1
      end
    end

    def run?
      options.run
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pivotal-github-0.6.9 lib/pivotal-github/finished_command.rb