drone-builds 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -2
- data/exe/drone-builds +2 -2
- data/lib/drone/builds.rb +1 -1
- data/lib/drone/builds/cli.rb +4 -5
- data/lib/drone/builds/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3105238793da28045e3d9197d940a837c0a189c
|
4
|
+
data.tar.gz: cfb8f766da24557ec3be51ab797be44db92727a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e130717f9dcf6db486e11b74f9cb06da35fa74441cbdcdce379f0f345bb6ba7c5b9012d38266ccd65e491913586d5f1ac84d826cbdba6729728dcf5eeff64625
|
7
|
+
data.tar.gz: aba8681cca20feadba1e9eabc3659a7b47d970936a8e2731bf329a4d2a29075443ed5c8a00a8e98fce5665e659f3c323ae6132fd4e829a1ab8bdccd1a76100a7
|
data/README.md
CHANGED
@@ -24,6 +24,7 @@ drone-builds commands:
|
|
24
24
|
drone-builds help [COMMAND] # Describe available commands or one specific command
|
25
25
|
drone-builds list # list last builds
|
26
26
|
drone-builds show # show a build
|
27
|
+
drone-builds version # version used
|
27
28
|
```
|
28
29
|
|
29
30
|
### `drone-builds list`
|
@@ -35,8 +36,10 @@ Usage:
|
|
35
36
|
drone-builds list
|
36
37
|
|
37
38
|
Options:
|
38
|
-
-l, [--limit=N]
|
39
|
-
|
39
|
+
-l, [--limit=N] # number of builds shown
|
40
|
+
# Default: 10
|
41
|
+
-p, [--pull=N] # pull request ID on GitHub
|
42
|
+
-b, [--branch=BRANCH] # builds on that branch
|
40
43
|
|
41
44
|
list last builds
|
42
45
|
```
|
@@ -51,6 +54,11 @@ Usage:
|
|
51
54
|
|
52
55
|
Options:
|
53
56
|
-f, [--filter=FILTER] # filter builds output lines
|
57
|
+
-c, [--context=N] # number of lines after filter match
|
58
|
+
-l, [--last=N] # show nth last build
|
59
|
+
# Default: 1
|
60
|
+
-p, [--pull=N] # show last build from pull request ID
|
61
|
+
-b, [--branch=BRANCH] # builds on that branch
|
54
62
|
|
55
63
|
show a build
|
56
64
|
```
|
@@ -69,3 +77,11 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/Dorian
|
|
69
77
|
|
70
78
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
71
79
|
|
80
|
+
## TODO
|
81
|
+
|
82
|
+
- [ ] TravisCI tests
|
83
|
+
- [ ] Rubocop in CI
|
84
|
+
- [ ] More tests
|
85
|
+
- [ ] Normal ENV option
|
86
|
+
- [ ] parameter options for ENV variables
|
87
|
+
|
data/exe/drone-builds
CHANGED
data/lib/drone/builds.rb
CHANGED
@@ -21,7 +21,7 @@ module Drone
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def list(limit: nil, ref: nil)
|
24
|
-
json_api(builds_url).select { |b| !ref || b[
|
24
|
+
json_api(builds_url).select { |b| !ref || b['ref'] == ref }.first(limit || DEFAULT_LIMIT).reverse
|
25
25
|
end
|
26
26
|
|
27
27
|
def show(id, filter: nil, context: nil)
|
data/lib/drone/builds/cli.rb
CHANGED
@@ -21,7 +21,7 @@ class Drone::Builds::Cli < Thor
|
|
21
21
|
|
22
22
|
builds = self.class.parser.parse_builds(self.class.client.list(limit: options[:limit], ref: ref))
|
23
23
|
|
24
|
-
puts self.class.parser.table(builds, %i
|
24
|
+
puts self.class.parser.table(builds, %i(id status ref message))
|
25
25
|
end
|
26
26
|
|
27
27
|
desc 'show', 'show a build'
|
@@ -33,13 +33,13 @@ class Drone::Builds::Cli < Thor
|
|
33
33
|
def show(id = nil)
|
34
34
|
ref = self.class.options_to_ref(options)
|
35
35
|
|
36
|
-
id = self.class.client.list(limit: options[:last].abs, ref: ref)[0]['id'
|
36
|
+
id = self.class.client.list(limit: options[:last].abs, ref: ref)[0]&.[]('id') if id.to_i.to_s != id
|
37
|
+
|
38
|
+
abort "No build found for options: #{options}" unless id
|
37
39
|
|
38
40
|
self.class.client.show(id, filter: options[:filter], context: options[:context]) do |line|
|
39
41
|
puts line
|
40
42
|
end
|
41
|
-
rescue
|
42
|
-
abort "No build found for options: #{options}"
|
43
43
|
end
|
44
44
|
|
45
45
|
desc 'version', 'version used'
|
@@ -64,7 +64,6 @@ class Drone::Builds::Cli < Thor
|
|
64
64
|
)
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
67
|
def self.options_to_ref(options)
|
69
68
|
ref = nil
|
70
69
|
ref = "refs/heads/#{options[:branch]}" if options[:branch]
|
data/lib/drone/builds/version.rb
CHANGED