drone-builds 0.2.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 495c16f3d5f8531ee5471c5a7257022dff406a01
4
- data.tar.gz: 07e717b39c8b1d7aee0741cf2f73e1ad96861993
3
+ metadata.gz: 573c8e1088e883fea7522342bd5abc2ec5f3014c
4
+ data.tar.gz: c1c00080331b2014bac34bca4450639fa0ca8405
5
5
  SHA512:
6
- metadata.gz: 8b9950472c3fad4c7ecddc8d8d38755c3316a8891719dd29055a892ee85597503ed9f78d811b25f3e35e0809151dffd59595e55b58eb80ba43938e26a8b2fbe3
7
- data.tar.gz: ae785181d44491a48154588b868363c7a2034473c7fbde40e9b1df4f5500cadafdf27b5da9456cde42e0a8606f74739f94617b7330573170e2c6bb0a0f1088ff
6
+ metadata.gz: 470076dc1140d472d310cb086d9c1fdcb2dcbbf72588a6095f8f297f7234492d404431984e2002843c875a971ab7bdc8ac90613571c7f56e13aca33819bb4380
7
+ data.tar.gz: 93697e8e362b24e2161a0480c2af5cd877a654d3d762144ba25e4a6e7b06fd85024f3c75408663554431e4dc19f4460377021a8a444ba4d777d7aef2855a8268
data/lib/drone/builds.rb CHANGED
@@ -7,6 +7,7 @@ module Drone
7
7
  class Builds
8
8
  attr_reader :token, :domain, :owner, :name, :job_id, :protocol
9
9
 
10
+ MAX_LIMIT = 30
10
11
  DEFAULT_LIMIT = 10
11
12
  DEFAULT_JOB_ID = 1
12
13
 
@@ -6,21 +6,23 @@ require 'drone/builds/parser'
6
6
  class Drone::Builds::Cli < Thor
7
7
  package_name 'drone-builds'
8
8
 
9
+ LIMIT = Drone::Builds::DEFAULT_LIMIT
10
+
9
11
  map 'l' => :list
10
12
  map 's' => :show
11
13
  map 'v' => :version
12
14
 
13
15
  desc 'list', 'list last builds'
14
- method_option :limit,
15
- type: :numeric,
16
- default: Drone::Builds::DEFAULT_LIMIT,
17
- aliases: '-l',
18
- desc: 'number of builds shown'
16
+ method_option :limit, type: :numeric, default: LIMIT, aliases: '-l', desc: 'number of builds shown'
17
+ method_option :pull, type: :numeric, aliases: '-p', desc: 'pull request ID on GitHub'
19
18
  def list
20
- puts self.class.parser.table(
21
- self.class.parser.parse_builds(self.class.client.list(limit: options[:limit])),
22
- %i[id status ref message]
23
- )
19
+ limit = options[:pull] ? Drone::Builds::MAX_LIMIT : options[:limit]
20
+
21
+ builds = self.class.parser.parse_builds(self.class.client.list(limit: limit))
22
+
23
+ builds = builds.select { |build| build[:ref] == "##{options[:pull]}" } if options[:pull]
24
+
25
+ puts self.class.parser.table(builds.last(options[:limit]], %i[id status ref message])
24
26
  end
25
27
 
26
28
  desc 'show', 'show a build'
@@ -1,5 +1,5 @@
1
1
  module Drone
2
2
  class Builds
3
- VERSION = '0.2.9'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drone-builds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.6.8
169
+ rubygems_version: 2.6.11
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: Command line interface to Drone