Merge branch 'master' into ha-feature-remove_log_endpoint
Conflicts: Gemfile.lock travis-api.gemspec
This commit is contained in:
commit
9265ac62c9
1
Gemfile
1
Gemfile
|
@ -6,6 +6,7 @@ gemspec
|
|||
gem 'travis-core', github: 'travis-ci/travis-core'
|
||||
gem 'travis-support', github: 'travis-ci/travis-support'
|
||||
gem 'travis-sidekiqs', github: 'travis-ci/travis-sidekiqs', require: nil, ref: 'cde9741'
|
||||
gem 'travis-yaml', github: 'travis-ci/travis-yaml'
|
||||
gem 'sinatra'
|
||||
gem 'sinatra-contrib', require: nil #github: 'sinatra/sinatra-contrib', require: nil
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ GIT
|
|||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-core.git
|
||||
revision: a4f19caa0ae6847a3a10db2b99ba752a656aad98
|
||||
revision: 111ae389e611157d48177ed732c1822d98fe3059
|
||||
specs:
|
||||
travis-core (0.0.1)
|
||||
actionmailer (~> 3.2.12)
|
||||
|
@ -80,6 +80,12 @@ GIT
|
|||
specs:
|
||||
travis-support (0.0.1)
|
||||
|
||||
GIT
|
||||
remote: git://github.com/travis-ci/travis-yaml.git
|
||||
revision: 7e6e31e82240e170ffc20dfd02c0353b3bd5d33b
|
||||
specs:
|
||||
travis-yaml (0.1.0)
|
||||
|
||||
GIT
|
||||
remote: https://gist.github.com/4269321.git
|
||||
revision: 8e2d21b924a69dd48191df6a18e51769f5a88614
|
||||
|
@ -332,5 +338,6 @@ DEPENDENCIES
|
|||
travis-core!
|
||||
travis-sidekiqs!
|
||||
travis-support!
|
||||
travis-yaml!
|
||||
unicorn
|
||||
yard-sinatra!
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
require 'travis/api/app'
|
||||
|
||||
class Travis::Api::App
|
||||
class Endpoint
|
||||
class Branches < Endpoint
|
||||
get '/' do
|
||||
respond_with service(:find_branches, params), type: :branches
|
||||
end
|
||||
|
||||
# get '/:owner_name/:name/branches' do # v1
|
||||
# get '/repos/:owner_name/:name/branches' do # v2
|
||||
# respond_with service(:branches, :find_all, params), type: :branches
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
19
lib/travis/api/app/endpoint/lint.rb
Normal file
19
lib/travis/api/app/endpoint/lint.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
require 'travis/api/app'
|
||||
require 'travis/yaml'
|
||||
|
||||
class Travis::Api::App
|
||||
class Endpoint
|
||||
class Lint < Endpoint
|
||||
def lint
|
||||
request.body.rewind
|
||||
content = params[:content] || request.body.read
|
||||
parsed = Travis::Yaml.parse(content)
|
||||
warnings = parsed.nested_warnings.map { |k, m| { key: k, message: m } }
|
||||
{ lint: { warnings: warnings } }.to_json
|
||||
end
|
||||
|
||||
post('/', scope: :public) { lint }
|
||||
put('/', scope: :public) { lint }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'Branches' do
|
||||
let(:repo) { Repository.by_slug('svenfuchs/minimal').first }
|
||||
let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.1+json' } }
|
||||
|
||||
it 'GET /branches?repository_id=:repository_id' do
|
||||
response = get '/branches', { repository_id: repo.id }, headers
|
||||
response.should deliver_json_for(repo.last_finished_builds_by_branches, version: 'v1', type: 'branches')
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'Branches' do
|
||||
let(:repo) { Repository.by_slug('svenfuchs/minimal').first }
|
||||
let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json' } }
|
||||
|
||||
it 'GET /branches?repository_id=:repository_id' do
|
||||
response = get '/branches', { repository_id: repo.id }, headers
|
||||
response.should deliver_json_for(repo.last_finished_builds_by_branches, version: 'v2', type: 'branches')
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Travis::Api::App::Endpoint::Branches do
|
||||
it 'has to be tested'
|
||||
end
|
18
spec/unit/endpoint/lint_spec.rb
Normal file
18
spec/unit/endpoint/lint_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Travis::Api::App::Endpoint::Lint do
|
||||
let(:content) { "foo: bar" }
|
||||
let(:body) { "{\"lint\":{\"warnings\":[{\"key\":[],\"message\":\"unexpected key \\\"foo\\\", dropping\"},{\"key\":[],\"message\":\"missing key \\\"language\\\", defaulting to \\\"ruby\\\"\"}]}}" }
|
||||
|
||||
it "accepts content in parameter" do
|
||||
response = post('/lint', content: content)
|
||||
response.should be_ok
|
||||
response.body.should be == body
|
||||
end
|
||||
|
||||
it "accepts content as body" do
|
||||
response = put('/lint', content)
|
||||
response.should be_ok
|
||||
response.body.should be == body
|
||||
end
|
||||
end
|
|
@ -35,8 +35,8 @@ Gem::Specification.new do |s|
|
|||
"konstantin.mailinglists@googlemail.com",
|
||||
"me@svenfuchs.com",
|
||||
"meyer@paperplanes.de",
|
||||
"asari.ruby@gmail.com",
|
||||
"josh.kalderimis@gmail.com",
|
||||
"asari.ruby@gmail.com",
|
||||
"me@henrikhodne.com",
|
||||
"henrik@hodne.io",
|
||||
"konstantin.haase@gmail.com",
|
||||
|
|
Loading…
Reference in New Issue
Block a user