bl 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -4
  3. data/lib/bl.rb +25 -17
  4. data/lib/bl/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a54927f3323ab187713dd1c4b984cf1e6a6b923
4
- data.tar.gz: 47e8ffd921b65ed1ed6d3af87fa4e79cce75a4bb
3
+ metadata.gz: c47b4305ada80a99c75782afbafe5bb84561b2cb
4
+ data.tar.gz: 8f517556f92d8132351da47b8966301bea296aa3
5
5
  SHA512:
6
- metadata.gz: 9514c95c268e5a8663e8484788f690357e6dfc66355852dfb4cabea200b71dd854c49610ca71a778a1db6df68edae3fdbc5598f42e9ae0e5117e8524fa36fb75
7
- data.tar.gz: 9f61ad6e461c2d5d171b7637bdf4823532eaf2beafe25b8078377f8fb4cac764981bd30399513fb48438e226c8b33dce21c6ff3ddcfdef244439c9266698c047
6
+ metadata.gz: 66fabaddddedb44db56db475cfddd26c207d1603df84b07a3c02eef7574bb24f588a3c8611579f9783ee487bd286da305496891537dbc047ffd36d4794d601ec
7
+ data.tar.gz: c7d86770e589de5307da8adde623c191cf736da4cb0203d18e2093ef3ff92df93c93b72f8fdcdd087fd5660760a96be237d8d5589a16267248aa64f90b78fd4a
data/README.md CHANGED
@@ -1,18 +1,34 @@
1
1
  # bl
2
2
 
3
- bl is a command line tool for Backlog.
3
+ bl is a command line tool for Backlog[http://www.backlog.jp/].
4
4
 
5
5
  ## Installation
6
6
 
7
- $ gem install bl
7
+ gem install bl
8
8
 
9
9
  ## Configuration
10
10
 
11
- TODO
11
+ bl init
12
+ $EDITOR ~/.bl.yml
12
13
 
13
14
  ## Usage
14
15
 
15
- TODO
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
16
32
 
17
33
  ## Development
18
34
 
data/lib/bl.rb CHANGED
@@ -2,13 +2,13 @@ require "thor"
2
2
  require "backlog_kit"
3
3
  require "bl/version"
4
4
  require "yaml"
5
- require "pry"
5
+ require "pp"
6
6
 
7
7
  module Bl
8
8
  CONFIG_FILE = '.bl.yml'
9
9
 
10
10
  class CLI < Thor
11
- @config = nil
11
+ @@config = YAML.load_file(File.join(Dir.home, CONFIG_FILE))
12
12
 
13
13
  desc "version", "show version"
14
14
  def version
@@ -17,7 +17,7 @@ module Bl
17
17
 
18
18
  desc "config", "show config"
19
19
  def config
20
- p Bl::CLI.client
20
+ puts @@config
21
21
  end
22
22
 
23
23
  desc "init", "initialize a default config file"
@@ -49,12 +49,14 @@ module Bl
49
49
 
50
50
  desc "list", "list issues"
51
51
  option :all, type: :boolean
52
+ option :assigneeId, type: :array
52
53
  def list
54
+ opts = {}
53
55
  if options[:all]
54
- issues = Bl::CLI.client.get('issues').body
55
56
  else
56
- issues = Bl::CLI.client.get('issues', statusId: [1, 2, 3]).body
57
+ opts[:statusId] = [1, 2, 3]
57
58
  end
59
+ issues = Bl::CLI.client.get('issues', opts.merge(options)).body
58
60
  issues.each do |i|
59
61
  puts [
60
62
  i.issueType.name,
@@ -74,6 +76,7 @@ module Bl
74
76
  desc "search", "search issues"
75
77
  option :keyword
76
78
  option :categoryId, type: :array
79
+ option :assigneeId, type: :array
77
80
  def search
78
81
  issues = Bl::CLI.client.get('issues', options.to_h).body.each do |i|
79
82
  puts [
@@ -100,13 +103,12 @@ module Bl
100
103
 
101
104
  desc "add SUBJECT", "add an issue"
102
105
  def add(subject)
103
- @config = YAML.load_file(File.join(Dir.home, CONFIG_FILE))
104
106
  Bl::CLI.client.post(
105
107
  "issues",
106
- projectId: @config[:issue][:default_project_id].to_i,
108
+ projectId: @@config[:issue][:default_project_id].to_i,
107
109
  summary: subject,
108
- issueTypeId: @config[:issue][:default_issue_type_id].to_i,
109
- priorityId: @config[:issue][:default_priority_id].to_i
110
+ issueTypeId: @@config[:issue][:default_issue_type_id].to_i,
111
+ priorityId: @@config[:issue][:default_priority_id].to_i
110
112
  )
111
113
  end
112
114
 
@@ -124,16 +126,16 @@ module Bl
124
126
  end
125
127
  end
126
128
 
127
- desc "types PROJECT_KEY", "list issue types in the project"
128
- def types(pkey)
129
- types = Bl::CLI.client.get("projects/#{pkey}/issueTypes").body.each do |t|
129
+ desc "types", "list issue types"
130
+ def types
131
+ types = Bl::CLI.client.get("projects/#{@@config[:project_key]}/issueTypes").body.each do |t|
130
132
  puts [t.id, t.name].join("\t")
131
133
  end
132
134
  end
133
135
 
134
136
  desc "categories", "list issue categories"
135
- def categories(pkey)
136
- categories = Bl::CLI.client.get("projects/#{pkey}/categories").body.each do |c|
137
+ def categories
138
+ categories = Bl::CLI.client.get("projects/#{@@config[:project_key]}/categories").body.each do |c|
137
139
  puts [c.id, c.name].join("\t")
138
140
  end
139
141
  end
@@ -159,11 +161,17 @@ module Bl
159
161
  end
160
162
  end
161
163
 
164
+ desc 'users', 'list space users'
165
+ def users
166
+ users = Bl::CLI.client.get('users').body.each do |u|
167
+ puts [u.id, u.userId, u.name, u.roleType, u.lang, u.mailAddress].join("\t")
168
+ end
169
+ end
170
+
162
171
  def self.client
163
- @config = YAML.load_file(File.join(Dir.home, CONFIG_FILE))
164
172
  BacklogKit::Client.new(
165
- space_id: @config[:space_id],
166
- api_key: @config[:api_key]
173
+ space_id: @@config[:space_id],
174
+ api_key: @@config[:api_key]
167
175
  )
168
176
  end
169
177
  end
@@ -1,3 +1,3 @@
1
1
  module Bl
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
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.3
4
+ version: 0.0.4
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-26 00:00:00.000000000 Z
11
+ date: 2016-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor