jirack 0.1.2 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d47921cb2392fe3dcef024e1f030888e4bfde8e4
4
- data.tar.gz: f22e6ce18ace8e5f0095fae321b0cbc1617d9623
3
+ metadata.gz: a2bcac42459a795dec1c3d02d68bf2084f9858ff
4
+ data.tar.gz: 857462e79a8c78f02fdd0fabd55f743462869d93
5
5
  SHA512:
6
- metadata.gz: 4b9c334f40d443f139c7f3f0485347beb3941c0cea3252b534abb0f5bdb35bc3befa92026829bd33ab316a640ce5a7d65708bc7a3178856ad32d854b2b3aa521
7
- data.tar.gz: e3f4124321991e1da271f8195eb3e77aaacbfdf594779e5ec2d66c8845b619c885d8e0443c8b93bb8653d5c17625dd4e8f7df279947381d712f3d8f2f16dc6b0
6
+ metadata.gz: d0a15d071c942a28652032954146ad41adc8326c7088e741fd8ace12cfc98e62471cbdfe78597a3dc7de9ddf93a8f4a37385dfd7f296e094f4e5cc629588f0fa
7
+ data.tar.gz: 0d1226b89dcbb396774b768a3f8dd8730d457e5ea6cf62461b5143d0c9bc294232596d0bda0f4a19a9c951b7245de2ae44acb630c7d0a28d6b1f168724e3a5f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jirack (0.1.2)
4
+ jirack (0.2.0)
5
5
  jira-ruby
6
6
  launchy
7
7
  slack-incoming-webhooks
data/README.md CHANGED
@@ -28,6 +28,10 @@ install it yourself as:
28
28
 
29
29
  $ jirack list --sum-point
30
30
 
31
+
32
+ 未割り当てのissueを確認する。
33
+
34
+ $ jirack list --unassign
31
35
 
32
36
  チケットをステータスを前に進める。(ex. チケット9999を次のステータスにする)
33
37
  `-m message`でslackにメッセージを通知する。
@@ -55,6 +59,17 @@ slackにメッセージだけを送る。(ex. チケット9999についてのメ
55
59
  $ jirack open 9999
56
60
 
57
61
 
62
+ チケットを自分にアサインしたい
63
+
64
+ $ jirack assign 9999
65
+
66
+
67
+ 分からなくなったら、
68
+
69
+ $ jirack help
70
+ $ jirack help list
71
+
72
+
58
73
  ## Development
59
74
 
60
75
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -35,26 +35,32 @@ module Jirack
35
35
  end
36
36
 
37
37
  desc 'list', 'show your active issue'
38
- method_option 'sum-point', type: :boolean, desc: 'show your all issue point'
38
+ method_option 'unassign', type: :boolean, aliases: '-u', desc: 'show your all issue point'
39
+ method_option 'sum-point', type: :boolean, aliases: '-n', desc: 'show your all issue point'
39
40
  def list
40
41
  cred = Jirack::Credential.new
41
42
  client = cred.jira_client
42
43
 
43
44
  active_sprint = active_sprint(client, project_board(client, cred.project_name)['id'].to_i)
44
45
 
45
- if options.key?('sum-point')
46
- sum_points = active_sprint_issue(client, cred.project_name, active_sprint['name']).inject(0.0) {|sum, issue| sum + issue.points }
46
+ if options.key?('unassign')
47
+ puts "#{ active_sprint['name'] } unassign issues: "
48
+ active_unassign_issue(client, cred.project_name, active_sprint['name']).each do |issue|
49
+ puts "#{ issue.key }: #{ issue.summary }(#{issue.id}) [#{ issue.points }] #{ issue.status.name } "
50
+ end
51
+ elsif options.key?('sum-point')
52
+ sum_points = active_assign_issue(client, cred.project_name, active_sprint['name']).inject(0.0) {|sum, issue| sum + issue.points }
47
53
  puts "#{ active_sprint['name'] } points: #{ sum_points }"
48
54
  else
49
55
  puts "#{ active_sprint['name'] } issues: "
50
- active_sprint_issue(client, cred.project_name, active_sprint['name']).each do |issue|
56
+ active_assign_issue(client, cred.project_name, active_sprint['name']).each do |issue|
51
57
  puts "#{ issue.key }: #{ issue.summary }(#{issue.id}) [#{ issue.points }] #{ issue.status.name } "
52
58
  end
53
59
  end
54
60
  end
55
61
 
56
62
  desc 'forward issue_number', 'forward issue status'
57
- method_option 'message', :aliases => '-m', desc: 'notify slack message'
63
+ method_option 'message', aliases: '-m', desc: 'notify slack message'
58
64
  def forward(issue_number)
59
65
  cred = Jirack::Credential.new
60
66
  client = cred.jira_client
@@ -126,6 +132,19 @@ module Jirack
126
132
  issue = client.Issue.find("#{ cred.project_name }-#{ issue_number }")
127
133
 
128
134
  Launchy.open issue_url(issue)
135
+
136
+ end
137
+
138
+ desc 'assign issue_number', 'assign issue to you'
139
+ def assign(issue_number)
140
+ cred = Jirack::Credential.new
141
+ client = cred.jira_client
142
+
143
+ issue = client.Issue.find("#{ cred.project_name }-#{ issue_number }")
144
+
145
+ myself = JIRA::Resource::UserFactory.new(client).myself
146
+
147
+ client.put("/rest/api/2/issue/#{ issue.key }/assignee", { name: myself.name }.to_json)
129
148
  end
130
149
 
131
150
  private
@@ -138,10 +157,14 @@ module Jirack
138
157
  client.Agile.get_sprints(board_id, state: 'active')['values'].first
139
158
  end
140
159
 
141
- def active_sprint_issue(client, project_name, sprint_name)
160
+ def active_assign_issue(client, project_name, sprint_name)
142
161
  JIRA::Resource::Issue.jql(client, "project=\"#{ project_name }\" AND assignee = currentuser() AND cf[10007] = \"#{ sprint_name }\"")
143
162
  end
144
163
 
164
+ def active_unassign_issue(client, project_name, sprint_name)
165
+ JIRA::Resource::Issue.jql(client, "project=\"#{ project_name }\" AND assignee = NULL AND cf[10007] = \"#{ sprint_name }\"")
166
+ end
167
+
145
168
  def issue_url(issue)
146
169
  uri = URI.parse(issue.self)
147
170
  "https://#{ uri.host }/browse/#{ issue.key }"
@@ -1,3 +1,3 @@
1
1
  module Jirack
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jirack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rhythm191