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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -18
  3. data/lib/story_branch.rb +34 -23
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9cc200c930d34b90699a03c634f1de29e2c599b
4
- data.tar.gz: 7abb7d7e9c1001d9e4d1c2236925995de29ff39b
3
+ metadata.gz: b39c0c3a0dd6a9a5c86cea6e4a7af3602e4ff658
4
+ data.tar.gz: 79bea18cad0aa1d7b80ccf65d73d71e7f60eef31
5
5
  SHA512:
6
- metadata.gz: dd86ebf0d42dcbc66a70ab1e4e2d9403996ddce94a422b8ae2ccd46921cd5ddb1eec096f127678f7f506604f219083be4717c2760e21b2f9390b8363c637236b
7
- data.tar.gz: 4e7e215be23201bd48cc94fec811f76dcb87eaae3bd3214994bae5c1e3b4d25761b4638d7c36b899dd1e3bad64f378dc35e43f59adc53fdadf6da2b7ed9d850e
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, story start, story finish
6
+ Pivotal Tracker stories. Story branch, start, finish
9
7
 
10
8
  ### Commentary
11
9
 
12
- **git story**: Create a git branch with automatic reference to a
13
- Pivotal Tracker Story, it will present a list of started stories
14
- from your active project. Select a story, and it will suggest a
15
- feature branch name for that story, which you can edit or
16
- accept. The branch will be created (the story_id will automatically
17
- be used as a suffix in the branch name)
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
- **git start**: Start a story in Pivotal Tracker from the terminal.
20
- Lists all unstarted stories in your current project. Select a story
21
- from the displayed list, and it will tell Pivotal Tracker to start it.
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
- **git finish**: Create a finishing commit + message, for example:
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 to your
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
- Note: Run story_branch from the project root folder.
49
+ You run story_branch from the git/project root folder.
41
50
 
42
- `start`, `story`, are run interactively and will display a
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.1
8
+ # Version: 0.2.2
9
9
  #
10
10
  # ## Description
11
11
  #
@@ -14,20 +14,22 @@
14
14
  #
15
15
  # ### Commentary
16
16
  #
17
- # **branch**: Create a git branch with automatic reference to a
18
- # Pivotal Tracker Story, it will present a list of started stories
19
- # from your active project. Select a story, and it will suggest a
20
- # feature branch name for that story, which you can edit or
21
- # accept. The branch will be created (the story_id will automatically
22
- # be used as a suffix in the branch name)
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
- # **start**: Start a story in Pivotal Tracker from the terminal.
25
- # List all unstarted stories in your current project. Entering a
26
- # partial string will fuzzy match against the list.
27
- #
28
- # **finish**: Create a finishing commit + message, for example:
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 to your
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
- # Note: Run story_branch from the project root folder.
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
- Readline::HISTORY.clear
434
+ RbReadline.clear_history
424
435
  if completions.length > 0
425
436
  completions.each {|i| Readline::HISTORY.push i}
426
- Readline.special_prefixes = " .{}()[]!?\"'_-#@$%^&*"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: story_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Milkins