diff options
-rw-r--r-- | Gemfile | 6 | ||||
-rw-r--r-- | Gemfile.lock | 102 | ||||
-rw-r--r-- | Rakefile | 3 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 4 | ||||
-rw-r--r-- | app/views/admin/projects/show.html.haml | 6 | ||||
-rw-r--r-- | app/views/charts/_overall.haml | 8 | ||||
-rw-r--r-- | config/environments/development.rb | 4 | ||||
-rw-r--r-- | config/environments/production.rb | 3 | ||||
-rw-r--r-- | config/initializers/cookies_serializer.rb | 3 | ||||
-rw-r--r-- | config/initializers/session_store.rb | 2 | ||||
-rw-r--r-- | config/initializers/state_machine_patch.rb | 9 | ||||
-rw-r--r-- | config/routes.rb | 4 | ||||
-rw-r--r-- | lib/charts.rb | 8 | ||||
-rw-r--r-- | spec/models/build_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/commit_spec.rb | 4 |
15 files changed, 100 insertions, 70 deletions
@@ -8,7 +8,7 @@ def linux_only(require_as) RUBY_PLATFORM.include?('linux') && require_as end -gem 'rails', '4.0.10' +gem 'rails', '4.1.9' gem 'protected_attributes' gem 'activerecord-deprecated_finders' gem 'activerecord-session_store' @@ -28,7 +28,7 @@ gem 'settingslogic' gem "unicorn", "~> 4.8.2" # Haml -gem 'haml-rails' +gem 'haml-rails','~> 0.5.3' # Background jobs gem 'slim' @@ -92,6 +92,7 @@ end group :development, :test do + gem 'minitest' gem 'pry' gem 'rspec-rails' gem 'capybara' @@ -108,7 +109,6 @@ group :development, :test do gem "simplecov", require: false gem 'coveralls', require: false - gem 'minitest', '4.3.2' gem 'rubocop', '0.28.0', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 979c046..ea71251 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,41 +1,44 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.10) - actionpack (= 4.0.10) + actionmailer (4.1.9) + actionpack (= 4.1.9) + actionview (= 4.1.9) mail (~> 2.5, >= 2.5.4) - actionpack (4.0.10) - activesupport (= 4.0.10) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionpack (4.1.9) + actionview (= 4.1.9) + activesupport (= 4.1.9) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.10) - activesupport (= 4.0.10) - builder (~> 3.1.0) - activerecord (4.0.10) - activemodel (= 4.0.10) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.10) - arel (~> 4.0.0) + actionview (4.1.9) + activesupport (= 4.1.9) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.9) + activesupport (= 4.1.9) + builder (~> 3.1) + activerecord (4.1.9) + activemodel (= 4.1.9) + activesupport (= 4.1.9) + arel (~> 5.0.0) activerecord-deprecated_finders (1.0.3) activerecord-session_store (0.1.0) actionpack (>= 4.0.0, < 5) activerecord (>= 4.0.0, < 5) railties (>= 4.0.0, < 5) - activesupport (4.0.10) + activesupport (4.1.9) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) acts-as-taggable-on (3.4.3) activerecord (>= 3.2, < 5) addressable (2.3.5) annotate (2.6.0) activerecord (>= 2.3.0) rake (>= 0.8.7) - arel (4.0.2) + arel (5.0.1.20140414130214) ast (2.0.0) astrolabe (1.3.0) parser (>= 2.2.0.pre.3, < 3.0) @@ -44,7 +47,7 @@ GEM ice_nine (~> 0.9) bootstrap-sass (3.0.3.0) sass (~> 3.2) - builder (3.1.4) + builder (3.2.2) byebug (3.2.0) columnize (~> 0.8) debugger-linecache (~> 1.2) @@ -131,19 +134,19 @@ GEM guard-rspec (4.2.0) guard (>= 2.1.1) rspec (>= 2.14, < 4.0) - haml (4.0.4) + haml (4.0.6) tilt - haml-rails (0.5.2) - actionpack (~> 4.0.1) - activesupport (~> 4.0.1) + haml-rails (0.5.3) + actionpack (>= 4.0.1) + activesupport (>= 4.0.1) haml (>= 3.1, < 5.0) - railties (~> 4.0.1) + railties (>= 4.0.1) hashie (2.0.5) hike (1.2.3) httparty (0.11.0) multi_json (~> 1.0) multi_xml (>= 0.5.2) - i18n (0.6.11) + i18n (0.7.0) ice_nine (0.11.0) jquery-rails (3.0.4) railties (>= 3.0, < 5.0) @@ -151,7 +154,7 @@ GEM jquery-turbolinks (2.0.1) railties (>= 3.1.0) turbolinks - json (1.8.1) + json (1.8.2) jwt (1.2.0) kaminari (0.15.0) actionpack (>= 3.0.0) @@ -167,12 +170,12 @@ GEM rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) lumberjack (1.0.4) - mail (2.6.1) + mail (2.6.3) mime-types (>= 1.16, < 3) method_source (0.8.2) - mime-types (2.4.1) + mime-types (2.4.3) mini_portile (0.5.2) - minitest (4.3.2) + minitest (5.5.1) multi_json (1.10.1) multi_xml (0.5.5) multipart-post (2.0.0) @@ -196,7 +199,7 @@ GEM multi_json (~> 1.0) websocket-driver (>= 0.2.0) powerpack (0.0.9) - protected_attributes (1.0.5) + protected_attributes (1.0.8) activemodel (>= 4.0.1, < 5.0) pry (0.9.12.4) coderay (~> 1.0) @@ -213,24 +216,26 @@ GEM rack (>= 1.0.0) rack-protection (1.5.1) rack - rack-test (0.6.2) + rack-test (0.6.3) rack (>= 1.0) - rails (4.0.10) - actionmailer (= 4.0.10) - actionpack (= 4.0.10) - activerecord (= 4.0.10) - activesupport (= 4.0.10) + rails (4.1.9) + actionmailer (= 4.1.9) + actionpack (= 4.1.9) + actionview (= 4.1.9) + activemodel (= 4.1.9) + activerecord (= 4.1.9) + activesupport (= 4.1.9) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.10) + railties (= 4.1.9) sprockets-rails (~> 2.0) - railties (4.0.10) - actionpack (= 4.0.10) - activesupport (= 4.0.10) + railties (4.1.9) + actionpack (= 4.1.9) + activesupport (= 4.1.9) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) raindrops (0.13.0) - rake (10.3.2) + rake (10.4.2) rb-fsevent (0.9.3) rb-inotify (0.9.2) ffi (>= 0.5.0) @@ -300,10 +305,10 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.1.4) + sprockets-rails (2.2.4) actionpack (>= 3.0) activesupport (>= 3.0) - sprockets (~> 2.8) + sprockets (>= 2.8, < 4.0) stamp (0.5.0) state_machine (1.2.0) temple (0.6.7) @@ -319,7 +324,8 @@ GEM tins (0.13.1) turbolinks (2.0.0) coffee-rails - tzinfo (0.3.41) + tzinfo (1.2.2) + thread_safe (~> 0.1) uglifier (2.3.2) execjs (>= 0.3.0) json (>= 1.8.0) @@ -366,13 +372,13 @@ DEPENDENCIES grape-entity growl guard-rspec - haml-rails + haml-rails (~> 0.5.3) httparty (= 0.11.0) jquery-rails jquery-turbolinks kaminari letter_opener - minitest (= 4.3.2) + minitest mysql2 nested_form nprogress-rails @@ -383,7 +389,7 @@ DEPENDENCIES pry quiet_assets rack-mini-profiler - rails (= 4.0.10) + rails (= 4.1.9) rake rb-fsevent rb-inotify @@ -4,4 +4,5 @@ require File.expand_path('../config/application', __FILE__) -GitlabCi::Application.load_tasks +# GitlabCi::Application.load_tasks +Rails.application.load_tasks diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index a1f1bb8..a256750 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -4,8 +4,8 @@ module ProjectsHelper end def success_ratio(success_builds, failed_builds) - failed_builds = failed_builds.count - success_builds = success_builds.count + failed_builds = failed_builds.count(:all) + success_builds = success_builds.count(:all) return 100 if failed_builds.zero? diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index e0b9e46..8204a90 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -61,13 +61,13 @@ %legend Builds stats %p Total: - %strong= pluralize @project.builds.count, 'build' + %strong= pluralize @project.builds.count(:all), 'build' %p Successful: - %strong= pluralize @project.builds.success.count, 'build' + %strong= pluralize @project.builds.success.count(:all), 'build' %p Failed: - %strong= pluralize @project.builds.failed.count, 'build' + %strong= pluralize @project.builds.failed.count(:all), 'build' %p Success ratio: diff --git a/app/views/charts/_overall.haml b/app/views/charts/_overall.haml index 34d83ab..f522f35 100644 --- a/app/views/charts/_overall.haml +++ b/app/views/charts/_overall.haml @@ -2,13 +2,13 @@ %legend Overall %p Total: - %strong= pluralize @project.builds.count, 'build' + %strong= pluralize @project.builds.count(:all), 'build' %p Successful: - %strong= pluralize @project.builds.success.count, 'build' + %strong= pluralize @project.builds.success.count(:all), 'build' %p Failed: - %strong= pluralize @project.builds.failed.count, 'build' + %strong= pluralize @project.builds.failed.count(:all), 'build' %p Success ratio: @@ -18,4 +18,4 @@ %p Commits covered: %strong - = @project.commits.count + = @project.commits.count(:all) diff --git a/config/environments/development.rb b/config/environments/development.rb index 1ec813b..6828857 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -31,4 +31,8 @@ GitlabCi::Application.configure do config.eager_load = false config.action_mailer.delivery_method = :letter_opener + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = true end diff --git a/config/environments/production.rb b/config/environments/production.rb index 7cad55b..4c8361c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -74,4 +74,7 @@ GitlabCi::Application.configure do config.eager_load = true config.assets.js_compressor = :uglifier + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false end diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..7f70458 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index d08d823..21ff758 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,4 +1,4 @@ # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails generate session_migration") -GitlabCi::Application.config.session_store :active_record_store +Rails.application.config.session_store :active_record_store diff --git a/config/initializers/state_machine_patch.rb b/config/initializers/state_machine_patch.rb new file mode 100644 index 0000000..72d010f --- /dev/null +++ b/config/initializers/state_machine_patch.rb @@ -0,0 +1,9 @@ +# This is a patch to address the issue in https://github.com/pluginaweek/state_machine/issues/251 +# where gem 'state_machine' was not working for Rails 4.1 +module StateMachine + module Integrations + module ActiveModel + public :around_validation + end + end +end diff --git a/config/routes.rb b/config/routes.rb index 85edbf5..d1ba2c9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,11 +1,11 @@ require 'sidekiq/web' -GitlabCi::Application.routes.draw do +Rails.application.routes.draw do # API API::API.logger Rails.logger mount API::API => '/api' - resource :help do + resource :help do get :oauth2 end diff --git a/lib/charts.rb b/lib/charts.rb index 851518f..93e81a5 100644 --- a/lib/charts.rb +++ b/lib/charts.rb @@ -15,8 +15,12 @@ module Charts def push(from, to, format) @labels << from.strftime(format) - @total << project.builds.where("? > builds.created_at AND builds.created_at > ?", to, from).count - @success << project.builds.where("? > builds.created_at AND builds.created_at > ?", to, from).success.count + @total << project.builds. + where('? > builds.created_at AND builds.created_at > ?', to, from). + count(:all) + @success << project.builds. + where('? > builds.created_at AND builds.created_at > ?', to, from). + success.count(:all) end end diff --git a/spec/models/build_spec.rb b/spec/models/build_spec.rb index f8b44e1..f8db78d 100644 --- a/spec/models/build_spec.rb +++ b/spec/models/build_spec.rb @@ -63,9 +63,9 @@ describe Build do let(:create_from_build) { Build.create_from build } it ('there should be a pending task') do - Build.pending.count.should eq(0) + expect(Build.pending.count(:all)).to eq 0 create_from_build - Build.pending.count.should > 0 + expect(Build.pending.count(:all)).to be > 0 end end diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 79cec87..40ccbe4 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -56,9 +56,9 @@ describe Commit do end it "creates new build" do - commit.builds.count.should == 2 + expect(commit.builds.count(:all)).to eq 2 commit.retry - commit.builds.count.should == 3 + expect(commit.builds.count(:all)).to eq 3 end end |