bl 0.5.5 → 0.5.6

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: e087c0d9b83f0f2b496999e8d77d3974ed8d8c27
4
- data.tar.gz: 243d3b8b14045d2234918a447135c34eb81826f2
3
+ metadata.gz: 3fb625a30492132d3223a78bdbb7d77a5ba092c4
4
+ data.tar.gz: 0c79630777e849df8217f020da3bd5a003fa6daa
5
5
  SHA512:
6
- metadata.gz: 92ee36f006ae99b808512cef1569d17b0fc0d3ecbb6391b21ded95e357b55dbe7f1903eec1a95cfe27fd8b15c9d845232e4b17bec3b6c5a9a4b07d27a1cd6c99
7
- data.tar.gz: ddb775a3724cb84cfb72ec5802ff25a3cfb77c755010a554ad9b94b09e744c48fdf98413c7860bfd7830a08d30bc63972eacd717860a6bb1fdb36ff5ef40fa0b
6
+ metadata.gz: 6e598e8c63ed39dfdaf0aad3cd0034c78d100de8b6576b84a4c76b452b1e79be272cdbea4bdacf057aed7f080330877a0f1ed02355801b502573eb777e6be2ba
7
+ data.tar.gz: e397cec10fbe32d63db08f6027a76d990257ff6c84d95217e5a7178c9c3cfdd8d6aa6d580815e80cd66cbd5b7149951d6c7123e7a7a565dcb69acb4b46aa9ecd
@@ -25,6 +25,24 @@ module Bl
25
25
  else
26
26
  config = Bl::Config.instance.default_config
27
27
  f = ::File.new(filename, 'w')
28
+ puts 'please input space name: '
29
+ space_id = STDIN.gets.chomp
30
+ puts 'plese input api key: '
31
+ api_key = STDIN.gets.chomp
32
+ config[:space_id] = space_id.to_s
33
+ config[:api_key] = api_key.to_s
34
+ client = BacklogKit::Client.new(
35
+ space_id: space_id,
36
+ api_key: api_key
37
+ )
38
+ res = client.get('projects')
39
+ project_key = res.body[0].projectKey
40
+ config[:project_key] = project_key
41
+ config[:issue][:default][:projectId] = res.body[0].id
42
+ res = client.get("projects/#{project_key}/issueTypes")
43
+ config[:issue][:default][:issueTypeId] = res.body[0].id
44
+ res = client.get('priorities')
45
+ config[:issue][:default][:priorityId] = res.body[1].id
28
46
  f.write(config.to_yaml)
29
47
  puts "#{filename} generated."
30
48
  end
@@ -72,6 +90,7 @@ module Bl
72
90
  desc 'show KEY', "show an issue's details"
73
91
  def show(key)
74
92
  body = client.get("issues/#{key}").body
93
+ puts "id: #{body.id}"
75
94
  puts "type: #{body.issueType.name}"
76
95
  puts "key: #{body.issueKey}"
77
96
  puts "created: #{body.created}"
@@ -39,6 +39,7 @@ module Bl
39
39
  )
40
40
  ISSUE_BASE_ATTRIBUTES = {
41
41
  summary: :string,
42
+ parentIssueId: :numeric,
42
43
  description: :string,
43
44
  statusId: :numeric,
44
45
  resolutionId: :numeric,
@@ -104,6 +105,14 @@ module Bl
104
105
  textFormattingRule
105
106
  archived
106
107
  )
108
+ PROJECT_PARAMS = {
109
+ name: :string,
110
+ key: :string,
111
+ chartEnabled: :boolean,
112
+ projectLeaderCanEditProjectLeader: :boolean,
113
+ subtaskingEnabled: :boolean,
114
+ textFormattingRule: :boolean
115
+ }
107
116
  ROLES = [
108
117
  {id: 1, name: 'Administrator'},
109
118
  {id: 2, name: 'Normal User'},
@@ -9,7 +9,34 @@ module Bl
9
9
  desc 'list', 'list projects'
10
10
  def list
11
11
  res = client.get(@url)
12
- puts formatter.render(res.body, fields: PROJECT_FIELDS)
12
+ print_response(res)
13
+ end
14
+
15
+ desc 'add', 'add project'
16
+ option :key, required: true, type: :string
17
+ option :chartEnabled, type: :boolean, default: false
18
+ option :projectLeaderCanEditProjectLeader, type: :boolean, default: false
19
+ option :subtaskingEnabled, type: :boolean, default: false
20
+ option :textFormattingRule, type: :string, default: 'markdown'
21
+ def add(name)
22
+ res = client.post(@url, {name: name}.merge(delete_class_options(options.to_h)))
23
+ puts 'project added'
24
+ print_response(res)
25
+ end
26
+
27
+ desc 'update', 'update project'
28
+ options PROJECT_PARAMS
29
+ def update(id)
30
+ res = client.patch("#{@url}/#{id}", delete_class_options(options.to_h))
31
+ puts 'project updated'
32
+ print_response(res)
33
+ end
34
+
35
+ desc 'delete', 'delete project'
36
+ def delete(id)
37
+ res = client.delete("#{@url}/#{id}")
38
+ puts 'project deleted'
39
+ print_response(res)
13
40
  end
14
41
 
15
42
  desc 'status ID', 'show project status'
@@ -65,5 +92,9 @@ module Bl
65
92
  args
66
93
  ).body.count
67
94
  end
95
+
96
+ def print_response(res)
97
+ puts formatter.render(res.body, fields: PROJECT_FIELDS)
98
+ end
68
99
  end
69
100
  end
@@ -1,3 +1,3 @@
1
1
  module Bl
2
- VERSION = '0.5.5'.freeze
2
+ VERSION = '0.5.6'.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.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - saki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-16 00:00:00.000000000 Z
11
+ date: 2017-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor