Skip to content

Commit

Permalink
timeout around everything (travis, what are you doing?)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Jul 16, 2014
1 parent 70fcb34 commit 4b9ecb7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,3 +1,3 @@
language: ruby
rvm: [2.0.0, 1.8.7]
script: travis_retry ./bin/travis-lint
script: ./bin/travis-lint
33 changes: 17 additions & 16 deletions bin/travis-lint
@@ -1,21 +1,22 @@
#!/usr/bin/env ruby --disable=gems --disable=rubyopt
require 'uri'
require 'net/https'
require 'yaml'
require 'timeout'

path = ARGV[0] || '.travis.yml'
content = path == '-' ? $stdin.read : File.read(path)
response = Timeout.timeout(5) do
uri = URI.parse("https://api.travis-ci.org/lint")
Net::HTTP.post_form(uri, :content => content)
end
Timeout.timeout(5) do
require 'uri'
require 'net/https'
require 'yaml'

response.value
warnings = YAML.load(response.body)['lint']['warnings']
warnings.reverse.each do |warning|
prefix = " " << warning['key'].join('.') << ":" if warning['key'].any?
puts "-#{prefix} #{warning['message']}"
end
path = ARGV[0] || '.travis.yml'
content = path == '-' ? $stdin.read : File.read(path)
uri = URI.parse("https://api.travis-ci.org/lint")
response = Net::HTTP.post_form(uri, :content => content)

exit 1 if warnings.any?
response.value
warnings = YAML.load(response.body)['lint']['warnings']
warnings.reverse.each do |warning|
prefix = " " << warning['key'].join('.') << ":" if warning['key'].any?
puts "-#{prefix} #{warning['message']}"
end

exit 1 if warnings.any?
end

0 comments on commit 4b9ecb7

Please sign in to comment.