story_branch 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/README.md +27 -18
- data/lib/story_branch.rb +34 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b39c0c3a0dd6a9a5c86cea6e4a7af3602e4ff658
|
4
|
+
data.tar.gz: 79bea18cad0aa1d7b80ccf65d73d71e7f60eef31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade432f66510986d1b7cf5d45c0ae848ff9297385cb304b928b8d79136e45a67e5c154f750dfc88bfba83ef0d87552887b6795427470ce5be117f6f5d69df32a
|
7
|
+
data.tar.gz: 590913610f285588b78d17bb16d9e0220e78971fa3e3172feb5f5eeb196e018401bd6060042d3e86eb9604051b6c49f0e5a70b2e2c487baea1d52f0671fd6a94
|
data/README.md
CHANGED
@@ -2,27 +2,27 @@
|
|
2
2
|
|
3
3
|
# Story Branch
|
4
4
|
|
5
|
-
## Description
|
6
|
-
|
7
5
|
A small collection of tools for working with git branches for
|
8
|
-
Pivotal Tracker stories. Story branch,
|
6
|
+
Pivotal Tracker stories. Story branch, start, finish
|
9
7
|
|
10
8
|
### Commentary
|
11
9
|
|
12
|
-
|
13
|
-
Pivotal Tracker Story
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
be
|
10
|
+
`git story`: Create a git branch with automatic reference to a
|
11
|
+
Pivotal Tracker Story. It will get started stories from your active
|
12
|
+
project. You can enter text and press TAB to search for a story
|
13
|
+
name, or TAB to show the full list. It will then suggest an editable
|
14
|
+
branch name. When the branch is created the `story_id` will
|
15
|
+
be appended to it.
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
`git start`: Start a story in Pivotal Tracker from the terminal.
|
18
|
+
It'll get all unstarted stories in your current project. You can
|
19
|
+
enter text and press TAB to search for a story name, or TAB to show
|
20
|
+
the full list.
|
22
21
|
|
23
|
-
|
22
|
+
`git finish`: Create commit/message for the staged changes, e.g:
|
24
23
|
"[Finishes #1234567] My Story Title" - optionally Finishes the story
|
25
|
-
via pivotal tracker's api.
|
24
|
+
via pivotal tracker's api. You must stage all changes (or stash
|
25
|
+
them) first.
|
26
26
|
|
27
27
|
### Installing
|
28
28
|
|
@@ -30,16 +30,25 @@ Install the gem:
|
|
30
30
|
|
31
31
|
gem install story_branch
|
32
32
|
|
33
|
-
You must have a `PIVOTAL_API_KEY` environment variable set
|
34
|
-
Pivotal api key, plus either a `.story_branch` file or
|
33
|
+
**Settings:** You must have a `PIVOTAL_API_KEY` environment variable set
|
34
|
+
to your Pivotal api key, plus either a `.story_branch` file or
|
35
35
|
`PIVOTAL_PROJECT_ID` environment variable set. Note, values in
|
36
36
|
`.story_branch` will override environment variable settings.
|
37
37
|
|
38
|
+
**.story_branch file**
|
39
|
+
|
40
|
+
A YAML file with either/both of:
|
41
|
+
|
42
|
+
api: YOUR.PIVOTAL.API.KEY.STRING
|
43
|
+
project: YOUR.PROJECT.ID.NUMBER
|
44
|
+
|
45
|
+
Can be saved to `~/` or `./`
|
46
|
+
|
38
47
|
### Usage
|
39
48
|
|
40
|
-
|
49
|
+
You run story_branch from the git/project root folder.
|
41
50
|
|
42
|
-
`start`, `
|
51
|
+
`start`, `branch`, are run interactively and will display a
|
43
52
|
list of stories to work with.
|
44
53
|
|
45
54
|
`finish` will scan the current branch name for a story id (as its
|
data/lib/story_branch.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Dominic Wong <dominic.wong.617@gmail.com>
|
6
6
|
# Gabe Hollombe <gabe@neo.com>
|
7
7
|
#
|
8
|
-
# Version: 0.2.
|
8
|
+
# Version: 0.2.2
|
9
9
|
#
|
10
10
|
# ## Description
|
11
11
|
#
|
@@ -14,20 +14,22 @@
|
|
14
14
|
#
|
15
15
|
# ### Commentary
|
16
16
|
#
|
17
|
-
#
|
18
|
-
# Pivotal Tracker Story
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# be
|
17
|
+
# `git story`: Create a git branch with automatic reference to a
|
18
|
+
# Pivotal Tracker Story. It will get started stories from your active
|
19
|
+
# project. You can enter text and press TAB to search for a story
|
20
|
+
# name, or TAB to show the full list. It will then suggest an editable
|
21
|
+
# branch name. When the branch is created the `story_id` will
|
22
|
+
# be appended to it.
|
23
23
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
24
|
+
# `git start`: Start a story in Pivotal Tracker from the terminal.
|
25
|
+
# It'll get all unstarted stories in your current project. You can
|
26
|
+
# enter text and press TAB to search for a story name, or TAB to show
|
27
|
+
# the full list.
|
28
|
+
|
29
|
+
# `git finish`: Create commit/message for the staged changes, e.g:
|
29
30
|
# "[Finishes #1234567] My Story Title" - optionally Finishes the story
|
30
|
-
# via pivotal tracker's api.
|
31
|
+
# via pivotal tracker's api. You must stage all changes (or stash
|
32
|
+
# them) first.
|
31
33
|
#
|
32
34
|
# ### Installing
|
33
35
|
#
|
@@ -35,14 +37,23 @@
|
|
35
37
|
#
|
36
38
|
# gem install story_branch
|
37
39
|
#
|
38
|
-
# You must have a `PIVOTAL_API_KEY` environment variable set
|
39
|
-
# Pivotal api key, plus either a `.story_branch` file or
|
40
|
+
# **Settings:** You must have a `PIVOTAL_API_KEY` environment variable set
|
41
|
+
# to your Pivotal api key, plus either a `.story_branch` file or
|
40
42
|
# `PIVOTAL_PROJECT_ID` environment variable set. Note, values in
|
41
43
|
# `.story_branch` will override environment variable settings.
|
42
44
|
#
|
45
|
+
# **.story_branch file**
|
46
|
+
#
|
47
|
+
# A YAML file with either/both of:
|
48
|
+
#
|
49
|
+
# api: YOUR.PIVOTAL.API.KEY.STRING
|
50
|
+
# project: YOUR.PROJECT.ID.NUMBER
|
51
|
+
#
|
52
|
+
# Can be saved to `~/` or `./`
|
53
|
+
#
|
43
54
|
# ### Usage
|
44
55
|
#
|
45
|
-
#
|
56
|
+
# You run story_branch from the git/project root folder.
|
46
57
|
#
|
47
58
|
# `start`, `branch`, are run interactively and will display a
|
48
59
|
# list of stories to work with.
|
@@ -72,6 +83,7 @@
|
|
72
83
|
|
73
84
|
require 'yaml'
|
74
85
|
require 'pivotal-tracker'
|
86
|
+
require 'rb-readline'
|
75
87
|
require 'readline'
|
76
88
|
require 'git'
|
77
89
|
require 'active_support/core_ext/string/inflections'
|
@@ -117,7 +129,7 @@ module StoryBranch
|
|
117
129
|
@p.create_feature_branch story
|
118
130
|
end
|
119
131
|
rescue RestClient::Unauthorized
|
120
|
-
puts "Pivotal API key or Project ID invalid"
|
132
|
+
$stderr.puts "Pivotal API key or Project ID invalid"
|
121
133
|
return nil
|
122
134
|
end
|
123
135
|
end
|
@@ -138,7 +150,7 @@ module StoryBranch
|
|
138
150
|
puts "#{story.id} #{msg}"
|
139
151
|
end
|
140
152
|
rescue RestClient::Unauthorized
|
141
|
-
puts "Pivotal API key or Project ID invalid"
|
153
|
+
$stderr.puts "Pivotal API key or Project ID invalid"
|
142
154
|
return nil
|
143
155
|
end
|
144
156
|
end
|
@@ -187,7 +199,7 @@ module StoryBranch
|
|
187
199
|
puts "Aborted"
|
188
200
|
end
|
189
201
|
rescue RestClient::Unauthorized
|
190
|
-
puts "Pivotal API key or Project ID invalid"
|
202
|
+
$stderr.puts "Pivotal API key or Project ID invalid"
|
191
203
|
return nil
|
192
204
|
end
|
193
205
|
end
|
@@ -204,7 +216,7 @@ module StoryBranch
|
|
204
216
|
|
205
217
|
def env_required var_name
|
206
218
|
if ENV[var_name].nil?
|
207
|
-
puts "$#{var_name} must be set or in .story_branch file"
|
219
|
+
$stderr.puts "$#{var_name} must be set or in .story_branch file"
|
208
220
|
return nil
|
209
221
|
end
|
210
222
|
ENV[var_name]
|
@@ -333,7 +345,6 @@ module StoryBranch
|
|
333
345
|
# TODO: Add some other predicates as we need them...
|
334
346
|
# Filtering on where a story lives (Backlog, IceBox)
|
335
347
|
# Filtering on tags/labels
|
336
|
-
# Filtering on estimation (estimated?, 0 point, 1 point etc.)
|
337
348
|
|
338
349
|
def filtered_stories_list state, estimated
|
339
350
|
project = get_project
|
@@ -420,10 +431,10 @@ module StoryBranch
|
|
420
431
|
|
421
432
|
def readline prompt, completions=[]
|
422
433
|
# Store the state of the terminal
|
423
|
-
|
434
|
+
RbReadline.clear_history
|
424
435
|
if completions.length > 0
|
425
436
|
completions.each {|i| Readline::HISTORY.push i}
|
426
|
-
|
437
|
+
RbReadline.rl_completer_word_break_characters = ""
|
427
438
|
Readline.completion_proc = proc {|s| completions.grep(/#{Regexp.escape(s)}/) }
|
428
439
|
Readline.completion_append_character = ""
|
429
440
|
end
|