travis_parallel_sentinel 0.1.10 → 0.1.11

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: 9d6c086f201b8b7c4e5459186d01ce2ebdf56761
4
- data.tar.gz: a631af6e59256ea460c0c41c9782840ccc4405a3
3
+ metadata.gz: 1fcedec353e96923f6d1a2a50708f6f6a439368c
4
+ data.tar.gz: 599ccf2d32cda9d9c045bcfe105a620b70563dd5
5
5
  SHA512:
6
- metadata.gz: 86ba65297e452787e53ea355b669284e081d045efa0d73797aa2c2aae6209a1f3d4c3af5c7799e70e75a4f873b456a0a324221022c9cf9162911c2fbd752ce5a
7
- data.tar.gz: 3b6b90952f8075b1220ef4ee8f56b9d1cdd49c74b2a7a3b3a3eced35df74efb68766e126e894944a5dfb4a11fa70d0636c79cea04967ac3b563294e18c0ba629
6
+ metadata.gz: 6e492d0607c92d0b5fc82c9bcccff061a116df96417036aaab256d8419cd83a5810c1e2b0975868601aaa9e3a1b8dcec870b90bbe7d4c84c0f12e803e63c134a
7
+ data.tar.gz: b8f13a575f6bee4dcaa4cfb32cc7638546b13476ad3c5228a9bd54e6802488e502da7f01ddbd105cca1d4963faa76d4ad454e57008e79b79ee84d4c2c81560f7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- travis_parallel_sentinel (0.1.10)
4
+ travis_parallel_sentinel (0.1.11)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module TravisParallelSentinel
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
@@ -9,16 +9,6 @@ TRAVIS_BUILD_ID = ENV['TRAVIS_BUILD_ID'].to_s.strip
9
9
  $stdout.sync = $stderr.sync = true
10
10
 
11
11
  module TravisParallelSentinel
12
- def result(job)
13
- prefix = "#{job.number}="
14
- return prefix + 'running' if job.result.nil?
15
- return prefix + 'ok' if job.result == 0
16
- return prefix + 'failed'
17
- end
18
- def results(jobs)
19
- return jobs.collect{|job| result(job)}.join(', ')
20
- end
21
-
22
12
  def status(phase)
23
13
  raise "Unexpected phase #{phase.inspect}, expected 'script' or 'after'" unless %w{script after}.include?(phase.to_s.downcase)
24
14
  phase = phase.to_s.downcase.to_sym
@@ -26,14 +16,25 @@ module TravisParallelSentinel
26
16
  return :deploy if TRAVIS_JOB_NUMBER == '' # no build matrix, so good to go
27
17
  return :ignore unless TRAVIS_JOB_NUMBER =~ /\.1$/ # first job in the sequence is the deployment container
28
18
 
19
+ results = lambda do |job|
20
+ prefix = "#{job.number}="
21
+ return prefix + 'running' if job.result.nil?
22
+ return prefix + 'ok' if job.result == 0
23
+ return prefix + 'failed'
24
+ end
25
+
26
+ results = lambda do |jobs|
27
+ return jobs.collect{|job| result.call(job)}.join(', ')
28
+ end
29
+
29
30
  while true
30
31
  builds = JSON.parse(open("https://api.travis-ci.org/builds/#{TRAVIS_BUILD_ID}").read)
31
32
  jobs = builds['matrix'].collect{|job| OpenStruct.new(job)}
32
33
  if jobs.select{|job| job.number != TRAVIS_JOB_NUMBER || phase == :after}.detect{|job| job.result.nil?}
33
- $stderr.puts "waiting... #{results(jobs)}"
34
+ $stderr.puts "waiting... #{results.call(jobs)}"
34
35
  sleep 5
35
36
  elsif jobs.detect{|job| job.result != 0}
36
- throw "Some jobs failed: #{results(jobs)}"
37
+ throw "Some jobs failed: #{results.call(jobs)}"
37
38
  else
38
39
  return :deploy
39
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis_parallel_sentinel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - retorquere