pivotal-github 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,19 @@ require 'pivotal-github/command'
2
2
 
3
3
  class StoryPullRequest < Command
4
4
 
5
+ def parser
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: git story-pull-request [options]"
8
+ opts.on("-f", "--force",
9
+ "run without marking story finished") do |f|
10
+ self.options.force = f
11
+ end
12
+ opts.on_tail("-h", "--help", "this usage guide") do
13
+ puts opts.to_s; exit 0
14
+ end
15
+ end
16
+ end
17
+
5
18
  # Returns a command appropriate for executing at the command line
6
19
  # I.e., 'open https://www.pivotaltracker.com/story/show/6283185'
7
20
  def cmd
@@ -13,6 +26,7 @@ class StoryPullRequest < Command
13
26
  end
14
27
 
15
28
  def run!
29
+ check_finishes unless force?
16
30
  system cmd
17
31
  end
18
32
 
@@ -22,5 +36,23 @@ class StoryPullRequest < Command
22
36
  # E.g., https://github.com/mhartl/pivotal-github
23
37
  def origin_uri
24
38
  `git config --get remote.origin.url`.strip.chomp('.git')
25
- end
39
+ end
40
+
41
+ # Checks to see if the most recent commit finishes the story
42
+ # We look for 'Finishes' or 'Delivers' and issue a warning if neither is
43
+ # in the most recent commit. (Also supports 'Finished' and 'Delivered'.)
44
+ def check_finishes
45
+ unless `git log -1` =~ /Finishe(s|d)|Deliver(s|ed)/
46
+ warning = "Warning: Unfinished story\n"
47
+ warning += "Run `git commit --amend` to add 'Finishes' or 'Delivers' "
48
+ warning += "to the commit message\n"
49
+ warning += "Use --force to override"
50
+ $stderr.puts warning
51
+ exit 1
52
+ end
53
+ end
54
+
55
+ def force?
56
+ options.force
57
+ end
26
58
  end
@@ -1,5 +1,5 @@
1
1
  module Pivotal
2
2
  module Github
3
- VERSION = "0.6.2"
3
+ VERSION = "0.6.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-14 00:00:00.000000000 Z
12
+ date: 2013-02-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Add commands for Pivotal Tracker–GitHub integration
15
15
  email: