bl 0.2.9 → 0.3.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: 316e16ff4b9d6ae6e7fd64b18fef473f9f678e0d
4
- data.tar.gz: 86b544fc9ff3f8b68093feb8992d27f003667432
3
+ metadata.gz: 2d14b4d88d718bd2ba52aecc05fff9217eaf18f9
4
+ data.tar.gz: 7c6821a484e9fbc61f5428be126b36b7a80157cd
5
5
  SHA512:
6
- metadata.gz: aa012450c9014c9678a7485728ac46b6589371e1eda0c73ebeb9297a16b55795467f3e0f26d0b44a3326a56112c012b9e0694e1b98e518c7512ee6d9c18c5181
7
- data.tar.gz: 80606f81a1a76c68b71fe1762f5475868f5ab7e01d0469fb8e2ea9f42cb74c0e1fd8bb0699038e7c51a89f60be62beba306f38eae71ef42e80501b13422de687
6
+ metadata.gz: 1a9fd5e7eece1e99d88839a79165e774f6e9d9be5d19b72c7475f194f09ca205ba6e7cce55889ab98efb0f4d4d79d5e51a0cc0f99bb2455e9d5533d09e2ecba0
7
+ data.tar.gz: 69f43e04fc8e97b0a562dabc7cb3e1639475244a845b508c707307739fddcd147baefb0122aa7fef2c6cc8b366861e88b78ce9f77e93e7bf461a8b18decbfa94
data/lib/bl.rb CHANGED
@@ -7,6 +7,7 @@ require 'bl/version'
7
7
  require 'bl/config'
8
8
  require 'bl/requestable'
9
9
  require 'bl/formatting'
10
+ require 'bl/space'
10
11
  require 'bl/type'
11
12
  require 'bl/category'
12
13
  require 'bl/milestone'
data/lib/bl/cli.rb CHANGED
@@ -49,29 +49,6 @@ module Bl
49
49
  assigneeId: :numeric
50
50
  }
51
51
 
52
- ACTIVITY_TYPES = {
53
- 1 => 'Issue Created',
54
- 2 => 'Issue Updated',
55
- 3 => 'Issue Commented',
56
- 4 => 'Issue Deleted',
57
- 5 => 'Wiki Created',
58
- 6 => 'Wiki Updated',
59
- 7 => 'Wiki Deleted',
60
- 8 => 'File Added',
61
- 9 => 'File Updated',
62
- 10 => 'File Deleted',
63
- 11 => 'SVN Committed',
64
- 12 => 'Git Pushed',
65
- 13 => 'Git Repository Created',
66
- 14 => 'Issue Multi Updated',
67
- 15 => 'Project User Added',
68
- 16 => 'Project User Deleted',
69
- 17 => 'Comment Notification Added',
70
- 18 => 'Pull Request Added',
71
- 19 => 'Pull Request Updated',
72
- 20 => 'Comment Added on Pull Request'
73
- }
74
-
75
52
  def initialize(*)
76
53
  @config = Bl::Config.instance
77
54
  super
@@ -100,12 +77,6 @@ module Bl
100
77
  end
101
78
  end
102
79
 
103
- desc 'space', 'show space info'
104
- def space
105
- res = client.get('space').body
106
- puts res.inspect
107
- end
108
-
109
80
  desc 'count', 'count issues'
110
81
  options ISSUES_PARAMS
111
82
  def count
@@ -262,12 +233,7 @@ module Bl
262
233
  options activityTypeId: :array, minId: :numeric, maxId: :numeric, count: :numeric, order: :string
263
234
  def user_activities(user_id)
264
235
  client.get("/users/#{user_id}/activities").body.each do |a|
265
- puts [
266
- ACTIVITY_TYPES[a.type],
267
- a.content.inspect,
268
- a.createdUser.name,
269
- a.created
270
- ].join("\t")
236
+ print_activity(a)
271
237
  end
272
238
  end
273
239
 
@@ -279,18 +245,6 @@ module Bl
279
245
  end
280
246
  end
281
247
 
282
- desc 'activities', 'list activities'
283
- def activities
284
- client.get('/space/activities').body.each do |a|
285
- puts [
286
- ACTIVITY_TYPES[a.type],
287
- a.content.inspect,
288
- a.createdUser.name,
289
- a.created
290
- ].join("\t")
291
- end
292
- end
293
-
294
248
  desc 'notifications', 'list notifications'
