story_branch 0.7.0 → 0.7.1
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/.circleci/config.yml +24 -7
- data/.gitignore +1 -0
- data/Gemfile.lock +84 -9
- data/lib/story_branch/cli.rb +12 -0
- data/lib/story_branch/commands/open_issue.rb +21 -0
- data/lib/story_branch/git_utils.rb +2 -19
- data/lib/story_branch/git_wrapper.rb +1 -1
- data/lib/story_branch/github/issue.rb +5 -4
- data/lib/story_branch/github/tracker.rb +2 -1
- data/lib/story_branch/jira/issue.rb +8 -1
- data/lib/story_branch/jira/project.rb +1 -1
- data/lib/story_branch/jira/tracker.rb +4 -1
- data/lib/story_branch/main.rb +12 -15
- data/lib/story_branch/pivotal/tracker.rb +2 -1
- data/lib/story_branch/templates/open_issue/.gitkeep +1 -0
- data/lib/story_branch/tracker_base.rb +19 -2
- data/lib/story_branch/url_opener.rb +17 -0
- data/lib/story_branch/version.rb +1 -1
- data/story_branch.gemspec +6 -4
- metadata +45 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2084cb533a3635cde91837c75309fa1033fe80398aa7f730a90ad5e1a46d1272
|
|
4
|
+
data.tar.gz: 13bf5a6cb246301153206b9e9cae7133ee71cf147465cc1ceb84bfb964953beb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8fb92e096420e47938befb9a684657c3ec14525a01a5172a89691ab2fe6fba41e5aabe3ff00ff2ac592a5b25e6143f0ad013bfe95c01e65ee976e0addfecb4bc
|
|
7
|
+
data.tar.gz: 58db1c589e85b911f2a9cd5268247f2a629e1b276c8ff72173b136662be286faeb7335368f410ed967a293d64d0554d63746a2edc5efb488d919d0e324d79738
|
data/.circleci/config.yml
CHANGED
|
@@ -27,13 +27,21 @@ workflows:
|
|
|
27
27
|
jobs:
|
|
28
28
|
test:
|
|
29
29
|
<<: *defaults
|
|
30
|
+
|
|
30
31
|
steps:
|
|
31
32
|
- checkout
|
|
32
33
|
|
|
34
|
+
- run:
|
|
35
|
+
name: Install Code Climate Test Reporter
|
|
36
|
+
command: |
|
|
37
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
|
38
|
+
chmod +x ./cc-test-reporter
|
|
39
|
+
- run: ./cc-test-reporter before-build
|
|
40
|
+
|
|
33
41
|
- restore_cache:
|
|
34
42
|
keys:
|
|
35
|
-
-
|
|
36
|
-
-
|
|
43
|
+
- v2-dependencies-{{ checksum "Gemfile.lock" }}
|
|
44
|
+
- v2-dependencies-
|
|
37
45
|
|
|
38
46
|
- run:
|
|
39
47
|
name: install dependencies
|
|
@@ -44,7 +52,7 @@ jobs:
|
|
|
44
52
|
- save_cache:
|
|
45
53
|
paths:
|
|
46
54
|
- ./vendor/bundle
|
|
47
|
-
key:
|
|
55
|
+
key: v2-dependencies-{{ checksum "Gemfile.lock" }}
|
|
48
56
|
|
|
49
57
|
- run:
|
|
50
58
|
name: run tests
|
|
@@ -61,7 +69,16 @@ jobs:
|
|
|
61
69
|
path: /tmp/test-results
|
|
62
70
|
- store_artifacts:
|
|
63
71
|
path: /tmp/test-results
|
|
64
|
-
|
|
72
|
+
|
|
73
|
+
- run:
|
|
74
|
+
name: Code Climate Test Coverage convert to json
|
|
75
|
+
command: |
|
|
76
|
+
./cc-test-reporter format-coverage -t simplecov
|
|
77
|
+
|
|
78
|
+
- run:
|
|
79
|
+
name: Code Climate Test Coverage upload results
|
|
80
|
+
command: |
|
|
81
|
+
./cc-test-reporter after-build -t simplecov --exit-code $?
|
|
65
82
|
|
|
66
83
|
publish:
|
|
67
84
|
<<: *defaults
|
|
@@ -70,8 +87,8 @@ jobs:
|
|
|
70
87
|
|
|
71
88
|
- restore_cache:
|
|
72
89
|
keys:
|
|
73
|
-
-
|
|
74
|
-
-
|
|
90
|
+
- v2-dependencies-{{ checksum "Gemfile.lock" }}
|
|
91
|
+
- v2-dependencies-
|
|
75
92
|
|
|
76
93
|
- run:
|
|
77
94
|
name: install dependencies
|
|
@@ -82,7 +99,7 @@ jobs:
|
|
|
82
99
|
- save_cache:
|
|
83
100
|
paths:
|
|
84
101
|
- ./vendor/bundle
|
|
85
|
-
key:
|
|
102
|
+
key: v2-dependencies-{{ checksum "Gemfile.lock" }}
|
|
86
103
|
|
|
87
104
|
- run:
|
|
88
105
|
name: Setup Rubygems
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
story_branch (0.7.
|
|
4
|
+
story_branch (0.7.1)
|
|
5
5
|
blanket_wrapper (~> 3.0)
|
|
6
6
|
damerau-levenshtein (~> 1.3)
|
|
7
7
|
jira-ruby (~> 1.7)
|
|
8
|
-
thor (~> 0.20
|
|
9
|
-
tty-command (~> 0.8
|
|
10
|
-
tty-config (~> 0.2
|
|
8
|
+
thor (~> 0.20)
|
|
9
|
+
tty-command (~> 0.8)
|
|
10
|
+
tty-config (~> 0.2)
|
|
11
11
|
tty-pager (~> 0.12)
|
|
12
12
|
tty-prompt (~> 0.18)
|
|
13
13
|
xdg (~> 3.0)
|
|
@@ -30,6 +30,7 @@ GEM
|
|
|
30
30
|
concurrent-ruby (1.1.5)
|
|
31
31
|
damerau-levenshtein (1.3.2)
|
|
32
32
|
diff-lcs (1.3)
|
|
33
|
+
docile (1.3.1)
|
|
33
34
|
equatable (0.6.1)
|
|
34
35
|
fakefs (0.20.1)
|
|
35
36
|
git (1.5.0)
|
|
@@ -43,7 +44,9 @@ GEM
|
|
|
43
44
|
atlassian-jwt
|
|
44
45
|
multipart-post
|
|
45
46
|
oauth (~> 0.5, >= 0.5.0)
|
|
47
|
+
json (2.1.0)
|
|
46
48
|
jwt (2.1.0)
|
|
49
|
+
kramdown (1.16.2)
|
|
47
50
|
method_source (0.9.2)
|
|
48
51
|
mime-types (3.3.1)
|
|
49
52
|
mime-types-data (~> 3.2015)
|
|
@@ -62,6 +65,7 @@ GEM
|
|
|
62
65
|
method_source (~> 0.9.0)
|
|
63
66
|
rake (10.5.0)
|
|
64
67
|
recursive-open-struct (1.1.0)
|
|
68
|
+
rouge (3.15.0)
|
|
65
69
|
rspec (3.9.0)
|
|
66
70
|
rspec-core (~> 3.9.0)
|
|
67
71
|
rspec-expectations (~> 3.9.0)
|
|
@@ -77,22 +81,82 @@ GEM
|
|
|
77
81
|
rspec-support (3.9.2)
|
|
78
82
|
rspec_junit_formatter (0.4.1)
|
|
79
83
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
84
|
+
simplecov (0.16.1)
|
|
85
|
+
docile (~> 1.1)
|
|
86
|
+
json (>= 1.8, < 3)
|
|
87
|
+
simplecov-html (~> 0.10.0)
|
|
88
|
+
simplecov-html (0.10.2)
|
|
80
89
|
strings (0.1.8)
|
|
81
90
|
strings-ansi (~> 0.1)
|
|
82
91
|
unicode-display_width (~> 1.5)
|
|
83
92
|
unicode_utils (~> 1.4)
|
|
84
|
-
strings-ansi (0.
|
|
93
|
+
strings-ansi (0.1.0)
|
|
85
94
|
thor (0.20.3)
|
|
86
95
|
thread_safe (0.3.6)
|
|
96
|
+
tty (0.10.0)
|
|
97
|
+
bundler (~> 1.16, < 2.0)
|
|
98
|
+
equatable (~> 0.5)
|
|
99
|
+
pastel (~> 0.7.2)
|
|
100
|
+
thor (~> 0.20.0)
|
|
101
|
+
tty-box (~> 0.4.1)
|
|
102
|
+
tty-color (~> 0.5)
|
|
103
|
+
tty-command (~> 0.9.0)
|
|
104
|
+
tty-config (~> 0.3.2)
|
|
105
|
+
tty-cursor (~> 0.7)
|
|
106
|
+
tty-editor (~> 0.5)
|
|
107
|
+
tty-file (~> 0.8.0)
|
|
108
|
+
tty-font (~> 0.4.0)
|
|
109
|
+
tty-logger (~> 0.2.0)
|
|
110
|
+
tty-markdown (~> 0.6.0)
|
|
111
|
+
tty-pager (~> 0.12)
|
|
112
|
+
tty-pie (~> 0.3.0)
|
|
113
|
+
tty-platform (~> 0.2)
|
|
114
|
+
tty-progressbar (~> 0.17)
|
|
115
|
+
tty-prompt (~> 0.19)
|
|
116
|
+
tty-screen (~> 0.7)
|
|
117
|
+
tty-spinner (~> 0.9)
|
|
118
|
+
tty-table (~> 0.11.0)
|
|
119
|
+
tty-tree (~> 0.3)
|
|
120
|
+
tty-which (~> 0.4)
|
|
121
|
+
tty-box (0.4.1)
|
|
122
|
+
pastel (~> 0.7.2)
|
|
123
|
+
strings (~> 0.1.6)
|
|
124
|
+
tty-cursor (~> 0.7)
|
|
87
125
|
tty-color (0.5.1)
|
|
88
|
-
tty-command (0.
|
|
126
|
+
tty-command (0.9.0)
|
|
89
127
|
pastel (~> 0.7.0)
|
|
90
|
-
tty-config (0.2
|
|
128
|
+
tty-config (0.3.2)
|
|
91
129
|
tty-cursor (0.7.0)
|
|
130
|
+
tty-editor (0.5.1)
|
|
131
|
+
tty-prompt (~> 0.19)
|
|
132
|
+
tty-which (~> 0.4)
|
|
133
|
+
tty-file (0.8.0)
|
|
134
|
+
diff-lcs (~> 1.3)
|
|
135
|
+
pastel (~> 0.7.2)
|
|
136
|
+
tty-prompt (~> 0.18)
|
|
137
|
+
tty-font (0.4.0)
|
|
138
|
+
tty-logger (0.2.0)
|
|
139
|
+
pastel (~> 0.7.0)
|
|
140
|
+
tty-markdown (0.6.0)
|
|
141
|
+
kramdown (~> 1.16.2)
|
|
142
|
+
pastel (~> 0.7.2)
|
|
143
|
+
rouge (~> 3.3)
|
|
144
|
+
strings (~> 0.1.4)
|
|
145
|
+
tty-color (~> 0.4)
|
|
146
|
+
tty-screen (~> 0.6)
|
|
92
147
|
tty-pager (0.12.1)
|
|
93
148
|
strings (~> 0.1.4)
|
|
94
149
|
tty-screen (~> 0.6)
|
|
95
150
|
tty-which (~> 0.4)
|
|
151
|
+
tty-pie (0.3.0)
|
|
152
|
+
pastel (~> 0.7.3)
|
|
153
|
+
tty-cursor (~> 0.7)
|
|
154
|
+
tty-platform (0.3.0)
|
|
155
|
+
tty-progressbar (0.17.0)
|
|
156
|
+
strings-ansi (~> 0.1.0)
|
|
157
|
+
tty-cursor (~> 0.7)
|
|
158
|
+
tty-screen (~> 0.7)
|
|
159
|
+
unicode-display_width (~> 1.6)
|
|
96
160
|
tty-prompt (0.20.0)
|
|
97
161
|
necromancer (~> 0.5.0)
|
|
98
162
|
pastel (~> 0.7.0)
|
|
@@ -102,6 +166,15 @@ GEM
|
|
|
102
166
|
tty-screen (~> 0.7)
|
|
103
167
|
wisper (~> 2.0.0)
|
|
104
168
|
tty-screen (0.7.0)
|
|
169
|
+
tty-spinner (0.9.2)
|
|
170
|
+
tty-cursor (~> 0.7)
|
|
171
|
+
tty-table (0.11.0)
|
|
172
|
+
equatable (~> 0.6)
|
|
173
|
+
necromancer (~> 0.5)
|
|
174
|
+
pastel (~> 0.7.2)
|
|
175
|
+
strings (~> 0.1.5)
|
|
176
|
+
tty-screen (~> 0.7)
|
|
177
|
+
tty-tree (0.4.0)
|
|
105
178
|
tty-which (0.4.2)
|
|
106
179
|
tzinfo (1.2.6)
|
|
107
180
|
thread_safe (~> 0.1)
|
|
@@ -115,7 +188,7 @@ PLATFORMS
|
|
|
115
188
|
ruby
|
|
116
189
|
|
|
117
190
|
DEPENDENCIES
|
|
118
|
-
bundler (~> 2.0)
|
|
191
|
+
bundler (~> 1.17, < 2.0)
|
|
119
192
|
fakefs (~> 0.14)
|
|
120
193
|
git (~> 1.5)
|
|
121
194
|
ostruct (~> 0.1)
|
|
@@ -123,7 +196,9 @@ DEPENDENCIES
|
|
|
123
196
|
rake (~> 10.0)
|
|
124
197
|
rspec (~> 3)
|
|
125
198
|
rspec_junit_formatter (~> 0.4)
|
|
199
|
+
simplecov (~> 0.16)
|
|
126
200
|
story_branch!
|
|
201
|
+
tty (~> 0.10)
|
|
127
202
|
|
|
128
203
|
BUNDLED WITH
|
|
129
|
-
|
|
204
|
+
1.17.3
|
data/lib/story_branch/cli.rb
CHANGED
|
@@ -18,6 +18,18 @@ module StoryBranch
|
|
|
18
18
|
end
|
|
19
19
|
map %w[--version -v] => :version
|
|
20
20
|
|
|
21
|
+
desc 'open_issue', 'Command description...'
|
|
22
|
+
method_option :help, aliases: '-h', type: :boolean,
|
|
23
|
+
desc: 'Display usage information'
|
|
24
|
+
def open_issue(*)
|
|
25
|
+
if options[:help]
|
|
26
|
+
invoke :help, ['open_issue']
|
|
27
|
+
else
|
|
28
|
+
require_relative 'commands/open_issue'
|
|
29
|
+
StoryBranch::Commands::OpenIssue.new(options).execute
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
21
33
|
desc 'unstart', 'Mark a started story as un-started in Pivotal Tracker'
|
|
22
34
|
method_option :help, aliases: '-h', type: :boolean,
|
|
23
35
|
desc: 'Display usage information'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../command'
|
|
4
|
+
|
|
5
|
+
module StoryBranch
|
|
6
|
+
module Commands
|
|
7
|
+
# OpenIssue command is used to open the associated ticket in the browser
|
|
8
|
+
class OpenIssue < StoryBranch::Command
|
|
9
|
+
def initialize(options)
|
|
10
|
+
@options = options
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def execute(_input: $stdin, output: $stdout)
|
|
14
|
+
require_relative '../main'
|
|
15
|
+
sb = StoryBranch::Main.new
|
|
16
|
+
res = sb.open_current_url
|
|
17
|
+
output.write(res)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -20,25 +20,8 @@ module StoryBranch
|
|
|
20
20
|
false
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def self.
|
|
24
|
-
GitWrapper.
|
|
25
|
-
branch_id = n.match(/-[1-9]+[0-9]*$/)
|
|
26
|
-
next unless branch_id
|
|
27
|
-
return true if branch_id.to_s == "-#{id}"
|
|
28
|
-
end
|
|
29
|
-
false
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def self.current_story
|
|
33
|
-
/(.*)-(\d+$)/.match GitWrapper.current_branch
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.current_branch_story_parts
|
|
37
|
-
matches = current_story
|
|
38
|
-
return {} unless matches&.length == 3
|
|
39
|
-
|
|
40
|
-
title = matches[1].tr('-', ' ').strip
|
|
41
|
-
{ title: title, id: matches[2].to_i }
|
|
23
|
+
def self.branch_to_story_string(regex_matcher = /.*-(\d+$)/)
|
|
24
|
+
GitWrapper.current_branch.match(regex_matcher)
|
|
42
25
|
end
|
|
43
26
|
|
|
44
27
|
def self.status?(state)
|
|
@@ -7,7 +7,7 @@ module StoryBranch
|
|
|
7
7
|
module Github
|
|
8
8
|
# GitHub Issue representation
|
|
9
9
|
class Issue
|
|
10
|
-
attr_accessor :title, :id
|
|
10
|
+
attr_accessor :title, :id, :html_url
|
|
11
11
|
|
|
12
12
|
def initialize(blanket_story, repo)
|
|
13
13
|
@repo = repo
|
|
@@ -15,9 +15,10 @@ module StoryBranch
|
|
|
15
15
|
@title = blanket_story.title
|
|
16
16
|
@id = blanket_story.number
|
|
17
17
|
@labels = blanket_story.labels.map { |label| Label.new(label) }
|
|
18
|
-
@milestone =
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
@milestone = if blanket_story.milestone
|
|
19
|
+
Milestone.new(blanket_story.milestone)
|
|
20
|
+
end
|
|
21
|
+
@html_url = blanket_story.html_url
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def update_state
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'blanket'
|
|
4
|
-
|
|
4
|
+
require_relative '../tracker_base'
|
|
5
5
|
require_relative './project'
|
|
6
6
|
|
|
7
7
|
module StoryBranch
|
|
@@ -11,6 +11,7 @@ module StoryBranch
|
|
|
11
11
|
API_URL = 'https://api.github.com/'
|
|
12
12
|
|
|
13
13
|
def initialize(project_id:, api_key:, **)
|
|
14
|
+
super
|
|
14
15
|
# NOTE: RepoName should follow owner/repo_name format
|
|
15
16
|
@repo_name = project_id
|
|
16
17
|
@api_key = api_key
|
|
@@ -4,7 +4,7 @@ module StoryBranch
|
|
|
4
4
|
module Jira
|
|
5
5
|
# Jira Issue representation
|
|
6
6
|
class Issue
|
|
7
|
-
attr_accessor :title, :id
|
|
7
|
+
attr_accessor :title, :id, :html_url
|
|
8
8
|
|
|
9
9
|
# TODO: Add component and labels to the info of the issue
|
|
10
10
|
def initialize(jira_issue, project)
|
|
@@ -12,6 +12,7 @@ module StoryBranch
|
|
|
12
12
|
@story = jira_issue
|
|
13
13
|
@title = jira_issue.summary
|
|
14
14
|
@id = jira_issue.key
|
|
15
|
+
@html_url = transform_url(jira_issue.self)
|
|
15
16
|
end
|
|
16
17
|
|
|
17
18
|
def update_state
|
|
@@ -25,6 +26,12 @@ module StoryBranch
|
|
|
25
26
|
def dashed_title
|
|
26
27
|
StoryBranch::StringUtils.normalised_branch_name @title
|
|
27
28
|
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def transform_url(url)
|
|
33
|
+
url.gsub(%r{rest\/api.*$}, "browse/#{@id}")
|
|
34
|
+
end
|
|
28
35
|
end
|
|
29
36
|
end
|
|
30
37
|
end
|
|
@@ -16,7 +16,7 @@ module StoryBranch
|
|
|
16
16
|
# Probably will need a specific query builder per tracker
|
|
17
17
|
def stories(options = {})
|
|
18
18
|
stories = if options[:id]
|
|
19
|
-
[@project.
|
|
19
|
+
[@project.client.Issue.find(options[:id])]
|
|
20
20
|
else
|
|
21
21
|
@project.client.Issue.jql(jql_query)
|
|
22
22
|
end
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# my tracker and issues will still provide a similar api. This jira-ruby
|
|
6
6
|
# is used to get the data.
|
|
7
7
|
require 'jira-ruby'
|
|
8
|
-
|
|
8
|
+
require_relative '../tracker_base'
|
|
9
9
|
require_relative './project'
|
|
10
10
|
|
|
11
11
|
module StoryBranch
|
|
@@ -14,8 +14,11 @@ module StoryBranch
|
|
|
14
14
|
class Tracker < StoryBranch::TrackerBase
|
|
15
15
|
# rubocop:disable Metrics/LineLength
|
|
16
16
|
def initialize(tracker_domain:, project_id:, api_key:, username:, extra_query:)
|
|
17
|
+
super
|
|
18
|
+
|
|
17
19
|
@tracker_url = "https://#{tracker_domain}.atlassian.net"
|
|
18
20
|
@project_id = project_id
|
|
21
|
+
@issue_regex = Regexp.new("#{@project_id}-(\\d+)")
|
|
19
22
|
@api_key = api_key
|
|
20
23
|
@username = username
|
|
21
24
|
@extra_query = extra_query
|
data/lib/story_branch/main.rb
CHANGED
|
@@ -6,6 +6,7 @@ require_relative './jira/tracker'
|
|
|
6
6
|
require_relative './git_utils'
|
|
7
7
|
require_relative './git_wrapper'
|
|
8
8
|
require_relative './config_manager'
|
|
9
|
+
require_relative './url_opener'
|
|
9
10
|
require 'tty-prompt'
|
|
10
11
|
|
|
11
12
|
module StoryBranch
|
|
@@ -67,6 +68,15 @@ module StoryBranch
|
|
|
67
68
|
update_status('started', 'unstarted', 'unstart')
|
|
68
69
|
end
|
|
69
70
|
|
|
71
|
+
def open_current_url
|
|
72
|
+
if current_story
|
|
73
|
+
prompt.say 'Opening story in browser...'
|
|
74
|
+
StoryBranch::UrlOpener.open_url(current_story.html_url)
|
|
75
|
+
else
|
|
76
|
+
prompt.say 'Could not find matching story in configured tracker'
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
70
80
|
private
|
|
71
81
|
|
|
72
82
|
def require_pivotal
|
|
@@ -77,17 +87,9 @@ module StoryBranch
|
|
|
77
87
|
end
|
|
78
88
|
|
|
79
89
|
def current_story
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
current_story = GitUtils.current_branch_story_parts
|
|
90
|
+
return nil unless @tracker
|
|
83
91
|
|
|
84
|
-
|
|
85
|
-
@current_story = @tracker.get_story_by_id(current_story[:id])
|
|
86
|
-
return @current_story if @current_story
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
prompt.error('No tracked feature associated with this branch')
|
|
90
|
-
nil
|
|
92
|
+
@tracker.current_story
|
|
91
93
|
end
|
|
92
94
|
|
|
93
95
|
def unstaged_changes?
|
|
@@ -161,11 +163,6 @@ module StoryBranch
|
|
|
161
163
|
def create_feature_branch(story)
|
|
162
164
|
return if story.nil?
|
|
163
165
|
|
|
164
|
-
if GitUtils.branch_for_story_exists? story.id
|
|
165
|
-
prompt.error("An existing branch has the same story id: #{story.id}")
|
|
166
|
-
return
|
|
167
|
-
end
|
|
168
|
-
|
|
169
166
|
branch_name = valid_branch_name(story)
|
|
170
167
|
return unless branch_name
|
|
171
168
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'blanket'
|
|
4
|
-
|
|
4
|
+
require_relative '../tracker_base'
|
|
5
5
|
require_relative './project'
|
|
6
6
|
|
|
7
7
|
module StoryBranch
|
|
@@ -12,6 +12,7 @@ module StoryBranch
|
|
|
12
12
|
API_URL = 'https://www.pivotaltracker.com/services/v5/'
|
|
13
13
|
|
|
14
14
|
def initialize(project_id:, api_key:, **)
|
|
15
|
+
super
|
|
15
16
|
@project_id = project_id
|
|
16
17
|
@api_key = api_key
|
|
17
18
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'pry'
|
|
4
|
-
|
|
5
3
|
module StoryBranch
|
|
6
4
|
# Base story branch tracker class that will define the expected interface
|
|
7
5
|
class TrackerBase
|
|
6
|
+
def initialize(_options = {})
|
|
7
|
+
@issue_regex = Regexp.new('(\\d+)')
|
|
8
|
+
end
|
|
9
|
+
|
|
8
10
|
def valid?
|
|
9
11
|
raise 'valid? > must be implemented in the custom tracker'
|
|
10
12
|
end
|
|
@@ -21,6 +23,21 @@ module StoryBranch
|
|
|
21
23
|
[]
|
|
22
24
|
end
|
|
23
25
|
|
|
26
|
+
def current_story
|
|
27
|
+
return @current_story if @current_story
|
|
28
|
+
|
|
29
|
+
# TODO: This should look at the tracker configuration and search
|
|
30
|
+
# for the string either in the beginning or the end, according
|
|
31
|
+
# to what is configured
|
|
32
|
+
story_from_branch = GitUtils.branch_to_story_string(@issue_regex)
|
|
33
|
+
if story_from_branch.length == 2
|
|
34
|
+
@current_story = get_story_by_id(story_from_branch[0])
|
|
35
|
+
return @current_story
|
|
36
|
+
end
|
|
37
|
+
prompt.error('No tracked feature associated with this branch')
|
|
38
|
+
nil
|
|
39
|
+
end
|
|
40
|
+
|
|
24
41
|
private
|
|
25
42
|
|
|
26
43
|
def api
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module StoryBranch
|
|
4
|
+
# Class used to open a URL
|
|
5
|
+
class UrlOpener
|
|
6
|
+
def self.open_url(url)
|
|
7
|
+
url = "https://#{url}" unless url.start_with?('http')
|
|
8
|
+
if RbConfig::CONFIG['host_os'].match?(/mswin|mingw|cygwin/)
|
|
9
|
+
system "start #{url}"
|
|
10
|
+
elsif RbConfig::CONFIG['host_os'].match?(/darwin/)
|
|
11
|
+
system "open #{url}"
|
|
12
|
+
elsif RbConfig::CONFIG['host_os'].match?(/linux|bsd/)
|
|
13
|
+
system "xdg-open #{url}"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/story_branch/version.rb
CHANGED
data/story_branch.gemspec
CHANGED
|
@@ -56,14 +56,15 @@ Gem::Specification.new do |spec|
|
|
|
56
56
|
spec.add_runtime_dependency 'blanket_wrapper', '~> 3.0'
|
|
57
57
|
spec.add_runtime_dependency 'damerau-levenshtein', '~> 1.3'
|
|
58
58
|
spec.add_runtime_dependency 'jira-ruby', '~> 1.7'
|
|
59
|
-
spec.add_runtime_dependency 'thor', '~> 0.20
|
|
60
|
-
spec.add_runtime_dependency 'tty-command', '~> 0.8
|
|
61
|
-
spec.add_runtime_dependency 'tty-config', '~> 0.2
|
|
59
|
+
spec.add_runtime_dependency 'thor', '~> 0.20'
|
|
60
|
+
spec.add_runtime_dependency 'tty-command', '~> 0.8'
|
|
61
|
+
spec.add_runtime_dependency 'tty-config', '~> 0.2'
|
|
62
62
|
spec.add_runtime_dependency 'tty-pager', '~> 0.12'
|
|
63
63
|
spec.add_runtime_dependency 'tty-prompt', '~> 0.18'
|
|
64
64
|
spec.add_runtime_dependency 'xdg', '~> 3.0'
|
|
65
65
|
|
|
66
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
66
|
+
spec.add_development_dependency 'bundler', '~> 1.17', '< 2.0'
|
|
67
|
+
spec.add_development_dependency 'simplecov', '~> 0.16'
|
|
67
68
|
spec.add_development_dependency 'fakefs', '~> 0.14'
|
|
68
69
|
spec.add_development_dependency 'git', '~> 1.5'
|
|
69
70
|
spec.add_development_dependency 'ostruct', '~> 0.1'
|
|
@@ -71,5 +72,6 @@ Gem::Specification.new do |spec|
|
|
|
71
72
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
72
73
|
spec.add_development_dependency 'rspec', '~> 3'
|
|
73
74
|
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
|
|
75
|
+
spec.add_development_dependency 'tty', '~> 0.10'
|
|
74
76
|
end
|
|
75
77
|
# rubocop:enable Metrics/BlockLength
|
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.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rui Baltazar
|
|
@@ -12,7 +12,7 @@ authors:
|
|
|
12
12
|
autorequire:
|
|
13
13
|
bindir: exe
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date: 2020-01-
|
|
15
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: blanket_wrapper
|
|
@@ -62,42 +62,42 @@ dependencies:
|
|
|
62
62
|
requirements:
|
|
63
63
|
- - "~>"
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: 0.20
|
|
65
|
+
version: '0.20'
|
|
66
66
|
type: :runtime
|
|
67
67
|
prerelease: false
|
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements:
|
|
70
70
|
- - "~>"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: 0.20
|
|
72
|
+
version: '0.20'
|
|
73
73
|
- !ruby/object:Gem::Dependency
|
|
74
74
|
name: tty-command
|
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements:
|
|
77
77
|
- - "~>"
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: 0.8
|
|
79
|
+
version: '0.8'
|
|
80
80
|
type: :runtime
|
|
81
81
|
prerelease: false
|
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
|
83
83
|
requirements:
|
|
84
84
|
- - "~>"
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: 0.8
|
|
86
|
+
version: '0.8'
|
|
87
87
|
- !ruby/object:Gem::Dependency
|
|
88
88
|
name: tty-config
|
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
|
90
90
|
requirements:
|
|
91
91
|
- - "~>"
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: 0.2
|
|
93
|
+
version: '0.2'
|
|
94
94
|
type: :runtime
|
|
95
95
|
prerelease: false
|
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
|
97
97
|
requirements:
|
|
98
98
|
- - "~>"
|
|
99
99
|
- !ruby/object:Gem::Version
|
|
100
|
-
version: 0.2
|
|
100
|
+
version: '0.2'
|
|
101
101
|
- !ruby/object:Gem::Dependency
|
|
102
102
|
name: tty-pager
|
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -145,6 +145,9 @@ dependencies:
|
|
|
145
145
|
requirement: !ruby/object:Gem::Requirement
|
|
146
146
|
requirements:
|
|
147
147
|
- - "~>"
|
|
148
|
+
- !ruby/object:Gem::Version
|
|
149
|
+
version: '1.17'
|
|
150
|
+
- - "<"
|
|
148
151
|
- !ruby/object:Gem::Version
|
|
149
152
|
version: '2.0'
|
|
150
153
|
type: :development
|
|
@@ -152,8 +155,25 @@ dependencies:
|
|
|
152
155
|
version_requirements: !ruby/object:Gem::Requirement
|
|
153
156
|
requirements:
|
|
154
157
|
- - "~>"
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: '1.17'
|
|
160
|
+
- - "<"
|
|
155
161
|
- !ruby/object:Gem::Version
|
|
156
162
|
version: '2.0'
|
|
163
|
+
- !ruby/object:Gem::Dependency
|
|
164
|
+
name: simplecov
|
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
|
166
|
+
requirements:
|
|
167
|
+
- - "~>"
|
|
168
|
+
- !ruby/object:Gem::Version
|
|
169
|
+
version: '0.16'
|
|
170
|
+
type: :development
|
|
171
|
+
prerelease: false
|
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
173
|
+
requirements:
|
|
174
|
+
- - "~>"
|
|
175
|
+
- !ruby/object:Gem::Version
|
|
176
|
+
version: '0.16'
|
|
157
177
|
- !ruby/object:Gem::Dependency
|
|
158
178
|
name: fakefs
|
|
159
179
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -252,6 +272,20 @@ dependencies:
|
|
|
252
272
|
- - "~>"
|
|
253
273
|
- !ruby/object:Gem::Version
|
|
254
274
|
version: '0.4'
|
|
275
|
+
- !ruby/object:Gem::Dependency
|
|
276
|
+
name: tty
|
|
277
|
+
requirement: !ruby/object:Gem::Requirement
|
|
278
|
+
requirements:
|
|
279
|
+
- - "~>"
|
|
280
|
+
- !ruby/object:Gem::Version
|
|
281
|
+
version: '0.10'
|
|
282
|
+
type: :development
|
|
283
|
+
prerelease: false
|
|
284
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
285
|
+
requirements:
|
|
286
|
+
- - "~>"
|
|
287
|
+
- !ruby/object:Gem::Version
|
|
288
|
+
version: '0.10'
|
|
255
289
|
description: |
|
|
256
290
|
This simple gem allows you to create a branch based on the existing issues
|
|
257
291
|
in your preferred tracker. It integrates with PivotalTracker, Github and
|
|
@@ -301,6 +335,7 @@ files:
|
|
|
301
335
|
- lib/story_branch/commands/add.rb
|
|
302
336
|
- lib/story_branch/commands/create.rb
|
|
303
337
|
- lib/story_branch/commands/finish.rb
|
|
338
|
+
- lib/story_branch/commands/open_issue.rb
|
|
304
339
|
- lib/story_branch/commands/start.rb
|
|
305
340
|
- lib/story_branch/commands/unstart.rb
|
|
306
341
|
- lib/story_branch/config_manager.rb
|
|
@@ -325,9 +360,11 @@ files:
|
|
|
325
360
|
- lib/story_branch/templates/create/.gitkeep
|
|
326
361
|
- lib/story_branch/templates/finish/.gitkeep
|
|
327
362
|
- lib/story_branch/templates/migrate/.gitkeep
|
|
363
|
+
- lib/story_branch/templates/open_issue/.gitkeep
|
|
328
364
|
- lib/story_branch/templates/start/.gitkeep
|
|
329
365
|
- lib/story_branch/templates/unstart/.gitkeep
|
|
330
366
|
- lib/story_branch/tracker_base.rb
|
|
367
|
+
- lib/story_branch/url_opener.rb
|
|
331
368
|
- lib/story_branch/version.rb
|
|
332
369
|
- story_branch.gemspec
|
|
333
370
|
homepage: https://github.com/story-branch/story_branch
|