Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'staging' of github.com:travis-ci/travis-ci into staging

  • Loading branch information...
commit 74cd5c7f78452c9fdeaed14d581b500f4713d72d 2 parents a20dfe6 + 440150e
Sven Fuchs svenfuchs authored
2  .travis.yml
View
@@ -3,7 +3,7 @@ script: "bundle exec rake test:ci"
rvm:
- 1.8.7
- 1.9.2
- - ruby-head
+ - 1.9.3
- ree
notifications:
irc: "irc.freenode.org#travis"
4 Gemfile
View
@@ -29,7 +29,7 @@ gem 'rabl', '~> 0.3.0'
gem 'jruby-openssl', :platforms => :jruby
-gem 'newrelic_rpm', '~> 3.1.0'
+gem 'newrelic_rpm', '~> 3.1.0'
group :test do
@@ -39,7 +39,7 @@ group :test do
gem 'factory_girl_rails'
gem 'mocha'
gem 'test_declarative'
- gem 'fakeredis'
+ gem 'fakeredis', '~> 0.2.0'
gem 'webmock'
platforms :ruby_18 do
9 Gemfile.lock
View
@@ -70,7 +70,7 @@ GEM
childprocess (0.2.0)
ffi (~> 1.0.6)
chunky_png (1.2.0)
- clockwork (0.2.3)
+ clockwork (0.2.4)
columnize (0.3.4)
compass (0.11.5)
chunky_png (~> 1.2)
@@ -89,7 +89,8 @@ GEM
factory_girl_rails (1.0.1)
factory_girl (~> 1.3)
railties (>= 3.0.0)
- fakeredis (0.1.4)
+ fakeredis (0.2.0)
+ redis (~> 2.2.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
@@ -129,7 +130,7 @@ GEM
multi_json (1.0.3)
multi_xml (0.2.2)
multipart-post (1.1.3)
- newrelic_rpm (3.1.0)
+ newrelic_rpm (3.1.1)
nokogiri (1.5.0)
nokogiri (1.5.0-java)
oa-core (0.2.6)
@@ -268,7 +269,7 @@ DEPENDENCIES
devise (~> 1.4.2)
factory_girl (~> 1.3)
factory_girl_rails
- fakeredis
+ fakeredis (~> 0.2.0)
hoptoad_notifier (~> 2.4.11)
jammit (~> 0.6.0)
jruby-openssl
4 app/controllers/application_controller.rb
View
@@ -8,6 +8,10 @@ class ApplicationController < ActionController::Base
protected
+ def not_found
+ raise ActionController::RoutingError.new('Not Found')
+ end
+
def repositories
@repositories ||= Repository.timeline
end
6 app/controllers/builds_controller.rb
View
@@ -9,13 +9,13 @@ class BuildsController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => :create
def index
- repository = Repository.find(params[:repository_id])
+ not_found unless repository = Repository.find_by_params(params)
- respond_with(repository.builds.recent((params[:page] || 1).to_i))
+ respond_with(repository.builds.recent(params[:page]))
end
def show
- build = Build.find(params[:id])
+ not_found unless build = Build.find(params[:id])
respond_with(build)
end
1  app/controllers/repositories_controller.rb
View
@@ -12,6 +12,7 @@ def show
respond_with(@repository) do |format|
format.png { send_status_image_file }
+ format.any { @repository || not_found }
end
end
1  app/models/build.rb
View
@@ -18,6 +18,7 @@ class Build < ActiveRecord::Base
class << self
def recent(page)
+ page = (page || 1).to_i
started.order('id DESC').limit(10 * page).includes(:matrix)
end
4 app/models/repository.rb
View
@@ -80,8 +80,8 @@ def github_repos_for_user(user)
end
def find_by_params(params)
- if params[:id]
- self.find(params[:id])
+ if id = params[:repository_id] || params[:id]
+ self.find(id)
else
self.where(params.slice(:name, :owner_name)).first
end
12 app/views/layouts/_gauges.html.erb
View
@@ -1,12 +0,0 @@
-<script type="text/javascript">
- (function() {
- var t = document.createElement('script');
- t.type = 'text/javascript';
- t.async = true;
- t.id = 'gauges-tracker';
- t.setAttribute('data-site-id', '<%= Travis.config['gauges'] %>');
- t.src = '//secure.gaug.es/track.js';
- var s = document.getElementsByTagName('script')[0];
- s.parentNode.insertBefore(t, s);
- })();
-</script>
13 app/views/layouts/_google_analytics.html.erb
View
@@ -0,0 +1,13 @@
+<script type="text/javascript">
+
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', '<%= Travis.config['google_analytics'] %>']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+
+</script>
2  app/views/layouts/application.html.erb
View
@@ -70,6 +70,6 @@
<%= javascript_tag "var pusher = new Pusher('#{Pusher.key}');" unless Rails.env.jasmine? %>
- <%= render 'layouts/gauges' %>
+ <%= render 'layouts/google_analytics' %>
</body>
</html>
2  app/views/layouts/simple.html.erb
View
@@ -34,6 +34,6 @@
<%= yield %>
</div>
- <%= render 'layouts/gauges' %>
+ <%= render 'layouts/google_analytics' %>
</body>
</html>
6 config/routes.rb
View
@@ -7,6 +7,12 @@
match ":owner_name/:name.xml", :to => 'repositories#show', :format => 'xml'
match ":owner_name/:name.json", :to => 'repositories#show', :format => 'json'
+ match ":owner_name/:name/builds.xml", :to => 'builds#index', :format => 'xml'
+ match ":owner_name/:name/builds.json", :to => 'builds#index', :format => 'json'
+
+ match ":owner_name/:name/builds/:id.xml", :to => 'builds#show', :format => 'xml'
+ match ":owner_name/:name/builds/:id.json", :to => 'builds#show', :format => 'json'
+
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
as :user do
10 public/javascripts/app/controllers/application.js
View
@@ -62,6 +62,7 @@ Travis.Controllers.Application = Backbone.Controller.extend({
}, this));
},
repository: function(owner, name, line_number) {
+ console.log ("application#repository: ", arguments)
this.reset();
this.trackPage();
this.startLoading();
@@ -73,6 +74,7 @@ Travis.Controllers.Application = Backbone.Controller.extend({
}, this));
},
repositoryHistory: function(owner, name) {
+ console.log ("application#repositoryHistory: ", arguments)
this.reset();
this.trackPage();
this.selectTab('history');
@@ -82,6 +84,7 @@ Travis.Controllers.Application = Backbone.Controller.extend({
}, this));
},
repositoryBuild: function(owner, name, buildId, line_number) {
+ console.log ("application#repositoryBuild: ", arguments)
this.reset();
this.trackPage();
this.startLoading();
@@ -108,8 +111,8 @@ Travis.Controllers.Application = Backbone.Controller.extend({
$('#main').removeClass('loading')
},
trackPage: function() {
- window._gauges = window._gauges || [];
- window._gauges.push(['track']);
+ window._gaq = _gaq || [];
+ window._gaq.push(['_trackPageview']);
},
@@ -172,7 +175,8 @@ Travis.Controllers.Application = Backbone.Controller.extend({
return this.buildingRails(data) ? this.jobsRails : this.jobs;
},
buildingRails: function (data) {
- return data.slug && data.slug.match(/rails/);
+ return data.slug && data.slug == 'rails/rails';
}
});
+
12 public/javascripts/lib/utils.js
View
@@ -152,3 +152,15 @@ function trace() {
_.each(stack, function(line) { console.log(line); });
}
}
+
+window._console = console;
+/*
+ * In order to use old (default) behavior of console, please use __DEBUG__ in URL hash, or __DEBUG__ global variable
+ * when hash is not accessible
+ */
+var console = {
+ log: function() {
+ if (/__DEBUG__/.exec(window.location.hash) || window.__DEBUG__)
+ window._console.log(arguments)
+ }
+}
2  public/javascripts/tests/models/collection_test.js
View
@@ -107,7 +107,7 @@ describe('Collection:', function() {
it('selectLastBy: selects the model by the given attributes', function() {
this.collection.selectLastBy({ number: 1 });
this.server.respond();
- expect(this.collection.get(1).selected).toBeTruthy();
+ expect(this.collection.at(0).selected).toBeTruthy();
});
it('getOrFetchLast: fetches the collection and then gets the last model', function() {
3  spec/acceptance/acceptance_helper.rb
View
@@ -11,6 +11,9 @@
config.before(:each) do
Capybara.current_driver = :selenium
end
+
+ config.include AcceptanceHelpers
+ config.include NavigationHelpers
end
Capybara.default_selector = :css
20 spec/acceptance/build_spec.rb
View
@@ -20,6 +20,24 @@
scenario "build gets queued" do
visit "/"
dispatch_pusher_command 'jobs', 'build:queued', build_queued_event_info
- should_see_text 'rails/rails'
+
+ with_scope "#jobs" do
+ should_see_text 'rails/rails'
+ end
+ end
+
+ scenario "build is removed from queue" do
+ visit "/"
+
+ dispatch_pusher_command 'jobs', 'build:queued', build_queued_event_info
+ dispatch_pusher_command 'jobs', 'build:started', build_queued_event_info
+
+ with_scope "#repositories" do
+ should_see_text "rails/rails"
+ end
+
+ with_scope "#jobs" do
+ should_not_see_text 'rails/rails'
+ end
end
end
2  spec/acceptance/my_repositories_spec.rb
View
@@ -15,9 +15,7 @@
# It's not clear what exactly capybara have changed so that Rspec includes do not function. But that's not a good approach.
end
scenario "my repositories" do
- self.extend HelperMethods
self.extend OmniauthHelperMethods
- self.extend NavigationHelpers
mock_omniauth
10 spec/acceptance/support/helpers.rb
View
@@ -1,10 +1,18 @@
-module HelperMethods
+module AcceptanceHelpers
+ def with_scope(locator)
+ locator ? within(locator) { yield } : yield
+ end
+
def should_see_text text
wait_until do
find :xpath, "//*[contains(text(), '#{text}')]"
end
end
+ def should_not_see_text text
+ page.should have_no_content(text)
+ end
+
def dispatch_pusher_command channel, command, params
page.evaluate_script("trigger('#{channel}', '#{command}', '#{params.to_json}' )")
end
30 spec/spec_helper.rb
View
@@ -1,11 +1,29 @@
-# This file is copied to spec/ when you run 'rails generate rspec:install'
+begin
+ require 'rubygems'
+ require 'spork'
+rescue LoadError => e
+end
+
ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../../config/environment", __FILE__)
-require 'rspec/rails'
-# Requires supporting ruby files with custom matchers and macros, etc,
-# in spec/support/ and its subdirectories.
-Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+def configure
+ require File.expand_path("../../config/environment", __FILE__)
+ require 'rspec/rails'
+
+ # Requires supporting ruby files with custom matchers and macros, etc,
+ # in spec/support/ and its subdirectories.
+ Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+end
+
+if defined? Spork
+ Spork.prefork do
+ configure
+ end
+else
+ configure
+end
+
+
RSpec.configure do |config|
# == Mock Framework
2  test/test_helper.rb
View
@@ -26,7 +26,7 @@ def setup
Mocha::Mockery.instance.verify
Travis.pusher = TestHelpers::Mocks::Pusher.new
- Resque.redis = FakeRedis::Redis.new
+ Resque.redis = Redis.new
DatabaseCleaner.start
Please sign in to comment.
Something went wrong with that request. Please try again.