Skip to content

Instantly share code, notes, and snippets.

@rubiii
Created February 18, 2012 15:31
Show Gist options
  • Save rubiii/1859803 to your computer and use it in GitHub Desktop.
Save rubiii/1859803 to your computer and use it in GitHub Desktop.
require "net/http"
require "json"
require 'travis/lint'
project = "rubiii/savon"
tree_sha = nil
unless tree_sha
commits_uri = URI("http://github.com/api/v2/json/commits/list/#{project}/master")
response = Net::HTTP.get_response(commits_uri)
response = JSON.parse(response.body)
tree_sha = response["commits"].first["tree"]
end
blob_uri = URI("http://github.com/api/v2/json/blob/show/#{project}/#{tree_sha}/.travis.yml")
response = Net::HTTP.get_response(blob_uri)
response = JSON.parse(response.body)
travis_yml = response["blob"]["data"]
begin
parsed_travis_yml = YAML.load(travis_yml)
rescue ArgumentError, Psych::SyntaxError
puts ".travis.yml at is not a valid YAML file and thus will be ignored by Travis CI."
exit
end
if (issues = Travis::Lint::Linter.validate(parsed_travis_yml)).empty?
puts "Hooray, your .travis.yml seems to be solid!"
else
issues.each do |issue|
puts "Found an issue with the `#{issue[:key]}:` key:\n\t#{issue[:issue]}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment