terjira 0.2.6 → 0.2.7
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 +2 -0
- data/lib/terjira/client/issue.rb +4 -0
- data/lib/terjira/client/jql_builder.rb +28 -2
- data/lib/terjira/issue_cli.rb +6 -0
- data/lib/terjira/presenters/common_presenter.rb +1 -1
- data/lib/terjira/presenters/issue_presenter.rb +13 -14
- data/lib/terjira/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbde3ec56e09285e05737a7fa9b04bb696f6a343
|
4
|
+
data.tar.gz: 1357fd83a6d0d4aafbc3d8900852a651d12558bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9802b1f64d38f141695c02566f9c4c1f7adee68f3980e69515e1bf7b7ecd933c0782006c26c1722d0a267b5118b8d5146c8ba6c2430df14fc994cf935cd495
|
7
|
+
data.tar.gz: 433252922de158d3033c3a2441200c644f73c25c36e047c6d286556b5a44c4e9ae1c9a7a18d722e05d6385ef3e4ba81dac94eaba706fec8f6e03c53069f7f1d1
|
data/README.md
CHANGED
@@ -61,6 +61,7 @@ Issue:
|
|
61
61
|
jira issue jql "[QUERY]" # Search issues with JQL
|
62
62
|
# ex)
|
63
63
|
# jira issue jql "project = 'TEST' AND summary ~ 'authentication'"
|
64
|
+
jira issue search "[SUMMARY]" # Search for an issues by summary
|
64
65
|
jira issue [ISSUE_KEY] # Show detail of the issue
|
65
66
|
jira issue assign [ISSUE_KEY] ([ASSIGNEE]) # Assign the issue to user
|
66
67
|
jira issue comment [ISSUE_KEY] # Write comment on the issue
|
@@ -76,6 +77,7 @@ Issue:
|
|
76
77
|
## Todo
|
77
78
|
**Contributions are welcome!**
|
78
79
|
- [x] Add JQL command for find issues
|
80
|
+
- [x] Search issues by keyword
|
79
81
|
- [ ] Manage worklog and estimate of issues
|
80
82
|
- [ ] Manage component and version of issues
|
81
83
|
- [ ] Track history of transitions
|
data/lib/terjira/client/issue.rb
CHANGED
@@ -1,13 +1,26 @@
|
|
1
1
|
module Terjira
|
2
2
|
module Client
|
3
3
|
module JQLBuilder
|
4
|
-
|
4
|
+
STRICT_KEYS = %w(sprint assignee issuetype priority project status statusCategory).freeze
|
5
|
+
SEARCH_KEYS = %w(summary description).freeze
|
5
6
|
|
6
7
|
def build_jql(options = {})
|
8
|
+
search = options.select { |k, _v| SEARCH_KEYS.include?(k.to_s) }
|
9
|
+
strict = options.select { |k, _v| STRICT_KEYS.include?(k.to_s) }
|
10
|
+
|
11
|
+
query = [strict_matching(strict), search_matching(search)]
|
12
|
+
.reject(&:blank?).join(' AND ')
|
13
|
+
|
14
|
+
query
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def strict_matching(options = {})
|
7
20
|
q_options = options.inject({}) do |memo, (k, v)|
|
8
21
|
memo[k.to_s] = v
|
9
22
|
memo
|
10
|
-
end.slice(*
|
23
|
+
end.slice(*STRICT_KEYS)
|
11
24
|
|
12
25
|
query = q_options.map do |key, value|
|
13
26
|
if value.is_a? Array
|
@@ -24,6 +37,19 @@ module Terjira
|
|
24
37
|
|
25
38
|
query
|
26
39
|
end
|
40
|
+
|
41
|
+
def search_matching(options = {})
|
42
|
+
q_options = options.inject({}) do |memo, (k, v)|
|
43
|
+
memo[k.to_s] = v
|
44
|
+
memo
|
45
|
+
end.slice(*SEARCH_KEYS)
|
46
|
+
|
47
|
+
query = q_options.map do |key, value|
|
48
|
+
"#{key}~\"#{value.key_value}\""
|
49
|
+
end.reject(&:blank?).join(' AND ')
|
50
|
+
|
51
|
+
query
|
52
|
+
end
|
27
53
|
end
|
28
54
|
end
|
29
55
|
end
|
data/lib/terjira/issue_cli.rb
CHANGED
@@ -109,6 +109,12 @@ module Terjira
|
|
109
109
|
show(issue.key_value)
|
110
110
|
end
|
111
111
|
|
112
|
+
desc 'search [SUMMARY]', 'Search for issues by summary'
|
113
|
+
def search(*keys)
|
114
|
+
search_term = client_class.search(summary: keys[0])
|
115
|
+
render_issues(search_term)
|
116
|
+
end
|
117
|
+
|
112
118
|
desc 'trans [ISSUE_KEY] ([STATUS])', 'Do transition'
|
113
119
|
jira_options :comment, :assignee, :resolution
|
114
120
|
def trans(*args)
|
@@ -62,32 +62,31 @@ module Terjira
|
|
62
62
|
def issue_detail_template
|
63
63
|
%{<%= bold(issue.key) + ' in ' + issue.project.name %>
|
64
64
|
|
65
|
-
<%=
|
65
|
+
<%= bold(issue.summary) %>
|
66
66
|
|
67
|
-
|
67
|
+
Type: <%= colorize_issue_type(issue.issuetype) %>\s\sStatus: <%= colorize_issue_stastus(issue.status) %>\s\sPriority: <%= colorize_priority(issue.priority, title: true) %>
|
68
68
|
<% if issue.parent.nil? -%>
|
69
69
|
|
70
|
-
|
70
|
+
Epic: <%= issue.try(:epic).try(:key) %> <%= issue.try(:epic).try(:name) || dim_none %>
|
71
71
|
<% end -%>
|
72
72
|
<% if issue.try(:parent) && issue.epic.nil? -%>
|
73
|
-
|
73
|
+
Parent: <%= issue.parent.key %>
|
74
74
|
<% end %>
|
75
75
|
<% if issue.try(:sprint) -%>
|
76
|
-
|
76
|
+
Sprint: <%= colorize_sprint_state(issue.try(:sprint).try(:state)) %> <%= issue.try(:sprint).try(:id) %>. <%= issue.try(:sprint).try(:name) %>
|
77
77
|
<% end -%>
|
78
78
|
<% if estimate = issue_estimate(issue) -%>
|
79
79
|
|
80
80
|
<%= estimate[0] %>: <%= estimate[1] %>
|
81
81
|
<% end -%>
|
82
82
|
|
83
|
-
|
84
|
-
|
83
|
+
Assignee: <%= username(issue.assignee) %>
|
84
|
+
Reporter: <%= username(issue.reporter) %>
|
85
85
|
|
86
|
-
<%=
|
87
|
-
<%= issue.description || dim_none %>
|
86
|
+
<%= issue.description || dim("No description") %>
|
88
87
|
<% if issue.try(:environment) -%>
|
89
88
|
|
90
|
-
<%=
|
89
|
+
<%= Environment %>:
|
91
90
|
<%= issue.environment %>
|
92
91
|
<% end -%>
|
93
92
|
<% if issue.try(:attachment).present? -%>
|
@@ -116,7 +115,7 @@ module Terjira
|
|
116
115
|
"""
|
117
116
|
<% remain_comments = issue.comments -%>
|
118
117
|
<% visiable_comments = remain_comments.pop(COMMENTS_SIZE) -%>
|
119
|
-
|
118
|
+
Comments:
|
120
119
|
<% if visiable_comments.empty? -%>
|
121
120
|
<%= dim_none %>
|
122
121
|
<% elsif remain_comments.size != 0 -%>
|
@@ -185,15 +184,15 @@ module Terjira
|
|
185
184
|
def issue_estimate(issue)
|
186
185
|
field = Client::Field.story_points
|
187
186
|
story_points = issue.try(field.key) if field.respond_to? :key
|
188
|
-
return [
|
187
|
+
return ['Story Points', story_points] if story_points
|
189
188
|
|
190
189
|
return unless issue.try(:timetracking).is_a? Hash
|
191
190
|
|
192
191
|
if origin = issue.timetracking['originalEstimate']
|
193
192
|
remain = issue.timetracking['remainingEstimate']
|
194
|
-
[
|
193
|
+
['Estimate', "#{remain} / #{origin}"]
|
195
194
|
else
|
196
|
-
[
|
195
|
+
['Estimate', dim_none]
|
197
196
|
end
|
198
197
|
end
|
199
198
|
|
data/lib/terjira/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terjira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaehyun Shin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|