Sha256: d85975380c024f79af79de25e920c3bb6f3d98f8e38ace554d1867ff0c6a3be8

Contents?: true

Size: 871 Bytes

Versions: 21

Compression:

Stored size: 871 Bytes

Contents

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

  def run!
    check_finishes unless override?
    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 finished?
        warning =  "Warning: Unfinished story\n"
        warning += "Run `git commit --amend` to add 'Finishes' or 'Delivers' "
        warning += "to the commit message\n"
        warning += "Use --override to override"
        $stderr.puts warning
        exit 1
      end
    end

    def finished?
      !!(`git log -1`.match(/Finishe(s|d)|Deliver(s|ed)|Fixe(s|d) #\d+/i))
    end

    def override?
      options.override
    end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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