bl 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -2
- data/README.md +32 -32
- data/Rakefile +4 -10
- data/bl.gemspec +5 -5
- data/etc/help.md +32 -31
- data/lib/bl.rb +16 -16
- data/lib/bl/cli.rb +25 -113
- data/lib/bl/command.rb +0 -1
- data/lib/bl/commands/category.rb +46 -0
- data/lib/bl/commands/file.rb +28 -0
- data/lib/bl/commands/gitrepo.rb +23 -0
- data/lib/bl/commands/group.rb +47 -0
- data/lib/bl/commands/issue.rb +104 -0
- data/lib/bl/commands/milestone.rb +60 -0
- data/lib/bl/commands/notification.rb +41 -0
- data/lib/bl/commands/project.rb +127 -0
- data/lib/bl/commands/pull_request.rb +23 -0
- data/lib/bl/commands/recent.rb +28 -0
- data/lib/bl/commands/space.rb +66 -0
- data/lib/bl/commands/type.rb +57 -0
- data/lib/bl/commands/user.rb +90 -0
- data/lib/bl/commands/watching.rb +67 -0
- data/lib/bl/commands/webhook.rb +52 -0
- data/lib/bl/commands/wiki.rb +79 -0
- data/lib/bl/version.rb +11 -1
- metadata +43 -43
- data/lib/bl/category.rb +0 -44
- data/lib/bl/file.rb +0 -26
- data/lib/bl/formatting.rb +0 -38
- data/lib/bl/gitrepo.rb +0 -22
- data/lib/bl/groups.rb +0 -45
- data/lib/bl/milestone.rb +0 -58
- data/lib/bl/notifications.rb +0 -38
- data/lib/bl/project.rb +0 -121
- data/lib/bl/pull_request.rb +0 -21
- data/lib/bl/recent.rb +0 -24
- data/lib/bl/space.rb +0 -61
- data/lib/bl/type.rb +0 -55
- data/lib/bl/users.rb +0 -87
- data/lib/bl/watchings.rb +0 -67
- data/lib/bl/webhooks.rb +0 -51
- data/lib/bl/wiki.rb +0 -77
data/lib/bl/webhooks.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
module Bl
|
2
|
-
class Webhooks < Command
|
3
|
-
|
4
|
-
def initialize(*)
|
5
|
-
@config = Bl::Config.instance
|
6
|
-
@url = "projects/#{@config[:project_key]}/webhooks"
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'list', ''
|
11
|
-
def list
|
12
|
-
res = request(:get, @url)
|
13
|
-
print_response(res)
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'show WEBHOOK_ID', ''
|
17
|
-
def show(id)
|
18
|
-
res = request(:get, "#{@url}/#{id}")
|
19
|
-
print_response(res)
|
20
|
-
end
|
21
|
-
|
22
|
-
desc 'add', ''
|
23
|
-
options WEBHOOK_PARAMS
|
24
|
-
def add
|
25
|
-
res = request(:post, @url, options.to_h)
|
26
|
-
puts 'webhook added'
|
27
|
-
print_response(res)
|
28
|
-
end
|
29
|
-
|
30
|
-
desc 'update WEBHOOK_ID', ''
|
31
|
-
options WEBHOOK_PARAMS
|
32
|
-
def update(id)
|
33
|
-
res = request(:patch, "#{@url}/#{id}", options.to_h)
|
34
|
-
puts 'webhook updated'
|
35
|
-
print_response(res)
|
36
|
-
end
|
37
|
-
|
38
|
-
desc 'delete WEBHOOK_ID', ''
|
39
|
-
def delete(id)
|
40
|
-
res = request(:delete, "#{@url}/#{id}")
|
41
|
-
puts 'webhook deleted'
|
42
|
-
print_response(res)
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def print_response(res)
|
48
|
-
puts formatter.render(res.body, fields: WEBHOOK_FIELDS)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/bl/wiki.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
module Bl
|
2
|
-
class Wiki < Command
|
3
|
-
def initialize(*)
|
4
|
-
@config = Bl::Config.instance
|
5
|
-
@url = 'wikis'
|
6
|
-
super
|
7
|
-
end
|
8
|
-
|
9
|
-
desc 'add NAME', 'add wiki'
|
10
|
-
option :projectId, type: :numeric, required: true
|
11
|
-
option :content, type: :string, required: true
|
12
|
-
def add(name)
|
13
|
-
res = request(
|
14
|
-
:post,
|
15
|
-
@url,
|
16
|
-
projectId: options[:projectId],
|
17
|
-
name: name,
|
18
|
-
content: options[:content]
|
19
|
-
)
|
20
|
-
puts 'wiki added:'
|
21
|
-
print_response(res, :wiki)
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'count', 'count wiki'
|
25
|
-
option :projectIdOrKey, type: :numeric, required: true
|
26
|
-
def count
|
27
|
-
res = request(:get, "#{@url}/count", projectIdOrKey: options[:projectIdOrKey])
|
28
|
-
puts 'wiki count'
|
29
|
-
puts res.body.count
|
30
|
-
end
|
31
|
-
|
32
|
-
desc 'delete ID', 'delete wiki'
|
33
|
-
def delete(id)
|
34
|
-
res = request(:delete, "#{@url}/#{id}")
|
35
|
-
puts 'wiki deleted'
|
36
|
-
print_response(res, :wiki)
|
37
|
-
end
|
38
|
-
|
39
|
-
desc 'list', 'list wikis'
|
40
|
-
def list
|
41
|
-
res = request(:get, @url, projectIdOrKey: @config[:project_key])
|
42
|
-
print_response(res, :wiki)
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'show ID', "show a wiki's content"
|
46
|
-
def show(id)
|
47
|
-
res = request(:get, "#{@url}/#{id}")
|
48
|
-
puts formatter.render(res.body, fields: WIKI_FIELDS.push(:content), vertical: true)
|
49
|
-
end
|
50
|
-
|
51
|
-
desc 'tags', 'show wiki tags'
|
52
|
-
option :projectIdOrKey, type: :numeric, required: true
|
53
|
-
def tags
|
54
|
-
res = request(:get, "#{@url}/tags", projectIdOrKey: options[:projectIdOrKey])
|
55
|
-
puts 'wiki tags:'
|
56
|
-
print_response(res, :named)
|
57
|
-
end
|
58
|
-
|
59
|
-
desc 'edit ID', 'edit a wiki by $EDITOR'
|
60
|
-
def edit(id)
|
61
|
-
wiki_content = request(:get, "#{@url}/#{id}").body.content
|
62
|
-
file = Tempfile.new
|
63
|
-
file.puts(wiki_content)
|
64
|
-
file.close
|
65
|
-
begin
|
66
|
-
file.open
|
67
|
-
system("$EDITOR #{file.path}")
|
68
|
-
new_content = file.read
|
69
|
-
request(:patch, "#{@url}/#{id}", content: new_content)
|
70
|
-
puts "wiki #{id} updated."
|
71
|
-
ensure
|
72
|
-
file.close
|
73
|
-
file.unlink
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|