bl 0.0.11 → 0.0.12

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: d0a2525dc8ba16ce5e1649837a95eea5e5d70912
4
- data.tar.gz: c77b0e83418fe6c35ca14e752dd74b7d81aabf40
3
+ metadata.gz: 0defa22a48ce09f22352fe3e8af5eefe7f9339e5
4
+ data.tar.gz: 45a714fbce9975a36bca67776a30572d76c5b05e
5
5
  SHA512:
6
- metadata.gz: 021cbd06170c5adda3e807e9213edfb26a89427ffbf60574ea224d326072a917d61684d65ff41dd3aeb2487948d88401bb91f81172bf588cb45d30280d751685
7
- data.tar.gz: 06fe0e42865221d13d652bb9f532879dbf97b3086b4e04d3fdb6410832c3597eeaa8dd7acbce44850406df458378a5d027be299931e961103ef532930759fa4d
6
+ metadata.gz: 7ef100210997e744296acc4368dc59172510d3dca1440a705c07def410f0c45604f36e7f9ef169dbdbe4339a5e7b3bc4ed29938267b51ea2649b004f182769f3
7
+ data.tar.gz: c29419fabe1ac781400030f63a2d5997229adb3047da82743feb2a418e7c4b53513ebe99889cacb4880e31b1a72ae71408c7c4169ef286fee336fd3b01ecf4df
data/lib/bl.rb CHANGED
@@ -5,6 +5,7 @@ require 'thor'
5
5
  require 'bl/version'
6
6
  require 'bl/config'
7
7
  require 'bl/requestable'
8
+ require 'bl/type'
8
9
  require 'bl/category'
9
10
  require 'bl/milestone'
10
11
  require 'bl/cli'
data/lib/bl/category.rb CHANGED
@@ -15,6 +15,12 @@ module Bl
15
15
  end
16
16
  end
17
17
 
18
+ desc 'update ID NEW_NAME', 'update a category'
19
+ def update(id, name)
20
+ res = client.patch("projects/#{@config[:project_key]}/categories/#{id}", name: name)
21
+ puts "category updated: #{res.body.id}\t#{res.body.name}"
22
+ end
23
+
18
24
  desc 'delete CATEGORY_ID', 'delete categories'
19
25
  def delete(*ids)
20
26
  ids.each do |id|
data/lib/bl/cli.rb CHANGED
@@ -3,6 +3,20 @@ module Bl
3
3
  class CLI < Thor
4
4
  include Bl::Requestable
5
5
 
6
+ ISSUE_BASE_ATTRIBUTES = {
7
+ summary: :string,
8
+ description: :string,
9
+ statusId: :numeric,
10
+ resolutionId: :numeric,
11
+ dueDate: :string,
12
+ issueTypeId: :numeric,
13
+ categoryId: :array,
14
+ versionId: :array,
15
+ milestoneId: :array,
16
+ priorityId: :numeric,
17
+ assigneeId: :numeric
18
+ }
19
+
6
20
  def initialize(*)
7
21
  @config = Bl::Config.instance
8
22
  super
@@ -50,6 +64,7 @@ module Bl
50
64
  option :unassigned, type: :boolean
51
65
  option :today, type: :boolean
52
66
  option :overdue, type: :boolean
67
+ option :priority, type: :boolean
53
68
  def list
54
69
  opts = {}
55
70
  opts[:statusId] = [1, 2, 3] unless options[:all]
@@ -59,6 +74,10 @@ module Bl
59
74
  opts[:dueDateUntil] = Date.today.next.to_s
60
75
  end
61
76
  opts[:dueDateUntil] = Date.today.to_s if options[:overdue]
77
+ if options[:priority]
78
+ opts[:sort] = "priority"
79
+ opts[:order] = "asc"
80
+ end
62
81
  client.get('issues', opts).body.each do |i|
63
82
  puts [
64
83
  i.issueType.name,
@@ -110,15 +129,7 @@ module Bl
110
129
  end
111
130
 
112
131
  desc 'add *SUBJECTS', 'add issues'
113
- option :description, type: :string
114
- option :issueTypeId, type: :numeric
115
- option :categoryId, type: :array
116
- option :versionId, type: :array
117
- option :milestoneId, type: :array
118
- option :priorityId, type: :numeric
119
- # TODO: status
120
- # TODO: resolution
121
- option :assigneeId, type: :numeric
132
+ options ISSUE_BASE_ATTRIBUTES
122
133
  def add(*subjects)
123
134
  subjects.each do |s|
124
135
  base_options = {
@@ -136,16 +147,8 @@ module Bl
136
147
  end
137
148
 
138
149
  desc 'update *KEYS', 'update issues'
139
- option :summary, type: :string
140
- option :description, type: :string
141
- option :issueTypeId, type: :numeric
142
- option :categoryId, type: :array
143
- option :versionId, type: :array
144
- option :milestoneId, type: :array
145
- option :priorityId, type: :numeric
146
- # TODO: status
147
- # TODO: resolution
148
- option :assigneeId, type: :numeric
150
+ options ISSUE_BASE_ATTRIBUTES
151
+ option :comment, type: :string
149
152
  def update(*keys)
150
153
  keys.each do |k|
151
154
  res = client.patch("issues/#{k}", options.to_h)
@@ -232,6 +235,9 @@ module Bl
232
235
  end
233
236
  end
234
237
 
238
+ desc 'type SUBCOMMAND ...ARGS', 'manage types'
239
+ subcommand 'type', Type
240
+
235
241
  desc 'category SUBCOMMAND ...ARGS', 'manage categoryies'
236
242
  subcommand 'category', Category
237
243
 
data/lib/bl/type.rb ADDED
@@ -0,0 +1,39 @@
1
+ module Bl
2
+ class Type < Thor
3
+ include Bl::Requestable
4
+
5
+ def initialize(*)
6
+ @config = Bl::Config.instance
7
+ @url = "projects/#{@config[:project_key]}/issueTypes"
8
+ super
9
+ end
10
+
11
+ desc 'add NAMES', 'add types'
12
+ option :color, type: :string, required: true
13
+ def add(*names)
14
+ names.each do |name|
15
+ res = client.post(@url, name: name, color: options[:color])
16
+ puts "type added: #{res.body.id}\t#{res.body.name}\t#{res.body.color}"
17
+ end
18
+ end
19
+
20
+ desc 'update TYPE_IDS', 'update types'
21
+ option :name, type: :string
22
+ option :color, color: :color
23
+ def update(*ids)
24
+ ids.each do |id|
25
+ res = client.patch("#{@url}/#{id}", options)
26
+ puts "type updated: #{res.body.id}\t#{res.body.name}\t#{res.body.color}"
27
+ end
28
+ end
29
+
30
+ desc 'delete TYPE_IDS', 'delete types'
31
+ option :substituteIssueTypeId, type: :numeric, required: true
32
+ def delete(*ids)
33
+ ids.each do |id|
34
+ res = client.delete("#{@url}/#{id}", options)
35
+ puts "type deleted: #{res.body.id}\t#{res.body.name}\t#{res.body.color}"
36
+ end
37
+ end
38
+ end
39
+ end
data/lib/bl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bl
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
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.11
4
+ version: 0.0.12
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-05 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -132,6 +132,7 @@ files:
132
132
  - lib/bl/config.rb
133
133
  - lib/bl/milestone.rb
134
134
  - lib/bl/requestable.rb
135
+ - lib/bl/type.rb
135
136
  - lib/bl/version.rb
136
137
  homepage: https://github.com/sakihet/bl
137
138
  licenses: