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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7669c5cd94aadf34b8c0ffc3abdec4bd96667a98
4
- data.tar.gz: e19d1a73b9d8f02372816aabb9db20843b1ffb17
3
+ metadata.gz: c3105238793da28045e3d9197d940a837c0a189c
4
+ data.tar.gz: cfb8f766da24557ec3be51ab797be44db92727a6
5
5
  SHA512:
6
- metadata.gz: 23bb8201340113d18b5f85948bcd3951ee83a65763403e538701c86a4fe51a9a0117e34f8097b33282d38de4426ec70b70e9b2853d7162d6de3d3ea0cd24e9d7
7
- data.tar.gz: c7173aab373a38ded30d8a9ec9064ca1e5f5671ae5350ae3fd84de3ca9c0f813fb3c40886a9573188981d473218d699236ccb0ba24419c4e95f0609e331bf494
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] # number of builds shown
39
- # Default: 10
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
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- trap("SIGINT") do
3
+ trap('SIGINT') do
4
4
  puts
5
- puts "Exiting"
5
+ puts 'Exiting'
6
6
  exit 130
7
7
  end
8
8
 
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["ref"] == ref }.first(limit || DEFAULT_LIMIT).reverse
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)
@@ -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[id status ref message])
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'] if id.to_i.to_s != 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]
@@ -1,5 +1,5 @@
1
1
  module Drone
2
2
  class Builds
3
- VERSION = '0.3.1'.freeze
3
+ VERSION = '0.3.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drone-builds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié