diff --git a/.buildpacks b/.buildpacks new file mode 100644 index 00000000..eb20a5d0 --- /dev/null +++ b/.buildpacks @@ -0,0 +1,2 @@ +https://github.com/heroku/heroku-buildpack-ruby.git +https://github.com/drogus/last-commit-sha-buildpack.git diff --git a/Gemfile.lock b/Gemfile.lock index 5de2987f..d831a755 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GIT GIT remote: git://github.com/getsentry/raven-ruby.git - revision: bc9529e1a79641461f3db9d66c4ea4e8569cb40d + revision: fa360a9c5919c19f11552b9de6f83302060901f0 specs: sentry-raven (0.3.1) faraday (>= 0.7.6) @@ -42,7 +42,7 @@ GIT GIT remote: git://github.com/travis-ci/travis-core.git - revision: ee4cc1f120d951dd4c75d4ec858eb531901e9889 + revision: 6d3159598ece0bfe82cc0c4897e4c0ebb60b3c7f specs: travis-core (0.0.1) actionmailer (~> 3.2.3) @@ -63,10 +63,9 @@ GIT GIT remote: git://github.com/travis-ci/travis-sidekiqs.git - revision: 8ee04e96a26f8caa49045bce87ed756dbc4e1d55 + revision: cde9741f8e6811fe3929bdd0dd653b87289c5eef specs: travis-sidekiqs (0.0.1) - sentry-raven sidekiq (~> 2.5.0) GIT @@ -227,7 +226,7 @@ GEM rspec-expectations (2.12.0) diff-lcs (~> 1.1.3) rspec-mocks (2.12.0) - sidekiq (2.5.3) + sidekiq (2.5.4) celluloid (~> 0.12.0) connection_pool (~> 0.9.2) multi_json (~> 1) diff --git a/lib/travis/api/app.rb b/lib/travis/api/app.rb index 1ea565b4..ecb8d19c 100644 --- a/lib/travis/api/app.rb +++ b/lib/travis/api/app.rb @@ -61,10 +61,11 @@ module Travis::Api use ActiveRecord::QueryCache if memcache_servers = ENV['MEMCACHE_SERVERS'] + namespace = File.read('.deploy-sha')[0..7] use Rack::Cache, verbose: true, - metastore: "memcached://#{memcache_servers}", - entitystore: "memcached://#{memcache_servers}" + metastore: "memcached://#{memcache_servers}/#{namespace}", + entitystore: "memcached://#{memcache_servers}/#{namespace}" end use Rack::Deflater diff --git a/lib/travis/api/app/endpoint/repos.rb b/lib/travis/api/app/endpoint/repos.rb index 42f97e4b..09be4d5e 100644 --- a/lib/travis/api/app/endpoint/repos.rb +++ b/lib/travis/api/app/endpoint/repos.rb @@ -20,6 +20,10 @@ class Travis::Api::App respond_with service(:find_repo, params.merge(schema: 'cc')) end + get '/:id/key' do + respond_with service(:find_repo_key, params) + end + get '/:owner_name/:name' do respond_with service(:find_repo, params) end @@ -35,6 +39,10 @@ class Travis::Api::App get '/:owner_name/:name/cc' do respond_with service(:find_repo, params.merge(schema: 'cc')) end + + get '/:owner_name/:name/key' do + respond_with service(:find_repo_key, params) + end end end end diff --git a/script/console b/script/console index ec171de5..fd1fd99c 100755 --- a/script/console +++ b/script/console @@ -6,7 +6,7 @@ require 'travis/api/app' require 'pry' class Travis::Console - include Travis::Services + include Travis::Services::Helpers attr_reader :current_user def set_user(user) diff --git a/spec/integration/v2/repositories_spec.rb b/spec/integration/v2/repositories_spec.rb index a4de23a4..1a0166e6 100644 --- a/spec/integration/v2/repositories_spec.rb +++ b/spec/integration/v2/repositories_spec.rb @@ -6,6 +6,16 @@ describe 'Repos' do let(:repo) { Repository.by_slug('svenfuchs/minimal').first } let(:headers) { { 'HTTP_ACCEPT' => 'application/vnd.travis-ci.2+json' } } + it 'GET /repos/:id/key' do + response = get "/repos/#{repo.id}/key", {}, headers + response.should deliver_json_for(repo.key, version: 'v2') + end + + it 'GET /repos/:slug/key' do + response = get "/repos/#{repo.slug}/key", {}, headers + response.should deliver_json_for(repo.key, version: 'v2') + end + it 'GET /repos' do response = get '/repos', {}, headers response.should deliver_json_for(Repository.timeline, version: 'v2')