jira-cli 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jira/command.rb +4 -3
- data/lib/jira/commands/attachments.rb +1 -1
- data/lib/jira/commands/delete.rb +2 -2
- data/lib/jira/commands/install.rb +1 -1
- data/lib/jira/commands/link.rb +2 -3
- data/lib/jira/commands/new.rb +3 -4
- data/lib/jira/commands/sprint.rb +1 -1
- data/lib/jira/commands/tickets.rb +25 -19
- data/lib/jira/commands/vote/list.rb +1 -1
- data/lib/jira/constants.rb +1 -1
- data/lib/jira/core.rb +2 -2
- data/lib/jira/format.rb +2 -2
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 874d1feca2b584a69783f88d0001e695160e8d81
|
4
|
+
data.tar.gz: f4ad3bcdeaf2fdb0013521e248928f5b736f0704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a5d3352e86aee6c4178b5e72077e2ec5b077d9edcce645e2728b707218727e95aafb474d4f93c9aff4ce466df4c7d8cffa5749c7d3ab8fee13a4f71272a1b9
|
7
|
+
data.tar.gz: b45960e75e9707977c91aa38e22b81d065710e678e7caebbd7903f7494216eb95560d9c4e4c73459c17fffffe3d368ec7d04b89e39c5d842127ec216c9799b4f
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Ruby gem CLI tool used to manage JIRA workflows leveraging git
|
|
23
23
|
jira new # Creates a new ticket in JIRA and checks out the git branch
|
24
24
|
jira rename # Updates the summary of the input ticket
|
25
25
|
jira sprint # Lists sprint info
|
26
|
-
jira tickets
|
26
|
+
jira tickets [jql] # List the tickets of the input username (or jql)
|
27
27
|
jira transition # Transitions the input ticket to the next state
|
28
28
|
jira version # Displays the version
|
29
29
|
jira vote <command> # Commands for voting operations in JIRA
|
data/lib/jira/command.rb
CHANGED
@@ -22,11 +22,12 @@ module Jira
|
|
22
22
|
@auth_api ||= Jira::AuthAPI.new
|
23
23
|
end
|
24
24
|
|
25
|
+
# TODO: Move this to relevant subcommand Base
|
25
26
|
def body
|
26
27
|
@body ||= (
|
27
28
|
comment = io.ask("Leave a comment for ticket #{ticket}:").strip
|
28
|
-
comment = comment.gsub(/\@[a-zA-Z]+/,'[~\0]') || comment
|
29
|
-
comment.gsub('[~@','[~') || comment
|
29
|
+
comment = comment.gsub(/\@[a-zA-Z]+/, '[~\0]') || comment
|
30
|
+
comment.gsub('[~@', '[~') || comment
|
30
31
|
)
|
31
32
|
end
|
32
33
|
|
@@ -39,7 +40,7 @@ module Jira
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def render_table(header, rows)
|
42
|
-
puts TTY::Table.new(header, rows).render(:ascii, padding: [0,1])
|
43
|
+
puts TTY::Table.new(header, rows).render(:ascii, padding: [0, 1])
|
43
44
|
end
|
44
45
|
|
45
46
|
def truncate(string, limit=80)
|
data/lib/jira/commands/delete.rb
CHANGED
@@ -30,7 +30,7 @@ module Jira
|
|
30
30
|
failure: on_failure
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
private
|
34
34
|
|
35
35
|
def on_success
|
36
36
|
-> do
|
@@ -46,7 +46,7 @@ module Jira
|
|
46
46
|
def branches
|
47
47
|
branches = `git branch --list 2> /dev/null`.split(' ')
|
48
48
|
branches.delete("*")
|
49
|
-
branches.delete(
|
49
|
+
branches.delete(ticket.to_s)
|
50
50
|
branches
|
51
51
|
end
|
52
52
|
|
data/lib/jira/commands/link.rb
CHANGED
@@ -33,7 +33,7 @@ module Jira
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
private
|
37
37
|
|
38
38
|
def params
|
39
39
|
{
|
@@ -82,8 +82,7 @@ module Jira
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def invalid_ticket?
|
85
|
-
|
86
|
-
return false
|
85
|
+
!Jira::Core.ticket?(outward_ticket)
|
87
86
|
end
|
88
87
|
|
89
88
|
def metadata
|
data/lib/jira/commands/new.rb
CHANGED
@@ -19,7 +19,6 @@ module Jira
|
|
19
19
|
return if issue_type.empty?
|
20
20
|
return if assign_parent? && parent.empty?
|
21
21
|
return if summary.empty?
|
22
|
-
return if description.empty?
|
23
22
|
|
24
23
|
api.post 'issue',
|
25
24
|
params: params,
|
@@ -74,7 +73,7 @@ module Jira
|
|
74
73
|
end
|
75
74
|
|
76
75
|
def metadata
|
77
|
-
# TODO
|
76
|
+
# TODO: {} on 200 but jira error
|
78
77
|
@metadata ||= api.get('issue/createmeta')
|
79
78
|
end
|
80
79
|
|
@@ -141,11 +140,11 @@ module Jira
|
|
141
140
|
end
|
142
141
|
|
143
142
|
def summary
|
144
|
-
@summary ||= io.ask("Summary:")
|
143
|
+
@summary ||= io.ask("Summary:", default: '')
|
145
144
|
end
|
146
145
|
|
147
146
|
def description
|
148
|
-
@description ||= io.ask("Description:")
|
147
|
+
@description ||= io.ask("Description:", default: '')
|
149
148
|
end
|
150
149
|
|
151
150
|
end
|
data/lib/jira/commands/sprint.rb
CHANGED
@@ -1,42 +1,48 @@
|
|
1
1
|
module Jira
|
2
2
|
class CLI < Thor
|
3
3
|
|
4
|
-
desc "tickets", "List the tickets of the input
|
5
|
-
def tickets(
|
6
|
-
Command::Tickets.new(
|
4
|
+
desc "tickets [jql]", "List the tickets of the input jql"
|
5
|
+
def tickets(jql="assignee=#{Jira::Core.username}")
|
6
|
+
Command::Tickets.new(jql).run
|
7
7
|
end
|
8
|
+
|
8
9
|
end
|
9
10
|
|
10
11
|
module Command
|
11
12
|
class Tickets < Base
|
12
13
|
|
13
|
-
attr_accessor :
|
14
|
+
attr_accessor :jql
|
14
15
|
|
15
|
-
def initialize(
|
16
|
-
self.
|
16
|
+
def initialize(jql)
|
17
|
+
self.jql = jql
|
17
18
|
end
|
18
19
|
|
19
20
|
def run
|
20
|
-
return if
|
21
|
+
return if jql.empty?
|
21
22
|
return if metadata.empty?
|
23
|
+
puts "There are no tickets for jql=#{jql}." and return if rows.empty?
|
24
|
+
render_table(header, rows)
|
25
|
+
end
|
22
26
|
|
23
|
-
|
24
|
-
if !issues.nil? and issues.count > 0
|
25
|
-
issues.each do |issue|
|
26
|
-
ticket = issue['key']
|
27
|
+
private
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
else
|
32
|
-
puts "There are no tickets for username #{username}."
|
33
|
-
end
|
29
|
+
def header
|
30
|
+
[ 'Ticket', 'Assignee', 'Status', 'Summary']
|
34
31
|
end
|
35
32
|
|
36
|
-
|
33
|
+
def rows
|
34
|
+
metadata['issues'].map do |issue|
|
35
|
+
[
|
36
|
+
issue['key'],
|
37
|
+
issue['fields']['assignee']['name'] || 'Unassigned',
|
38
|
+
issue['fields']['status']['name'] || 'Unknown',
|
39
|
+
truncate(issue['fields']['summary'], 45)
|
40
|
+
]
|
41
|
+
end
|
42
|
+
end
|
37
43
|
|
38
44
|
def metadata
|
39
|
-
@metadata ||= api.get("search?jql
|
45
|
+
@metadata ||= api.get("search?jql=#{jql}")
|
40
46
|
end
|
41
47
|
|
42
48
|
end
|
data/lib/jira/constants.rb
CHANGED
data/lib/jira/core.rb
CHANGED
@@ -60,7 +60,7 @@ module Jira
|
|
60
60
|
if verbose
|
61
61
|
puts "#{Jira::Format.ticket(ticket)} is not a valid JIRA ticket."
|
62
62
|
end
|
63
|
-
|
63
|
+
false
|
64
64
|
end
|
65
65
|
|
66
66
|
### Relevant Paths
|
@@ -84,7 +84,7 @@ module Jira
|
|
84
84
|
|
85
85
|
def config
|
86
86
|
@config ||= (
|
87
|
-
raise InstallationException unless File.
|
87
|
+
raise InstallationException unless File.exist?(cli_path)
|
88
88
|
IniFile.load(cli_path, comment: '#', encoding: 'UTF-8')
|
89
89
|
)
|
90
90
|
end
|
data/lib/jira/format.rb
CHANGED
@@ -38,7 +38,7 @@ module Jira
|
|
38
38
|
|
39
39
|
def time(time)
|
40
40
|
"#{Thor::Shell::Color::BLUE}"\
|
41
|
-
"#{time.strftime(
|
41
|
+
"#{time.strftime('%l:%M%P on %b %d, %Y').strip}"\
|
42
42
|
"#{Thor::Shell::Color::CLEAR}"
|
43
43
|
end
|
44
44
|
|
@@ -59,7 +59,7 @@ module Jira
|
|
59
59
|
")"\
|
60
60
|
"#{Thor::Shell::Color::CLEAR}"
|
61
61
|
)
|
62
|
-
|
62
|
+
comment
|
63
63
|
end
|
64
64
|
|
65
65
|
def wrap(text)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Cheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -124,21 +124,7 @@ dependencies:
|
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: 2.0.2
|
127
|
-
-
|
128
|
-
name: pry
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
requirements:
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: '0'
|
141
|
-
description: CLI used to manage JIRA workflows leveraging git
|
127
|
+
description: Ruby CLI managing git-based JIRA workflows
|
142
128
|
email: darren@thanx.com
|
143
129
|
executables:
|
144
130
|
- jira
|