bl 0.0.5 → 0.0.6

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.
Files changed (9) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -18
  3. data/Rakefile +8 -5
  4. data/bin/console +3 -3
  5. data/bl.gemspec +16 -15
  6. data/exe/bl +1 -1
  7. data/lib/bl.rb +62 -33
  8. data/lib/bl/version.rb +1 -1
  9. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cda22e7125049261f92308e24b067e982ae3b23f
4
- data.tar.gz: 4ea9c3991978ea61fe507c54660cfdf110d639fa
3
+ metadata.gz: a4849acf6c4e7e7b614fa57e7bb68c219737dda0
4
+ data.tar.gz: cb738cbabe30720d90087352a0e002ebc1a21b2c
5
5
  SHA512:
6
- metadata.gz: 2e9f49cd3b42bddd0e075c0d3901b6f5548665009ab96f0beb1badcd2dc644c0cf8973bbad435d7d691e66182e0bad9d405ced8062040d0cf302edb1edc11394
7
- data.tar.gz: dbca7a3c3ab51e031ccc9bb9cd2764e6d204c07eab5a9b407d1cad55d6a03ba042199bcaee556be232af87749b49b9d7a25ce9d6113740424d1011e22c6cb48d
6
+ metadata.gz: 11df83881fe18fa616880a4c37c15dc4c9c03c3e4caf84557e9e6c81be474e637b9412df0ccd1b71a0b3b23c305d9472389232eb729295891a564185d4602888
7
+ data.tar.gz: 1ca37ce7e5f1a4e5571faa981bc5c2b73dd6e924dbe2aa3ea1122b194b2a41e4308eff0408df73654973d4ea502e343986fafb8cd760ebb444dfb430ab937052
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # bl
2
2
 
