jira-cli 0.2.0 → 0.2.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/README.md +1 -0
- data/lib/jira/commands/delete.rb +4 -10
- data/lib/jira/commands/link.rb +64 -0
- data/lib/jira/commands/new.rb +2 -2
- data/lib/jira/constants.rb +1 -1
- metadata +5 -12
- data/lib/jira/commands/browse.rb +0 -10
- data/lib/jira/commands/clipboard.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf31b62944c6318cc60e62393171499223c81557
|
4
|
+
data.tar.gz: 78e2f534aa333c215c8d3128689c664331563f30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5893c0f57f13ce2dd62a8c1254de8ae190520c86eb13ebb1fae90b99058b1b2befea144735f9082d6fcbba2e5f2141114c6329c837cfe628267f6ef1e193b824
|
7
|
+
data.tar.gz: 35c45ba31d312511bdf68be0021ee7a3460130ec6d4260785c1d28c3610d7f65ee5faf3333222ab0b28e3e5cf98446d5b1ea180e9fc545ef532d01fac736676d
|
data/README.md
CHANGED
@@ -21,6 +21,7 @@ Ruby gem CLI tool used to manage JIRA workflows leveraging git
|
|
21
21
|
jira delete # Deletes a ticket in JIRA and the git branch
|
22
22
|
jira describe # Describes the input ticket
|
23
23
|
jira install # Guides the user through JIRA installation
|
24
|
+
jira link # Creates a link between two tickets in JIRA
|
24
25
|
jira log # Logs work against the input ticket
|
25
26
|
jira logd # Deletes work against the input ticket
|
26
27
|
jira logs # Lists work against the input ticket
|
data/lib/jira/commands/delete.rb
CHANGED
@@ -2,18 +2,15 @@ module Jira
|
|
2
2
|
class CLI < Thor
|
3
3
|
|
4
4
|
desc "delete", "Deletes a ticket in JIRA and the git branch"
|
5
|
-
|
5
|
+
method_option :force, type: :boolean, default: false
|
6
6
|
def delete(ticket=Jira::Core.ticket)
|
7
7
|
force = options[:force]
|
8
8
|
self.api.get("issue/#{ticket}") do |json|
|
9
9
|
issue_type = json['fields']['issuetype']
|
10
10
|
if !issue_type['subtask']
|
11
|
-
if !json['fields']['subtasks'].empty?
|
11
|
+
if !json['fields']['subtasks'].empty? && !force
|
12
12
|
force = self.io.agree("Delete all sub-tasks for ticket #{ticket}")
|
13
|
-
if !force
|
14
|
-
puts "No ticket deleted."
|
15
|
-
return
|
16
|
-
end
|
13
|
+
puts "No ticket deleted." and return if !force
|
17
14
|
end
|
18
15
|
end
|
19
16
|
|
@@ -26,10 +23,7 @@ module Jira
|
|
26
23
|
puts "Creating a new branch."
|
27
24
|
new_branch = self.io.ask("Branch").strip
|
28
25
|
new_branch.delete!(" ")
|
29
|
-
if new_branch.empty?
|
30
|
-
puts "No ticket deleted."
|
31
|
-
return
|
32
|
-
end
|
26
|
+
puts "No ticket deleted." and return if new_branch.empty?
|
33
27
|
`git branch #{new_branch} 2> /dev/null`
|
34
28
|
branches << new_branch
|
35
29
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Jira
|
2
|
+
class CLI < Thor
|
3
|
+
|
4
|
+
desc "link", "Creates a link between two tickets in JIRA"
|
5
|
+
def link(ticket=Jira::Core.ticket)
|
6
|
+
self.api.get("issueLinkType") do |json|
|
7
|
+
# determine issue link type
|
8
|
+
issue_link_type = select_issue_link_type(json)
|
9
|
+
break if issue_link_type.nil?
|
10
|
+
|
11
|
+
# determine outward ticket
|
12
|
+
outward_ticket = self.io.ask("Outward ticket").strip
|
13
|
+
break if !Jira::Core.ticket?(outward_ticket)
|
14
|
+
|
15
|
+
# determine api parameters
|
16
|
+
params = {
|
17
|
+
type: {
|
18
|
+
name: issue_link_type[:name]
|
19
|
+
},
|
20
|
+
inwardIssue: {
|
21
|
+
key: ticket
|
22
|
+
},
|
23
|
+
outwardIssue: {
|
24
|
+
key: outward_ticket
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
self.api.post("issueLink", params) do |json|
|
29
|
+
puts "Successfully linked ticket #{ticket} to ticket #{outward_ticket}."
|
30
|
+
return
|
31
|
+
end
|
32
|
+
end
|
33
|
+
puts "No ticket linked."
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
#
|
39
|
+
# Given the issue link type metadata, prompts the user for
|
40
|
+
# the issue link type to use, then return the issue link
|
41
|
+
# type hash
|
42
|
+
#
|
43
|
+
# @param json [Hash] issue link type metadata
|
44
|
+
#
|
45
|
+
# @return [Hash] selected issue link type metadata
|
46
|
+
#
|
47
|
+
def select_issue_link_type(json)
|
48
|
+
issue_link_types = {}
|
49
|
+
json['issueLinkTypes'].each do |issue_link_type|
|
50
|
+
data = {
|
51
|
+
id: issue_link_type['id'],
|
52
|
+
name: issue_link_type['name'],
|
53
|
+
inward: issue_link_type['inward'],
|
54
|
+
outward: issue_link_type['outward']
|
55
|
+
}
|
56
|
+
issue_link_types[issue_link_type['name']] = data
|
57
|
+
end
|
58
|
+
issue_link_types['Cancel'] = nil
|
59
|
+
choice = self.io.choose("Select a link type", issue_link_types.keys)
|
60
|
+
return issue_link_types[choice]
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
data/lib/jira/commands/new.rb
CHANGED
@@ -10,12 +10,12 @@ module Jira
|
|
10
10
|
|
11
11
|
# determine issue type
|
12
12
|
issue_type = self.select_issue_type(project)
|
13
|
-
|
13
|
+
break if issue_type.nil?
|
14
14
|
|
15
15
|
# determine parent (ticket)
|
16
16
|
parent = nil
|
17
17
|
parent = ticket if issue_type['subtask']
|
18
|
-
|
18
|
+
break if !parent.nil? and !Jira::Core.ticket?(parent)
|
19
19
|
|
20
20
|
# determine summary and description
|
21
21
|
summary = self.io.ask("Summary")
|
data/lib/jira/constants.rb
CHANGED
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Lin Cheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.19.1
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
19
|
+
version: 0.14.4
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.19.1
|
30
24
|
- - ">="
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
26
|
+
version: 0.14.4
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: faraday
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,13 +97,12 @@ files:
|
|
103
97
|
- lib/jira/api.rb
|
104
98
|
- lib/jira/commands/assign.rb
|
105
99
|
- lib/jira/commands/attachments.rb
|
106
|
-
- lib/jira/commands/browse.rb
|
107
|
-
- lib/jira/commands/clipboard.rb
|
108
100
|
- lib/jira/commands/comment.rb
|
109
101
|
- lib/jira/commands/commit.rb
|
110
102
|
- lib/jira/commands/delete.rb
|
111
103
|
- lib/jira/commands/describe.rb
|
112
104
|
- lib/jira/commands/install.rb
|
105
|
+
- lib/jira/commands/link.rb
|
113
106
|
- lib/jira/commands/log.rb
|
114
107
|
- lib/jira/commands/new.rb
|
115
108
|
- lib/jira/commands/rename.rb
|
data/lib/jira/commands/browse.rb
DELETED