295
249
  def notifications
296
250
  client.get('notifications').body.each do |n|
@@ -318,6 +272,9 @@ module Bl
318
272
  end
319
273
  end
320
274
 
275
+ desc 'space SUBCOMMAND ...ARGS', ''
276
+ subcommand 'space', Space
277
+
321
278
  desc 'type SUBCOMMAND ...ARGS', 'manage types'
322
279
  subcommand 'type', Type
323
280
 
data/lib/bl/formatting.rb CHANGED
@@ -2,6 +2,29 @@ module Bl
2
2
  module Formatting
3
3
  module_function
4
4
 
5
+ ACTIVITY_TYPES = {
6
+ 1 => 'Issue Created',
7
+ 2 => 'Issue Updated',
8
+ 3 => 'Issue Commented',
9
+ 4 => 'Issue Deleted',
10
+ 5 => 'Wiki Created',
11
+ 6 => 'Wiki Updated',
12
+ 7 => 'Wiki Deleted',
13
+ 8 => 'File Added',
14
+ 9 => 'File Updated',
15
+ 10 => 'File Deleted',
16
+ 11 => 'SVN Committed',
17
+ 12 => 'Git Pushed',
18
+ 13 => 'Git Repository Created',
19
+ 14 => 'Issue Multi Updated',
20
+ 15 => 'Project User Added',
21
+ 16 => 'Project User Deleted',
22
+ 17 => 'Comment Notification Added',
23
+ 18 => 'Pull Request Added',
24
+ 19 => 'Pull Request Updated',
25
+ 20 => 'Comment Added on Pull Request'
26
+ }
27
+
5
28
  def colorize_type(name, color)
6
29
  Paint[name, :white, color]
7
30
  end
@@ -48,5 +71,14 @@ module Bl
48
71
  colorize_status(issue.status.id, issue.status.name)
49
72
  ].join("\t")
50
73
  end
74
+
75
+ def print_activity(a)
76
+ puts [
77
+ ACTIVITY_TYPES[a.type],
78
+ a.content.inspect,
79
+ a.createdUser.name,
80
+ a.created
81
+ ].join("\t")
82
+ end
51
83
  end
52
84
  end
data/lib/bl/space.rb ADDED
@@ -0,0 +1,46 @@
1
+ module Bl
2
+ class Space < Thor
3
+ include Bl::Requestable
4
+ include Bl::Formatting
5
+
6
+ def initialize(*)
7
+ @config = Bl::Config.instance
8
+ super
9
+ end
10
+
11
+ desc 'info', 'show space info'
12
+ def info
13
+ puts client.get('space').body.inspect
14
+ end
15
+
16
+ desc 'activities', 'show space activities'
17
+ def activities
18
+ client.get('space/activities').body.each do |a|
19
+ print_activity(a)
20
+ end
21
+ end
22
+
23
+ desc 'image', 'get space image file'
24
+ def image
25
+ body = client.get('space/image').body
26
+ ::File.open(body.filename, "wb") {|f| f.write(body.content)}
27
+ puts "#{body.filename} generated."
28
+ end
29
+
30
+ desc 'get-notification', 'get space notification'
31
+ def get_notification
32
+ puts client.get('space/notification').body.content
33
+ end
34
+
35
+ desc 'update-notification CONTENT', 'update space notification'
36
+ def update_notification(content)
37
+ client.put('space/notification', content: content)
38
+ end
39
+
40
+ desc 'disk-usage', 'get space disk usage'
41
+ def disk_usage
42
+ capacity = client.get('space/diskUsage').body.capacity
43
+ puts "capacity: #{capacity}"
44
+ end
45
+ end
46
+ end
data/lib/bl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bl
2
- VERSION = '0.2.9'.freeze
2
+ VERSION = '0.3.0'.freeze
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.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - saki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-27 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -151,6 +151,7 @@ files:
151
151
  - lib/bl/project.rb
152
152
  - lib/bl/recent.rb
153
153
  - lib/bl/requestable.rb
154
+ - lib/bl/space.rb
154
155
  - lib/bl/type.rb
155
156
  - lib/bl/version.rb
156
157
  - lib/bl/wiki.rb