3
- bl is a command line tool for Backlog[http://www.backlog.jp/].
3
+ bl is a command line tool for [Backlog](http://www.backlog.jp/).
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,27 +8,31 @@ bl is a command line tool for Backlog[http://www.backlog.jp/].
8
8
 
9
9
  ## Configuration
10
10
 
11
+ bl uses `~/.bl.yml` for configuration.
12
+
11
13
  bl init
12
14
  $EDITOR ~/.bl.yml
13
15
 
14
16
  ## Usage
15
17
 
16
- bl add SUBJECT # add an issue
17
- bl categories # list issue categories
18
- bl close KEY # close an issue
19
- bl config # show config
20
- bl count # count issues
21
- bl help [COMMAND] # Describe available commands or one specific command
22
- bl init # initialize a default config file
23
- bl list # list issues
24
- bl priorities # list priorities
25
- bl projects # list projects
26
- bl resolutions # list resolutions
27
- bl search # search issues
28
- bl show KEY # show an issue's details
29
- bl statuses # list statuses
30
- bl types PROJECT_KEY # list issue types in the project
31
- bl version # show version
18
+ bl activities # list activities
19
+ bl add SUBJECT # add an issue
20
+ bl categories # list issue categories
21
+ bl close KEY # close an issue
22
+ bl config # show config
23
+ bl count # count issues
24
+ bl help [COMMAND] # Describe available commands or one specific command
25
+ bl init # initialize a default config file
26
+ bl list # list issues
27
+ bl priorities # list priorities
28
+ bl projects # list projects
29
+ bl resolutions # list resolutions
30
+ bl search # search issues
31
+ bl show KEY # show an issue's details
32
+ bl statuses # list statuses
33
+ bl types # list issue types
34
+ bl users # list space users
35
+ bl version # show version
32
36
 
33
37
  ## Development
34
38
 
@@ -42,4 +46,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/sakihe
42
46
 
43
47
  ## License
44
48
 
45
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
49
+ [MIT](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,10 +1,13 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rubocop/rake_task'
3
4
 
4
5
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
6
+ t.libs << 'test'
7
+ t.libs << 'lib'
7
8
  t.test_files = FileList['test/**/*_test.rb']
8
9
  end
9
10
 
10
- task :default => :test
11
+ task default: :test
12
+
13
+ RuboCop::RakeTask.new
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "bl"
3
+ require 'bundler/setup'
4
+ require 'bl'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "bl"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
data/bl.gemspec CHANGED
@@ -4,25 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'bl/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "bl"
7
+ spec.name = 'bl'
8
8
  spec.version = Bl::VERSION
9
- spec.authors = ["saki"]
10
- spec.email = ["sakihet@gmail.com"]
9
+ spec.authors = ['saki']
10
+ spec.email = ['sakihet@gmail.com']
11
11
 
12
- spec.summary = %q{bl is a command line tool for Backlog.}
13
- spec.description = %q{bl is a command line tool for Backlog.}
14
- spec.homepage = "https://github.com/sakihet/bl"
15
- spec.license = "MIT"
12
+ spec.summary = 'bl is a command line tool for Backlog.'
13
+ spec.description = 'bl is a command line tool for Backlog.'
14
+ spec.homepage = 'https://github.com/sakihet/bl'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
18
+ spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.add_dependency "thor", "~> 0.19.1"
23
- spec.add_dependency "backlog_kit", "~> 0.13.0"
24
- spec.add_development_dependency "bundler", "~> 1.11"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "minitest", "~> 5.0"
27
- spec.add_development_dependency "pry", "~> 0.10.3"
22
+ spec.add_dependency 'thor', '~> 0.19.1'
23
+ spec.add_dependency 'backlog_kit', '~> 0.13.0'
24
+ spec.add_development_dependency 'bundler', '~> 1.11'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'minitest', '~> 5.0'
27
+ spec.add_development_dependency 'pry', '~> 0.10.3'
28
+ spec.add_development_dependency 'rubocop', '~> 0.39.0'
28
29
  end
data/exe/bl CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bl"
3
+ require 'bl'
data/lib/bl.rb CHANGED
@@ -1,8 +1,8 @@
1
- require "thor"
2
- require "backlog_kit"
3
- require "bl/version"
4
- require "yaml"
5
- require "pp"
1
+ require 'thor'
2
+ require 'backlog_kit'
3
+ require 'bl/version'
4
+ require 'yaml'
5
+ require 'pp'
6
6
 
7
7
  module Bl
8
8
  CONFIG_FILE = '.bl.yml'
@@ -10,20 +10,20 @@ module Bl
10
10
  class CLI < Thor
11
11
  @@config = YAML.load_file(File.join(Dir.home, CONFIG_FILE))
12
12
 
13
- desc "version", "show version"
13
+ desc 'version', 'show version'
14
14
  def version
15
15
  puts Bl::VERSION
16
16
  end
17
17
 
18
- desc "config", "show config"
18
+ desc 'config', 'show config'
19
19
  def config
20
20
  puts @@config
21
21
  end
22
22
 
23
- desc "init", "initialize a default config file"
23
+ desc 'init', 'initialize a default config file'
24
24
  def init
25
25
  filename = File.join(Dir.home, CONFIG_FILE)
26
- if File.exists?(filename)
26
+ if File.exist?(filename)
27
27
  puts "#{filename} exits."
28
28
  else
29
29
  config = {
@@ -42,12 +42,12 @@ module Bl
42
42
  end
43
43
  end
44
44
 
45
- desc "count", "count issues"
45
+ desc 'count', 'count issues'
46
46
  def count
47
47
  puts Bl::CLI.client.get('issues/count').body.count
48
48
  end
49
49
 
50
- desc "list", "list issues"
50
+ desc 'list', 'list issues'
51
51
  option :all, type: :boolean
52
52
  option :assigneeId, type: :array
53
53
  def list
@@ -56,8 +56,7 @@ module Bl
56
56
  else
57
57
  opts[:statusId] = [1, 2, 3]
58
58
  end
59
- issues = Bl::CLI.client.get('issues', opts.merge(options)).body
60
- issues.each do |i|
59
+ Bl::CLI.client.get('issues', opts.merge(options)).body.each do |i|
61
60
  puts [
62
61
  i.issueType.name,
63
62
  i.issueKey,
@@ -73,12 +72,12 @@ module Bl
73
72
  end
74
73
  end
75
74
 
76
- desc "search", "search issues"
75
+ desc 'search', 'search issues'
77
76
  option :keyword
78
77
  option :categoryId, type: :array
79
78
  option :assigneeId, type: :array
80
79
  def search
81
- issues = Bl::CLI.client.get('issues', options.to_h).body.each do |i|
80
+ Bl::CLI.client.get('issues', options.to_h).body.each do |i|
82
81
  puts [
83
82
  i.issueType.name,
84
83
  i.issueKey,
@@ -94,14 +93,20 @@ module Bl
94
93
  end
95
94
  end
96
95
 
97
- desc "show KEY", "show an issue's details"
96
+ desc 'show KEY', "show an issue's details"
98
97
  def show(key)
99
98
  i = Bl::CLI.client.get("issues/#{key}")
100
99
  str = i.body.pretty_inspect
101
100
  puts str
102
101
  end
103
102
 
104
- desc "add SUBJECT", "add an issue"
103
+ desc 'browse KEY', 'browse an issue'
104
+ def browse(key)
105
+ url = 'https://' + @@config[:space_id] + '.backlog.jp/view/' + key
106
+ system("open #{url}")
107
+ end
108
+
109
+ desc 'add SUBJECT', 'add an issue'
105
110
  option :description, type: :string
106
111
  option :issueTypeId, type: :numeric
107
112
  option :categoryId, type: :array
@@ -118,68 +123,92 @@ module Bl
118
123
  issueTypeId: @@config[:issue][:default_issue_type_id].to_i,
119
124
  priorityId: @@config[:issue][:default_priority_id].to_i
120
125
  }
121
- Bl::CLI.client.post(
122
- "issues",
126
+ res = Bl::CLI.client.post(
127
+ 'issues',
123
128
  base_options.merge(options)
124
129
  )
130
+ puts "issue added: #{res.body.issueKey}\t#{res.body.summary}"
131
+ end
132
+
133
+ desc 'update KEY', 'update an issue'
134
+ option :summary, type: :string
135
+ option :description, type: :string
136
+ option :issueTypeId, type: :numeric
137
+ option :categoryId, type: :array
138
+ option :versionId, type: :array
139
+ option :milestoneId, type: :array
140
+ option :priorityId, type: :numeric
141
+ # TODO: status
142
+ # TODO: resolution
143
+ option :assigneeId, type: :numeric
144
+ def update(key)
145
+ res = Bl::CLI.client.patch("issues/#{key}", options.to_h)
146
+ puts "issue updated: #{res.body.issueKey}\t#{res.body.summary}"
125
147
  end
126
148
 
127
- desc "close KEY", "close an issue"
149
+ desc 'close KEY', 'close an issue'
128
150
  def close(key)
129
151
  Bl::CLI.client.patch("issues/#{key}", statusId: 4)
130
152
  issue = Bl::CLI.client.get("issues/#{key}")
131
153
  puts "issue closed: #{issue.body.issueKey}\t#{issue.body.summary}"
132
154
  end
133
155
 
134
- desc "projects", "list projects"
156
+ desc 'projects', 'list projects'
135
157
  def projects
136
- projects = Bl::CLI.client.get('projects').body.each do |p|
158
+ Bl::CLI.client.get('projects').body.each do |p|
137
159
  puts [p.id, p.projectKey, p.name].join("\t")
138
160
  end
139
161
  end
140
162
 
141
- desc "types", "list issue types"
163
+ desc 'types', 'list issue types'
142
164
  def types
143
- types = Bl::CLI.client.get("projects/#{@@config[:project_key]}/issueTypes").body.each do |t|
165
+ Bl::CLI.client.get("projects/#{@@config[:project_key]}/issueTypes").body.each do |t|
144
166
  puts [t.id, t.name].join("\t")
145
167
  end
146
168
  end
147
169
 
148
- desc "categories", "list issue categories"
170
+ desc 'categories', 'list issue categories'
149
171
  def categories
150
- categories = Bl::CLI.client.get("projects/#{@@config[:project_key]}/categories").body.each do |c|
172
+ Bl::CLI.client.get("projects/#{@@config[:project_key]}/categories").body.each do |c|
151
173
  puts [c.id, c.name].join("\t")
152
174
  end
153
175
  end
154
176
 
155
- desc "statuses", "list statuses"
177
+ desc 'statuses', 'list statuses'
156
178
  def statuses
157
- statuses = Bl::CLI.client.get("statuses").body.each do |s|
179
+ Bl::CLI.client.get('statuses').body.each do |s|
158
180
  puts [s.id, s.name].join("\t")
159
181
  end
160
182
  end
161
183
 
162
- desc "priorities", "list priorities"
184
+ desc 'priorities', 'list priorities'
163
185
  def priorities
164
- priorities = Bl::CLI.client.get("priorities").body.each do |p|
186
+ Bl::CLI.client.get('priorities').body.each do |p|
165
187
  puts [p.id, p.name].join("\t")
166
188
  end
167
189
  end
168
190
 
169
- desc "resolutions", "list resolutions"
191
+ desc 'resolutions', 'list resolutions'
170
192
  def resolutions
171
- resolutions = Bl::CLI.client.get("resolutions").body.each do |r|
193
+ Bl::CLI.client.get('resolutions').body.each do |r|
172
194
  puts [r.id, r.name].join("\t")
173
195
  end
174
196
  end
175
197
 
176
198
  desc 'users', 'list space users'
177
199
  def users
178
- users = Bl::CLI.client.get('users').body.each do |u|
200
+ Bl::CLI.client.get('users').body.each do |u|
179
201
  puts [u.id, u.userId, u.name, u.roleType, u.lang, u.mailAddress].join("\t")
180
202
  end
181
203
  end
182
204
 
205
+ desc 'activities', 'list activities'
206
+ def activities
207
+ Bl::CLI.client.get('/space/activities').body.each do |a|
208
+ puts a.pretty_inspect
209
+ end
210
+ end
211
+
183
212
  def self.client
184
213
  BacklogKit::Client.new(
185
214
  space_id: @@config[:space_id],
@@ -1,3 +1,3 @@
1
1
  module Bl
2
- VERSION = "0.0.5"
2
+ VERSION = '0.0.6'
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.5
4
+ version: 0.0.6
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-29 00:00:00.000000000 Z
11
+ date: 2016-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.10.3
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.39.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.39.0
97
111
  description: bl is a command line tool for Backlog.
98
112
  email:
99
113
  - sakihet@gmail.com