bl 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05929705cfeb4bb0b2d8081fe236ff73d00a55d4
4
- data.tar.gz: 514ae353673887ab472968aebe17ea2dc8aba93a
3
+ metadata.gz: f5b2c242ce34ece8e38c7828ab5a25aac2f7464b
4
+ data.tar.gz: 295b6de216301f8397e7974f2f5402dfc3cd6de1
5
5
  SHA512:
6
- metadata.gz: 9e6e414c940720b6b2f5d5f257fedc5c8732d9535a9ca9e440c765fbf315280480b2bc619263d306c722ffa669d2c4d856b13e854268a8bef4a5390af9d9e37c
7
- data.tar.gz: 076459e8c629cda6d62f827e3b63058d516837a2b05016e3d4393c78dc0686531150f7e37cedd83e8d44d097af643f224d2eb46f4d685f1214c2c3f7b780bbf8
6
+ metadata.gz: f93bb48ebebc72ac568727707f205c779540929424baceab6c9154c0711b052de57c19761e181255af3470ca5887550565d04b6d28faeabacf7a790c7ecac480
7
+ data.tar.gz: 3cac2fea44ac3f4f8d704b633a848220a008993ef7f462b2831a85c91e5a3996e4bcaa487b32dbafafee97e9462419be92ead97220f0570584b7af23a5916da4
data/README.md CHANGED
@@ -13,17 +13,25 @@ bl uses `~/.bl.yml` for configuration.
13
13
  bl init
14
14
  $EDITOR ~/.bl.yml
15
15
 
16
+ ### .bl.yml Parameters
17
+
18
+ :space_id: '***' # your backlog space id
19
+ :api_key: '***' # your backlog api key
20
+ :project_key: '***' # your backlog project key
21
+
16
22
  ## Usage
17
23
 
18
24
  bl activities # list activities
19
- bl add SUBJECT # add an issue
25
+ bl add *SUBJECTS # add issues
26
+ bl browse KEY # browse an issue
20
27
  bl categories # list issue categories
21
- bl close KEY # close an issue
28
+ bl close *KEYS # close issues
22
29
  bl config # show config
23
30
  bl count # count issues
24
31
  bl help [COMMAND] # Describe available commands or one specific command
25
32
  bl init # initialize a default config file
26
33
  bl list # list issues
34
+ bl milestones # list milestones
27
35
  bl priorities # list priorities
28
36
  bl projects # list projects
29
37
  bl resolutions # list resolutions
@@ -31,14 +39,20 @@ bl uses `~/.bl.yml` for configuration.
31
39
  bl show KEY # show an issue's details
32
40
  bl statuses # list statuses
33
41
  bl types # list issue types
42
+ bl update KEY # update an issue
34
43
  bl users # list space users
35
44
  bl version # show version
36
45
 
37
- ## Development
46
+ ### Example
47
+
48
+ update unassigned issues
49
+
50
+ bl list --unassigned | awk '{print $2}' | xargs -L 1 bl update --assigneeId 12345
51
+
52
+ add multi issues on list.txt
38
53
 
39
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec bl` to use the gem in this directory, ignoring other installed copies of this gem.
54
+ cat list.txt | xargs -I {} bl add {}
40
55
 
41
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
56
 
43
57
  ## Contributing
44
58
 
data/lib/bl.rb CHANGED
@@ -4,5 +4,6 @@ require 'bl/version'
4
4
  require 'yaml'
5
5
  require 'pp'
6
6
  require 'bl/cli'
7
+ require 'date'
7
8
 
8
9
  Bl::CLI.start(ARGV)
@@ -50,14 +50,19 @@ module Bl
50
50
 
51
51
  desc 'list', 'list issues'
52
52
  option :all, type: :boolean
53
- option :assigneeId, type: :array
53
+ option :unassigned, type: :boolean
54
+ option :today, type: :boolean
55
+ option :overdue, type: :boolean
54
56
  def list
55
57
  opts = {}
56
- if options[:all]
57
- else
58
- opts[:statusId] = [1, 2, 3]
58
+ opts[:statusId] = [1, 2, 3] unless options[:all]
59
+ opts[:assigneeId] = [-1] if options[:unassigned]
60
+ if options[:today]
61
+ opts[:dueDateSince] = Date.today.to_s
62
+ opts[:dueDateUntil] = Date.today.next.to_s
59
63
  end
60
- @client.get('issues', opts.merge(options)).body.each do |i|
64
+ opts[:dueDateUntil] = Date.today.to_s
65
+ @client.get('issues', opts).body.each do |i|
61
66
  puts [
62
67
  i.issueType.name,
63
68
  i.issueKey,
@@ -133,7 +138,7 @@ module Bl
133
138
  end
134
139
  end
135
140
 
136
- desc 'update KEY', 'update an issue'
141
+ desc 'update *KEYS', 'update issues'
137
142
  option :summary, type: :string
138
143
  option :description, type: :string
139
144
  option :issueTypeId, type: :numeric
@@ -144,9 +149,11 @@ module Bl
144
149
  # TODO: status
145
150
  # TODO: resolution
146
151
  option :assigneeId, type: :numeric
147
- def update(key)
148
- res = @client.patch("issues/#{key}", options.to_h)
149
- puts "issue updated: #{res.body.issueKey}\t#{res.body.summary}"
152
+ def update(*keys)
153
+ keys.each do |k|
154
+ res = @client.patch("issues/#{k}", options.to_h)
155
+ puts "issue updated: #{res.body.issueKey}\t#{res.body.summary}"
156
+ end
150
157
  end
151
158
 
152
159
  desc 'close *KEYS', 'close issues'
@@ -227,5 +234,19 @@ module Bl
227
234
  puts a.pretty_inspect
228
235
  end
229
236
  end
237
+
238
+ desc 'project-status PROJECT_ID', 'show project status'
239
+ def project_status(pid)
240
+ all_issues_count = @client.get('issues/count', projectId: [pid]).body.count
241
+ open_issues_count = @client.get('issues/count', projectId: [pid], statusId: [1]).body.count
242
+ in_progress_issues_count = @client.get('issues/count', projectId: [pid], statusId: [2]).body.count
243
+ resolved_issues_count = @client.get('issues/count', projectId: [pid], statusId: [3]).body.count
244
+ closed_issues_count = @client.get('issues/count', projectId: [pid], statusId: [4]).body.count
245
+ puts "#{closed_issues_count} / #{all_issues_count}"
246
+ puts "open: #{open_issues_count}"
247
+ puts "in progress: #{in_progress_issues_count}"
248
+ puts "resolved: #{resolved_issues_count}"
249
+ puts "closed: #{closed_issues_count}"
250
+ end
230
251
  end
231
252
  end
@@ -1,3 +1,3 @@
1
1
  module Bl
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - saki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-01 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor