bl 0.0.2 → 0.0.3
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/.gitignore +1 -0
- data/bl.gemspec +1 -0
- data/lib/bl.rb +55 -7
- data/lib/bl/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a54927f3323ab187713dd1c4b984cf1e6a6b923
|
4
|
+
data.tar.gz: 47e8ffd921b65ed1ed6d3af87fa4e79cce75a4bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9514c95c268e5a8663e8484788f690357e6dfc66355852dfb4cabea200b71dd854c49610ca71a778a1db6df68edae3fdbc5598f42e9ae0e5117e8524fa36fb75
|
7
|
+
data.tar.gz: 9f61ad6e461c2d5d171b7637bdf4823532eaf2beafe25b8078377f8fb4cac764981bd30399513fb48438e226c8b33dce21c6ff3ddcfdef244439c9266698c047
|
data/.gitignore
CHANGED
data/bl.gemspec
CHANGED
data/lib/bl.rb
CHANGED
@@ -2,6 +2,7 @@ require "thor"
|
|
2
2
|
require "backlog_kit"
|
3
3
|
require "bl/version"
|
4
4
|
require "yaml"
|
5
|
+
require "pry"
|
5
6
|
|
6
7
|
module Bl
|
7
8
|
CONFIG_FILE = '.bl.yml'
|
@@ -27,7 +28,13 @@ module Bl
|
|
27
28
|
else
|
28
29
|
config = {
|
29
30
|
space_id: '',
|
30
|
-
api_key: ''
|
31
|
+
api_key: '',
|
32
|
+
project_key: '',
|
33
|
+
issue: {
|
34
|
+
default_project_id: '',
|
35
|
+
default_issue_type_id: '',
|
36
|
+
default_priority_id: ''
|
37
|
+
}
|
31
38
|
}
|
32
39
|
f = File.new(filename, 'w')
|
33
40
|
f.write(config.to_yaml)
|
@@ -35,9 +42,20 @@ module Bl
|
|
35
42
|
end
|
36
43
|
end
|
37
44
|
|
45
|
+
desc "count", "count issues"
|
46
|
+
def count
|
47
|
+
puts Bl::CLI.client.get('issues/count').body.count
|
48
|
+
end
|
49
|
+
|
38
50
|
desc "list", "list issues"
|
51
|
+
option :all, type: :boolean
|
39
52
|
def list
|
40
|
-
|
53
|
+
if options[:all]
|
54
|
+
issues = Bl::CLI.client.get('issues').body
|
55
|
+
else
|
56
|
+
issues = Bl::CLI.client.get('issues', statusId: [1, 2, 3]).body
|
57
|
+
end
|
58
|
+
issues.each do |i|
|
41
59
|
puts [
|
42
60
|
i.issueType.name,
|
43
61
|
i.issueKey,
|
@@ -47,15 +65,17 @@ module Bl
|
|
47
65
|
i.dueDate,
|
48
66
|
i.updated,
|
49
67
|
i.createdUser.name,
|
50
|
-
i.assignee
|
68
|
+
i.assignee&.name,
|
51
69
|
i.status.name
|
52
70
|
].join("\t")
|
53
71
|
end
|
54
72
|
end
|
55
73
|
|
56
|
-
desc "search
|
57
|
-
|
58
|
-
|
74
|
+
desc "search", "search issues"
|
75
|
+
option :keyword
|
76
|
+
option :categoryId, type: :array
|
77
|
+
def search
|
78
|
+
issues = Bl::CLI.client.get('issues', options.to_h).body.each do |i|
|
59
79
|
puts [
|
60
80
|
i.issueType.name,
|
61
81
|
i.issueKey,
|
@@ -65,7 +85,7 @@ module Bl
|
|
65
85
|
i.dueDate,
|
66
86
|
i.updated,
|
67
87
|
i.createdUser.name,
|
68
|
-
i.assignee
|
88
|
+
i.assignee&.name,
|
69
89
|
i.status.name
|
70
90
|
].join("\t")
|
71
91
|
end
|
@@ -78,9 +98,23 @@ module Bl
|
|
78
98
|
puts str
|
79
99
|
end
|
80
100
|
|
101
|
+
desc "add SUBJECT", "add an issue"
|
102
|
+
def add(subject)
|
103
|
+
@config = YAML.load_file(File.join(Dir.home, CONFIG_FILE))
|
104
|
+
Bl::CLI.client.post(
|
105
|
+
"issues",
|
106
|
+
projectId: @config[:issue][:default_project_id].to_i,
|
107
|
+
summary: subject,
|
108
|
+
issueTypeId: @config[:issue][:default_issue_type_id].to_i,
|
109
|
+
priorityId: @config[:issue][:default_priority_id].to_i
|
110
|
+
)
|
111
|
+
end
|
112
|
+
|
81
113
|
desc "close KEY", "close an issue"
|
82
114
|
def close(key)
|
83
115
|
Bl::CLI.client.patch("issues/#{key}", statusId: 4)
|
116
|
+
issue = Bl::CLI.client.get("issues/#{key}")
|
117
|
+
puts "issue closed: #{issue.body.issueKey}\t#{issue.body.summary}"
|
84
118
|
end
|
85
119
|
|
86
120
|
desc "projects", "list projects"
|
@@ -97,6 +131,13 @@ module Bl
|
|
97
131
|
end
|
98
132
|
end
|
99
133
|
|
134
|
+
desc "categories", "list issue categories"
|
135
|
+
def categories(pkey)
|
136
|
+
categories = Bl::CLI.client.get("projects/#{pkey}/categories").body.each do |c|
|
137
|
+
puts [c.id, c.name].join("\t")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
100
141
|
desc "statuses", "list statuses"
|
101
142
|
def statuses
|
102
143
|
statuses = Bl::CLI.client.get("statuses").body.each do |s|
|
@@ -111,6 +152,13 @@ module Bl
|
|
111
152
|
end
|
112
153
|
end
|
113
154
|
|
155
|
+
desc "resolutions", "list resolutions"
|
156
|
+
def resolutions
|
157
|
+
resolutions = Bl::CLI.client.get("resolutions").body.each do |r|
|
158
|
+
puts [r.id, r.name].join("\t")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
114
162
|
def self.client
|
115
163
|
@config = YAML.load_file(File.join(Dir.home, CONFIG_FILE))
|
116
164
|
BacklogKit::Client.new(
|
data/lib/bl/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.10.3
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.10.3
|
83
97
|
description: bl is a command line tool for Backlog.
|
84
98
|
email:
|
85
99
|
- sakihet@gmail.com
|