git-storyid 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/git-storyid.gemspec +4 -4
- data/lib/git_storyid.rb +21 -4
- data/spec/git_storyid_spec.rb +17 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 757a81b3f19ee8d91bc9db03cf31703b37497aed
|
4
|
+
data.tar.gz: 8d066a7703fc70bd9bc87870aac767e3f013f7b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bf8479a6b9f94c9e8e92639511268525e56d7fd4b0b6ee8bb2c617a5176276d734d8167fb5bc6e6e85f1ff251e2c5d655ced3ae2d232b7cfe4552be962116fb
|
7
|
+
data.tar.gz: c83427661cfe8e12cec738c976d4083b791be0c24f1d349f6440a56a81f8fe2c808b9a635c5a6af3af0e647595a53dfd233764a26a0224d9a50f2bb7a1484fc2
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/git-storyid.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: git-storyid 0.3.
|
5
|
+
# stub: git-storyid 0.3.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "git-storyid"
|
9
|
-
s.version = "0.3.
|
9
|
+
s.version = "0.3.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Bogdan Gusiev"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2015-02-06"
|
15
15
|
s.description = "Helps include pivotal story id and description in commit"
|
16
16
|
s.email = "agresso@gmail.com"
|
17
17
|
s.executables = ["git-storyid"]
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
]
|
38
38
|
s.homepage = "http://github.com/bogdan/git-storyid"
|
39
39
|
s.licenses = ["MIT"]
|
40
|
-
s.rubygems_version = "2.
|
40
|
+
s.rubygems_version = "2.4.5"
|
41
41
|
s.summary = "Attach commits to pivotal stories"
|
42
42
|
|
43
43
|
if s.respond_to? :specification_version then
|
data/lib/git_storyid.rb
CHANGED
@@ -17,6 +17,9 @@ class GitStoryid
|
|
17
17
|
opts.on("-m", "--message [MESSAGE]", "Add addional MESSAGE to comit") do |custom_message|
|
18
18
|
@custom_message = custom_message
|
19
19
|
end
|
20
|
+
opts.on("-f", "--finish", "Specify that this commit finishes a story or fixes a bug") do
|
21
|
+
@finish_stories = true
|
22
|
+
end
|
20
23
|
end
|
21
24
|
parser.parse!(arguments)
|
22
25
|
|
@@ -40,7 +43,12 @@ class GitStoryid
|
|
40
43
|
quit_if_no_stories
|
41
44
|
output stories_menu
|
42
45
|
@stories = readline_story_ids.map do |index|
|
43
|
-
|
46
|
+
if index > 1_000_000
|
47
|
+
# Consider it a direct story id
|
48
|
+
Configuration.project.stories.find(index)
|
49
|
+
else
|
50
|
+
all_stories[index - 1] || (quit("Story index #{index} not found."))
|
51
|
+
end
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
@@ -92,15 +100,24 @@ class GitStoryid
|
|
92
100
|
end
|
93
101
|
|
94
102
|
def build_commit_message
|
95
|
-
message =
|
96
|
-
|
103
|
+
message = @stories.map do |story|
|
104
|
+
"#{finish_story_prefix(story)}##{story.id}"
|
105
|
+
end.join(", ")
|
106
|
+
message = "[#{message}] "
|
97
107
|
if @custom_message && !@custom_message.empty?
|
98
108
|
message += @custom_message.to_s + "\n\n"
|
99
109
|
end
|
100
|
-
message += @stories.map
|
110
|
+
message += @stories.map do |story|
|
111
|
+
"#{story.story_type.capitalize}: " + story.name.strip
|
112
|
+
end.join("\n\n")
|
101
113
|
message
|
102
114
|
end
|
103
115
|
|
116
|
+
def finish_story_prefix(story)
|
117
|
+
return "" unless @finish_stories
|
118
|
+
story.story_type == "bug" ? "Fixes " : "Finishes "
|
119
|
+
end
|
120
|
+
|
104
121
|
def execute(*args)
|
105
122
|
Open3.popen3(*args) {|i, o| return o.read }
|
106
123
|
end
|
data/spec/git_storyid_spec.rb
CHANGED
@@ -102,15 +102,11 @@ describe GitStoryid do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
context "when stories exists" do
|
105
|
-
|
106
|
-
before(:each) do
|
107
|
-
|
108
|
-
GitStoryid.any_instance.stubs(:readline).returns('1')
|
109
|
-
end
|
110
105
|
|
111
106
|
it "should commit changes" do
|
107
|
+
GitStoryid.any_instance.stubs(:readline).returns('1')
|
112
108
|
run("-m", 'Hello world')
|
113
|
-
commands.should include(["git", "commit", "-m", "
|
109
|
+
commands.should include(["git", "commit", "-m", "[#44647731] Hello world\n\nFeature: Strip Default paypal credentials"])
|
114
110
|
end
|
115
111
|
|
116
112
|
it "should render stories menu correctly" do
|
@@ -120,6 +116,21 @@ describe GitStoryid do
|
|
120
116
|
|
121
117
|
EOI
|
122
118
|
end
|
119
|
+
|
120
|
+
it "should commit to multiple stories" do
|
121
|
+
GitStoryid.any_instance.stubs(:readline).returns('1,2')
|
122
|
+
run("-m", 'Hello world')
|
123
|
+
commands.should include(
|
124
|
+
["git", "commit", "-m",
|
125
|
+
"[#44647731, #44647732] Hello world\n\nFeature: Strip Default paypal credentials\n\nFeature: Require pro paypal account for mass payments"]
|
126
|
+
)
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should support finishing" do
|
130
|
+
GitStoryid.any_instance.stubs(:readline).returns('1')
|
131
|
+
run('-f')
|
132
|
+
commands.should include(["git", "commit", "-m", "[Finishes #44647731] Feature: Strip Default paypal credentials"])
|
133
|
+
end
|
123
134
|
end
|
124
135
|
|
125
136
|
it "should quit if no stories specified" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-storyid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Gusiev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pivotal-tracker
|
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
154
|
+
rubygems_version: 2.4.5
|
155
155
|
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Attach commits to pivotal stories
|