story_branch 0.5.2 → 0.6.0alpha
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 +5 -5
- data/.circleci/config.yml +8 -12
- data/Gemfile.lock +42 -11
- data/README.md +12 -2
- data/lib/story_branch/commands/add.rb +27 -6
- data/lib/story_branch/jira/issue.rb +30 -0
- data/lib/story_branch/jira/project.rb +31 -0
- data/lib/story_branch/jira/tracker.rb +70 -0
- data/lib/story_branch/main.rb +32 -2
- data/lib/story_branch/version.rb +1 -1
- data/story_branch.gemspec +7 -5
- metadata +41 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: c9a02518d7bc7ed6989a8bac354b4586d52268211024e1253f33ca0345c4f08d
|
|
4
|
+
data.tar.gz: 38a6bdff3edc0038164d693964738d7a9eff743ddb9fade2c1a3a9c01cd70fd1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fdfc646432ce7e0b952659de39efdadc0fc2e09ede2e3e9651d00a3e5840719a14279ae92cec49552572638fa4fdc23eaffe365f65bceec8df97ee494189e84f
|
|
7
|
+
data.tar.gz: 2eebfaf7313adbb7d48c8f4d91f054db99d3fc1af63b20bb6996a7e260b104d68d23913224d4429e12b3d9d468e5430b99fcb63988700ddb6a0e49c0d00775ef
|
data/.circleci/config.yml
CHANGED
|
@@ -2,7 +2,7 @@ version: 2
|
|
|
2
2
|
|
|
3
3
|
defaults: &defaults
|
|
4
4
|
docker:
|
|
5
|
-
- image: circleci/ruby:2.
|
|
5
|
+
- image: circleci/ruby:2.6.5-node
|
|
6
6
|
working_directory: ~/repo
|
|
7
7
|
|
|
8
8
|
workflows:
|
|
@@ -11,15 +11,18 @@ workflows:
|
|
|
11
11
|
jobs:
|
|
12
12
|
- test:
|
|
13
13
|
filters:
|
|
14
|
-
|
|
14
|
+
tags:
|
|
15
|
+
# this enables circleci to trigger on tags
|
|
15
16
|
only: /.*/
|
|
16
17
|
|
|
17
18
|
- publish:
|
|
18
19
|
requires:
|
|
19
20
|
- test
|
|
20
21
|
filters:
|
|
22
|
+
tags:
|
|
23
|
+
only: /^v[0-9]\.[0-9]\.[0-9].*/
|
|
21
24
|
branches:
|
|
22
|
-
|
|
25
|
+
ignore: /.*/
|
|
23
26
|
|
|
24
27
|
jobs:
|
|
25
28
|
test:
|
|
@@ -89,13 +92,6 @@ jobs:
|
|
|
89
92
|
name: Publish to Rubygems
|
|
90
93
|
command: |
|
|
91
94
|
CURRENT_VERSION=$(ruby -r "./lib/story_branch/version.rb" -e "puts StoryBranch::VERSION")
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if [[ "${CURRENT_TAG}" == "${CURRENT_VERSION}" ]]; then
|
|
95
|
-
gem build story_branch.gemspec
|
|
96
|
-
gem push "story_branch-${CURRENT_VERSION}.gem"
|
|
97
|
-
else
|
|
98
|
-
echo "Not tagged as a new version - skipping gem push"
|
|
99
|
-
fi
|
|
100
|
-
|
|
95
|
+
gem build story_branch.gemspec
|
|
96
|
+
gem push "story_branch-${CURRENT_VERSION}.gem"
|
|
101
97
|
shred -u ~/.gem/credentials
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
story_branch (0.
|
|
4
|
+
story_branch (0.6.0alpha)
|
|
5
5
|
blanket_wrapper (~> 3.0)
|
|
6
6
|
damerau-levenshtein (~> 1.3)
|
|
7
|
+
jira-ruby (~> 1.7)
|
|
7
8
|
thor (~> 0.20.0)
|
|
8
9
|
tty-command (~> 0.8.2)
|
|
9
10
|
tty-config (~> 0.2.0)
|
|
@@ -13,49 +14,75 @@ PATH
|
|
|
13
14
|
GEM
|
|
14
15
|
remote: https://rubygems.org/
|
|
15
16
|
specs:
|
|
17
|
+
activesupport (6.0.0)
|
|
18
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
19
|
+
i18n (>= 0.7, < 2)
|
|
20
|
+
minitest (~> 5.1)
|
|
21
|
+
tzinfo (~> 1.1)
|
|
22
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
|
23
|
+
atlassian-jwt (0.2.0)
|
|
24
|
+
jwt (~> 2.1.0)
|
|
16
25
|
blanket_wrapper (3.0.2)
|
|
17
26
|
httparty
|
|
18
27
|
recursive-open-struct
|
|
28
|
+
coderay (1.1.2)
|
|
29
|
+
concurrent-ruby (1.1.5)
|
|
19
30
|
damerau-levenshtein (1.3.1)
|
|
20
31
|
diff-lcs (1.3)
|
|
21
|
-
equatable (0.6.
|
|
22
|
-
fakefs (0.
|
|
32
|
+
equatable (0.6.1)
|
|
33
|
+
fakefs (0.20.1)
|
|
23
34
|
git (1.5.0)
|
|
24
|
-
httparty (0.17.
|
|
35
|
+
httparty (0.17.1)
|
|
25
36
|
mime-types (~> 3.0)
|
|
26
37
|
multi_xml (>= 0.5.2)
|
|
27
|
-
|
|
38
|
+
i18n (1.7.0)
|
|
39
|
+
concurrent-ruby (~> 1.0)
|
|
40
|
+
jira-ruby (1.7.1)
|
|
41
|
+
activesupport
|
|
42
|
+
atlassian-jwt
|
|
43
|
+
multipart-post
|
|
44
|
+
oauth (~> 0.5, >= 0.5.0)
|
|
45
|
+
jwt (2.1.0)
|
|
46
|
+
method_source (0.9.2)
|
|
47
|
+
mime-types (3.3)
|
|
28
48
|
mime-types-data (~> 3.2015)
|
|
29
|
-
mime-types-data (3.2019.
|
|
49
|
+
mime-types-data (3.2019.0904)
|
|
50
|
+
minitest (5.12.2)
|
|
30
51
|
multi_xml (0.6.0)
|
|
52
|
+
multipart-post (2.1.1)
|
|
31
53
|
necromancer (0.5.0)
|
|
54
|
+
oauth (0.5.4)
|
|
32
55
|
ostruct (0.1.0)
|
|
33
56
|
pastel (0.7.3)
|
|
34
57
|
equatable (~> 0.6)
|
|
35
58
|
tty-color (~> 0.5)
|
|
59
|
+
pry (0.11.3)
|
|
60
|
+
coderay (~> 1.1.0)
|
|
61
|
+
method_source (~> 0.9.0)
|
|
36
62
|
rake (10.5.0)
|
|
37
63
|
recursive-open-struct (1.1.0)
|
|
38
64
|
rspec (3.8.0)
|
|
39
65
|
rspec-core (~> 3.8.0)
|
|
40
66
|
rspec-expectations (~> 3.8.0)
|
|
41
67
|
rspec-mocks (~> 3.8.0)
|
|
42
|
-
rspec-core (3.8.
|
|
68
|
+
rspec-core (3.8.2)
|
|
43
69
|
rspec-support (~> 3.8.0)
|
|
44
|
-
rspec-expectations (3.8.
|
|
70
|
+
rspec-expectations (3.8.5)
|
|
45
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
46
72
|
rspec-support (~> 3.8.0)
|
|
47
|
-
rspec-mocks (3.8.
|
|
73
|
+
rspec-mocks (3.8.2)
|
|
48
74
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
49
75
|
rspec-support (~> 3.8.0)
|
|
50
|
-
rspec-support (3.8.
|
|
76
|
+
rspec-support (3.8.3)
|
|
51
77
|
rspec_junit_formatter (0.4.1)
|
|
52
78
|
rspec-core (>= 2, < 4, != 2.12.0)
|
|
53
|
-
strings (0.1.
|
|
79
|
+
strings (0.1.6)
|
|
54
80
|
strings-ansi (~> 0.1)
|
|
55
81
|
unicode-display_width (~> 1.5)
|
|
56
82
|
unicode_utils (~> 1.4)
|
|
57
83
|
strings-ansi (0.1.0)
|
|
58
84
|
thor (0.20.3)
|
|
85
|
+
thread_safe (0.3.6)
|
|
59
86
|
tty-color (0.5.0)
|
|
60
87
|
tty-command (0.8.2)
|
|
61
88
|
pastel (~> 0.7.0)
|
|
@@ -75,9 +102,12 @@ GEM
|
|
|
75
102
|
wisper (~> 2.0.0)
|
|
76
103
|
tty-screen (0.7.0)
|
|
77
104
|
tty-which (0.4.1)
|
|
105
|
+
tzinfo (1.2.5)
|
|
106
|
+
thread_safe (~> 0.1)
|
|
78
107
|
unicode-display_width (1.6.0)
|
|
79
108
|
unicode_utils (1.4.0)
|
|
80
109
|
wisper (2.0.0)
|
|
110
|
+
zeitwerk (2.1.10)
|
|
81
111
|
|
|
82
112
|
PLATFORMS
|
|
83
113
|
ruby
|
|
@@ -87,6 +117,7 @@ DEPENDENCIES
|
|
|
87
117
|
fakefs (~> 0.14)
|
|
88
118
|
git (~> 1.5)
|
|
89
119
|
ostruct (~> 0.1)
|
|
120
|
+
pry (~> 0.11)
|
|
90
121
|
rake (~> 10.0)
|
|
91
122
|
rspec (~> 3)
|
|
92
123
|
rspec_junit_formatter (~> 0.4)
|
data/README.md
CHANGED
|
@@ -113,8 +113,8 @@ the full list.
|
|
|
113
113
|
## Configuring PivotalTracker
|
|
114
114
|
|
|
115
115
|
When running the command `story_branch add` you'll be asked 3 things:
|
|
116
|
-
1.
|
|
117
|
-
2.
|
|
116
|
+
1. tracker - You should select Pivotal Tracker
|
|
117
|
+
2. project id - This can be fetched from the PivotalTracker url. E.g in the url `https://www.pivotaltracker.com/n/projects/651417`, the project id would be `651417`
|
|
118
118
|
3. api key - this is your personal api key. You can get that from [your profile page](https://www.pivotaltracker.com/profile)
|
|
119
119
|
|
|
120
120
|
## Configuring Github
|
|
@@ -125,6 +125,16 @@ When running the command `story_branch add` you'll be asked 3 things:
|
|
|
125
125
|
3. api key - this is your personal api token. You can create one under your
|
|
126
126
|
[developer profile tokens page](https://github.com/settings/tokens)
|
|
127
127
|
|
|
128
|
+
## Configuring JIRA
|
|
129
|
+
|
|
130
|
+
The configuration for JIRA is slightly more complex as the endpoint changes according
|
|
131
|
+
to your project setup. You will need an API token, which you can create a new one in your [JIRA id management page](https://id.atlassian.com/manage/api-tokens)
|
|
132
|
+
1. tracker - You should select JIRA
|
|
133
|
+
2. JIRA's subdomain - you should type the JIRA's subdomain that you use to access in your browser. E.g I'd type perxtechnologies to access to https://perxtechnologies.atlassian.net
|
|
134
|
+
3. JIRA's project key - this should match which project you want to fetch the issues from. E.g. PW is the key for my Project Whistler, so I'd type PW
|
|
135
|
+
4. API key that you should have gotten in the first description step
|
|
136
|
+
5. username used for login in the JIRA usually. If you use google email authentication, the username should be your email
|
|
137
|
+
|
|
128
138
|
## Migrating
|
|
129
139
|
|
|
130
140
|
### Old configuration
|
|
@@ -20,8 +20,8 @@ module StoryBranch
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def execute(_input: $stdin, output: $stdout)
|
|
23
|
-
create_global_config
|
|
24
23
|
create_local_config
|
|
24
|
+
create_global_config
|
|
25
25
|
output.puts 'Configuration added successfully'
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -30,24 +30,44 @@ module StoryBranch
|
|
|
30
30
|
def create_local_config
|
|
31
31
|
return if local_config_has_value?
|
|
32
32
|
|
|
33
|
+
puts "Setting #{tracker}"
|
|
34
|
+
@local_config.set(:tracker, value: tracker)
|
|
35
|
+
|
|
33
36
|
puts "Appending #{project_id}"
|
|
34
37
|
@local_config.append(project_id, to: :project_id)
|
|
35
38
|
|
|
36
|
-
puts "Setting #{tracker}"
|
|
37
|
-
@local_config.set(:tracker, value: tracker)
|
|
38
39
|
@local_config.write(force: true)
|
|
39
40
|
end
|
|
40
41
|
|
|
41
42
|
def create_global_config
|
|
42
|
-
api_key = prompt.ask
|
|
43
|
+
api_key = prompt.ask('Please provide the api key:', required: true)
|
|
43
44
|
@config.set(project_id, :api_key, value: api_key)
|
|
44
45
|
@config.write(force: true)
|
|
46
|
+
|
|
47
|
+
return unless tracker == 'jira'
|
|
48
|
+
|
|
49
|
+
# rubocop:disable Metrics/LineLength
|
|
50
|
+
username = prompt.ask('Please provide username (email most of the times) for this key:',
|
|
51
|
+
required: true)
|
|
52
|
+
# rubocop:enable Metrics/LineLength
|
|
53
|
+
@config.set(project_id, :username, value: username)
|
|
54
|
+
@config.write(force: true)
|
|
45
55
|
end
|
|
46
56
|
|
|
47
57
|
def project_id
|
|
48
58
|
return @project_id if @project_id
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
if tracker == 'jira'
|
|
61
|
+
# rubocop:disable Metrics/LineLength
|
|
62
|
+
project_domain = prompt.ask("What is your JIRA's subdomain?", required: true)
|
|
63
|
+
project_key = prompt.ask("What is your JIRA's project key?", required: true)
|
|
64
|
+
# rubocop:enable Metrics/LineLength
|
|
65
|
+
@project_id = "#{project_domain}|#{project_key}"
|
|
66
|
+
else
|
|
67
|
+
# rubocop:disable Metrics/LineLength
|
|
68
|
+
@project_id = prompt.ask("Please provide this project's id:", required: true)
|
|
69
|
+
# rubocop:enable Metrics/LineLength
|
|
70
|
+
end
|
|
51
71
|
end
|
|
52
72
|
|
|
53
73
|
def tracker
|
|
@@ -55,7 +75,8 @@ module StoryBranch
|
|
|
55
75
|
|
|
56
76
|
trackers = {
|
|
57
77
|
'Pivotal Tracker' => 'pivotal-tracker',
|
|
58
|
-
'Github' => 'github'
|
|
78
|
+
'Github' => 'github',
|
|
79
|
+
'JIRA' => 'jira'
|
|
59
80
|
}
|
|
60
81
|
@tracker = prompt.select('Which tracker are you using?', trackers)
|
|
61
82
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module StoryBranch
|
|
4
|
+
module Jira
|
|
5
|
+
# Jira Issue representation
|
|
6
|
+
class Issue
|
|
7
|
+
attr_accessor :title, :id
|
|
8
|
+
|
|
9
|
+
# TODO: Add component and labels to the info of the issue
|
|
10
|
+
def initialize(jira_issue, project)
|
|
11
|
+
@project = project
|
|
12
|
+
@story = jira_issue
|
|
13
|
+
@title = jira_issue.summary
|
|
14
|
+
@id = jira_issue.key
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def update_state
|
|
18
|
+
puts 'What to do in github for this?'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def to_s
|
|
22
|
+
"#{@id} - #{@title}"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def dashed_title
|
|
26
|
+
StoryBranch::StringUtils.normalised_branch_name @title
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative './issue'
|
|
4
|
+
|
|
5
|
+
module StoryBranch
|
|
6
|
+
module Jira
|
|
7
|
+
# Jira Project representation
|
|
8
|
+
class Project
|
|
9
|
+
def initialize(jira_project)
|
|
10
|
+
@project = jira_project
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Returns an array of Jira issues (Issue Class)
|
|
14
|
+
# TODO: Support different options being passed.
|
|
15
|
+
# Probably will need a specific query builder per tracker
|
|
16
|
+
def stories(options = {})
|
|
17
|
+
stories = if options[:id]
|
|
18
|
+
[@project.issues.find(options[:id])]
|
|
19
|
+
else
|
|
20
|
+
# rubocop:disable Metrics/LineLength
|
|
21
|
+
@project.client.Issue.jql(
|
|
22
|
+
"project=#{@project.key} AND status='To Do' AND assignee=currentUser()"
|
|
23
|
+
)
|
|
24
|
+
# rubocop:enable Metrics/LineLength
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
stories.map { |s| Issue.new(s, @project) }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# NOTE: The JIRA api is restful but I don't seem to be able to wrap it
|
|
4
|
+
# with blanket, so I'm using a gem that has wrapped the whole api, but
|
|
5
|
+
# my tracker and issues will still provide a similar api. This jira-ruby
|
|
6
|
+
# is used to get the data.
|
|
7
|
+
require 'jira-ruby'
|
|
8
|
+
require_relative './project'
|
|
9
|
+
|
|
10
|
+
module StoryBranch
|
|
11
|
+
module Jira
|
|
12
|
+
# JIRA API wrapper for story branch tracker
|
|
13
|
+
class Tracker
|
|
14
|
+
TYPE = 'jira'
|
|
15
|
+
|
|
16
|
+
attr_reader :type
|
|
17
|
+
|
|
18
|
+
def initialize(tracker_domain:, project_id:, api_key:, username:)
|
|
19
|
+
@tracker_url = "https://#{tracker_domain}.atlassian.net"
|
|
20
|
+
@project_id = project_id
|
|
21
|
+
@api_key = api_key
|
|
22
|
+
@username = username
|
|
23
|
+
@type = TYPE
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def valid?
|
|
27
|
+
[@api_key, @project_id, @username, @tracker_url].none?(&:nil?)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# TODO: This should probably be renamed to something more meaningful
|
|
31
|
+
# in the sense that it should be workable stories/issues
|
|
32
|
+
# which depend on the tracker's workflow. PivotalTracker they need to
|
|
33
|
+
# be started and estimated, while for Github they just need to be open
|
|
34
|
+
def stories
|
|
35
|
+
project.stories
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_story_by_id(story_id)
|
|
39
|
+
project.stories(id: story_id).first
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def options
|
|
45
|
+
{
|
|
46
|
+
username: @username,
|
|
47
|
+
password: @api_key,
|
|
48
|
+
site: @tracker_url,
|
|
49
|
+
auth_type: :basic,
|
|
50
|
+
read_timeout: 120,
|
|
51
|
+
context_path: ''
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def api
|
|
56
|
+
raise 'API key must be specified' unless @api_key
|
|
57
|
+
|
|
58
|
+
@api ||= JIRA::Client.new(options)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def project
|
|
62
|
+
return @project if @project
|
|
63
|
+
raise 'project key must be set' unless @project_id
|
|
64
|
+
|
|
65
|
+
jira_project = api.Project.find(@project_id)
|
|
66
|
+
@project = Project.new(jira_project)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
data/lib/story_branch/main.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative './pivotal/tracker'
|
|
4
4
|
require_relative './github/tracker'
|
|
5
|
+
require_relative './jira/tracker'
|
|
5
6
|
require_relative './git_utils'
|
|
6
7
|
require_relative './git_wrapper'
|
|
7
8
|
require_relative './config_manager'
|
|
@@ -10,6 +11,7 @@ require 'tty-prompt'
|
|
|
10
11
|
module StoryBranch
|
|
11
12
|
# Main story branch class. It is resposnible for the main interaction between
|
|
12
13
|
# the user and Pivotal Tracker. It is also responsible for config init.
|
|
14
|
+
# rubocop:disable Metrics/ClassLength
|
|
13
15
|
class Main
|
|
14
16
|
attr_accessor :tracker
|
|
15
17
|
|
|
@@ -43,7 +45,9 @@ module StoryBranch
|
|
|
43
45
|
return if unstaged_changes?
|
|
44
46
|
return if nothing_to_add?
|
|
45
47
|
|
|
48
|
+
# rubocop:disable Metrics/LineLength
|
|
46
49
|
commit_message = "[#{finish_tag} ##{current_story[:id]}] #{current_story[:title]}"
|
|
50
|
+
# rubocop:enable Metrics/LineLength
|
|
47
51
|
proceed = prompt.yes?("Commit with standard message? #{commit_message}")
|
|
48
52
|
if proceed
|
|
49
53
|
GitWrapper.commit commit_message
|
|
@@ -112,6 +116,8 @@ module StoryBranch
|
|
|
112
116
|
true
|
|
113
117
|
end
|
|
114
118
|
|
|
119
|
+
# rubocop:disable Metrics/AbcSize
|
|
120
|
+
# rubocop:disable Metrics/MethodLength
|
|
115
121
|
def update_status(current_status, next_status, action)
|
|
116
122
|
stories = @tracker.stories_with_state(current_status)
|
|
117
123
|
if stories.empty?
|
|
@@ -134,6 +140,8 @@ module StoryBranch
|
|
|
134
140
|
prompt.ok("#{story.id} #{next_status}")
|
|
135
141
|
story
|
|
136
142
|
end
|
|
143
|
+
# rubocop:enable Metrics/MethodLength
|
|
144
|
+
# rubocop:enable Metrics/AbcSize
|
|
137
145
|
|
|
138
146
|
def build_stories_structure(stories)
|
|
139
147
|
options = {}
|
|
@@ -170,7 +178,9 @@ module StoryBranch
|
|
|
170
178
|
return unless validate_branch_name(feature_branch_name, story.id)
|
|
171
179
|
|
|
172
180
|
feature_branch_name_with_story_id = "#{feature_branch_name}-#{story.id}"
|
|
181
|
+
# rubocop:disable Metrics/LineLength
|
|
173
182
|
prompt.say("Creating: #{feature_branch_name_with_story_id} with #{current_branch} as parent")
|
|
183
|
+
# rubocop:enable Metrics/LineLength
|
|
174
184
|
GitWrapper.create_branch feature_branch_name_with_story_id
|
|
175
185
|
end
|
|
176
186
|
|
|
@@ -181,7 +191,9 @@ module StoryBranch
|
|
|
181
191
|
return false
|
|
182
192
|
end
|
|
183
193
|
if GitUtils.existing_branch? name
|
|
194
|
+
# rubocop:disable Metrics/LineLength
|
|
184
195
|
prompt.error('This name is very similar to an existing branch. Avoid confusion and use a more unique name.')
|
|
196
|
+
# rubocop:enable Metrics/LineLength
|
|
185
197
|
return false
|
|
186
198
|
end
|
|
187
199
|
true
|
|
@@ -202,9 +214,15 @@ module StoryBranch
|
|
|
202
214
|
end
|
|
203
215
|
|
|
204
216
|
def api_key
|
|
205
|
-
@api_key
|
|
217
|
+
@api_key ||= @global_config.fetch(project_id, :api_key)
|
|
206
218
|
end
|
|
207
219
|
|
|
220
|
+
def username
|
|
221
|
+
@username ||= @global_config.fetch(project_id, :username)
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# rubocop:disable Metrics/AbcSize
|
|
225
|
+
# rubocop:disable Metrics/MethodLength
|
|
208
226
|
def initialize_tracker
|
|
209
227
|
if project_id.nil?
|
|
210
228
|
prompt.say 'Project ID not set'
|
|
@@ -214,9 +232,21 @@ module StoryBranch
|
|
|
214
232
|
@tracker = case tracker_type
|
|
215
233
|
when 'github'
|
|
216
234
|
StoryBranch::Github::Tracker.new(project_id, api_key)
|
|
217
|
-
|
|
235
|
+
when 'pivotal-tracker'
|
|
218
236
|
StoryBranch::Pivotal::Tracker.new(project_id, api_key)
|
|
237
|
+
when 'jira'
|
|
238
|
+
tracker_domain, project_key = project_id.split('|')
|
|
239
|
+
options = {
|
|
240
|
+
tracker_domain: tracker_domain,
|
|
241
|
+
project_id: project_key,
|
|
242
|
+
api_key: api_key,
|
|
243
|
+
username: username
|
|
244
|
+
}
|
|
245
|
+
StoryBranch::Jira::Tracker.new(options)
|
|
219
246
|
end
|
|
220
247
|
end
|
|
248
|
+
# rubocop:enable Metrics/AbcSize
|
|
249
|
+
# rubocop:enable Metrics/MethodLength
|
|
221
250
|
end
|
|
251
|
+
# rubocop:enable Metrics/ClassLength
|
|
222
252
|
end
|
data/lib/story_branch/version.rb
CHANGED
data/story_branch.gemspec
CHANGED
|
@@ -24,11 +24,11 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
'gabe@neo.com'
|
|
25
25
|
]
|
|
26
26
|
|
|
27
|
-
spec.summary = 'Create git branches based on
|
|
27
|
+
spec.summary = 'Create git branches based on your preferred tracker tickets'
|
|
28
28
|
spec.description = <<~DESCRIPTION
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
This simple gem allows you to create a branch based on the existing issues
|
|
30
|
+
in your preferred tracker. It integrates with PivotalTracker, Github and
|
|
31
|
+
JIRA. Different workflows shall be supported in the next versions.
|
|
32
32
|
DESCRIPTION
|
|
33
33
|
|
|
34
34
|
spec.metadata = {
|
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
'homepage_uri' => 'https://github.com/story-branch/story_branch',
|
|
39
39
|
'source_code_uri' => 'https://github.com/story-branch/story_branch'
|
|
40
40
|
}
|
|
41
|
-
spec.required_ruby_version = ['>= 2.
|
|
41
|
+
spec.required_ruby_version = ['>= 2.4', '< 2.7']
|
|
42
42
|
|
|
43
43
|
# Specify which files should be added to the gem when it is released.
|
|
44
44
|
# The `git ls-files -z` loads the files in the RubyGem that have been
|
|
@@ -54,6 +54,7 @@ Gem::Specification.new do |spec|
|
|
|
54
54
|
|
|
55
55
|
spec.add_runtime_dependency 'blanket_wrapper', '~> 3.0'
|
|
56
56
|
spec.add_runtime_dependency 'damerau-levenshtein', '~> 1.3'
|
|
57
|
+
spec.add_runtime_dependency 'jira-ruby', '~> 1.7'
|
|
57
58
|
spec.add_runtime_dependency 'thor', '~> 0.20.0'
|
|
58
59
|
spec.add_runtime_dependency 'tty-command', '~> 0.8.2'
|
|
59
60
|
spec.add_runtime_dependency 'tty-config', '~> 0.2.0'
|
|
@@ -64,6 +65,7 @@ Gem::Specification.new do |spec|
|
|
|
64
65
|
spec.add_development_dependency 'fakefs', '~> 0.14'
|
|
65
66
|
spec.add_development_dependency 'git', '~> 1.5'
|
|
66
67
|
spec.add_development_dependency 'ostruct', '~> 0.1'
|
|
68
|
+
spec.add_development_dependency 'pry', '~> 0.11'
|
|
67
69
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
68
70
|
spec.add_development_dependency 'rspec', '~> 3'
|
|
69
71
|
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
|
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.
|
|
4
|
+
version: 0.6.0alpha
|
|
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: 2019-06
|
|
15
|
+
date: 2019-10-06 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: blanket_wrapper
|
|
@@ -42,6 +42,20 @@ dependencies:
|
|
|
42
42
|
- - "~>"
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
44
|
version: '1.3'
|
|
45
|
+
- !ruby/object:Gem::Dependency
|
|
46
|
+
name: jira-ruby
|
|
47
|
+
requirement: !ruby/object:Gem::Requirement
|
|
48
|
+
requirements:
|
|
49
|
+
- - "~>"
|
|
50
|
+
- !ruby/object:Gem::Version
|
|
51
|
+
version: '1.7'
|
|
52
|
+
type: :runtime
|
|
53
|
+
prerelease: false
|
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - "~>"
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: '1.7'
|
|
45
59
|
- !ruby/object:Gem::Dependency
|
|
46
60
|
name: thor
|
|
47
61
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -168,6 +182,20 @@ dependencies:
|
|
|
168
182
|
- - "~>"
|
|
169
183
|
- !ruby/object:Gem::Version
|
|
170
184
|
version: '0.1'
|
|
185
|
+
- !ruby/object:Gem::Dependency
|
|
186
|
+
name: pry
|
|
187
|
+
requirement: !ruby/object:Gem::Requirement
|
|
188
|
+
requirements:
|
|
189
|
+
- - "~>"
|
|
190
|
+
- !ruby/object:Gem::Version
|
|
191
|
+
version: '0.11'
|
|
192
|
+
type: :development
|
|
193
|
+
prerelease: false
|
|
194
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
195
|
+
requirements:
|
|
196
|
+
- - "~>"
|
|
197
|
+
- !ruby/object:Gem::Version
|
|
198
|
+
version: '0.11'
|
|
171
199
|
- !ruby/object:Gem::Dependency
|
|
172
200
|
name: rake
|
|
173
201
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -211,9 +239,9 @@ dependencies:
|
|
|
211
239
|
- !ruby/object:Gem::Version
|
|
212
240
|
version: '0.4'
|
|
213
241
|
description: |
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
242
|
+
This simple gem allows you to create a branch based on the existing issues
|
|
243
|
+
in your preferred tracker. It integrates with PivotalTracker, Github and
|
|
244
|
+
JIRA. Different workflows shall be supported in the next versions.
|
|
217
245
|
email:
|
|
218
246
|
- rui.p.baltazar@gmail.com
|
|
219
247
|
- jasonm23@gmail.com
|
|
@@ -267,6 +295,9 @@ files:
|
|
|
267
295
|
- lib/story_branch/github/milestone.rb
|
|
268
296
|
- lib/story_branch/github/project.rb
|
|
269
297
|
- lib/story_branch/github/tracker.rb
|
|
298
|
+
- lib/story_branch/jira/issue.rb
|
|
299
|
+
- lib/story_branch/jira/project.rb
|
|
300
|
+
- lib/story_branch/jira/tracker.rb
|
|
270
301
|
- lib/story_branch/main.rb
|
|
271
302
|
- lib/story_branch/pivotal/project.rb
|
|
272
303
|
- lib/story_branch/pivotal/story.rb
|
|
@@ -299,19 +330,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
299
330
|
requirements:
|
|
300
331
|
- - ">="
|
|
301
332
|
- !ruby/object:Gem::Version
|
|
302
|
-
version: '2.
|
|
333
|
+
version: '2.4'
|
|
303
334
|
- - "<"
|
|
304
335
|
- !ruby/object:Gem::Version
|
|
305
336
|
version: '2.7'
|
|
306
337
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
307
338
|
requirements:
|
|
308
|
-
- - "
|
|
339
|
+
- - ">"
|
|
309
340
|
- !ruby/object:Gem::Version
|
|
310
|
-
version:
|
|
341
|
+
version: 1.3.1
|
|
311
342
|
requirements: []
|
|
312
|
-
|
|
313
|
-
rubygems_version: 2.6.13
|
|
343
|
+
rubygems_version: 3.0.3
|
|
314
344
|
signing_key:
|
|
315
345
|
specification_version: 4
|
|
316
|
-
summary: Create git branches based on
|
|
346
|
+
summary: Create git branches based on your preferred tracker tickets
|
|
317
347
|
test_files: []
|