From fe9a60fd47009f5e7cc80dd688559e7b95db7459 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Thu, 8 Jan 2015 15:41:13 +0200 Subject: [PATCH 1/7] updated rails and gems --- Gemfile | 46 +++--- Gemfile.lock | 223 +++++++++++++++++------------- config/application.rb | 5 + config/environments/production.rb | 2 +- config/environments/test.rb | 2 +- 5 files changed, 161 insertions(+), 117 deletions(-) diff --git a/Gemfile b/Gemfile index bed9be525..6d51e4618 100644 --- a/Gemfile +++ b/Gemfile @@ -1,39 +1,39 @@ source 'https://rubygems.org' # core -gem 'rails', '4.1.4' # '4.2.0' +gem 'rails', '4.2.0' gem 'iso8601', '~> 0.8.2' # for dates and times gem 'hashie_rails', '~> 0.0.1' # model related gem 'pg', '~> 0.18.0' -gem 'ransack', '~> 1.3.0' # '1.5.1' # for searching -gem 'paper_trail', '~> 3.0.5' # '3.0.6' # archiving +gem 'ransack', '~> 1.5.1' # for searching +gem 'paper_trail', '~> 3.0.6' # archiving gem 'rails-settings-cached', '~> 0.4.1' # for settings -gem 'delayed_job_active_record', '~> 4.0.2' # '4.0.3' # delayed job +gem 'delayed_job_active_record', '~> 4.0.3' # delayed job -# html-xml -gem 'haml-rails', '~> 0.5.3' # '0.6.0' haml for views -gem 'nokogiri', '~> 1.6.2.1' # For XML parsing +# html-xml +gem 'haml-rails', '~> 0.6.0' # haml for views +gem 'nokogiri', '~> 1.6.2.1' # For XML parsing # style -gem 'sass-rails', '~> 4.0.3' # '5.0.0' # sass style -gem 'bootstrap-sass', '~> 3.2.0.1' # '3.3.1.0' # bootstrap style +gem 'sass-rails', '~> 5.0.1' # sass style +gem 'bootstrap-sass', '~> 3.3.1.0' # bootstrap style # js -gem 'uglifier', '>= 1.3.0' # '2.6.1' # minifies js -gem 'coffee-rails', '~> 4.0.0' # '4.1.0' # coffeescript support +gem 'uglifier', '~> 2.6.1' # minifies js +gem 'coffee-rails', '~> 4.1.0' # coffeescript support gem 'turbolinks', '~> 2.5.3' # faster page load -gem 'jquery-rails', '~> 3.1.1' # '4.0.3' jquery -gem 'selectize-rails', '~> 0.11.0' # '0.11.2' # include selectize.js for select +gem 'jquery-rails', '~> 4.0.3' # jquery +gem 'selectize-rails', '~> 0.11.2' # include selectize.js for select gem 'therubyracer', platforms: :ruby # view helpers -gem 'kaminari', '~> 0.16.1' # pagination -gem 'nprogress-rails', '~> 0.1.3.1' # '0.1.6.5' # visual loader +gem 'kaminari', '~> 0.16.1' # pagination +gem 'nprogress-rails', '~> 0.1.6.5' # visual loader # rights -gem 'devise', '~> 3.3.0' # '3.4.0' # authenitcation +gem 'devise', '~> 3.4.1' # authenitcation gem 'cancancan', '~> 1.9.2' # autharization # rest api @@ -53,9 +53,9 @@ group :development do gem 'spring', '~> 1.2.0' gem 'spring-commands-rspec', '~> 1.0.2' gem 'guard', '~> 2.6.1' # run tests automatically - gem 'guard-rspec', '~> 4.3.1' - gem 'rubocop', '~> 0.26.1' - gem 'guard-rubocop', '~> 1.1.0' + gem 'guard-rspec', '~> 4.3.1' + gem 'rubocop', '~> 0.26.1' + gem 'guard-rubocop', '~> 1.1.0' # improved errors gem 'better_errors', '~> 2.0.0' @@ -68,7 +68,7 @@ end group :development, :test do # test stack - gem 'rspec-rails', '~> 3.0.2' + gem 'rspec-rails', '~> 3.0.2' gem 'capybara', '~> 2.4.1' gem 'phantomjs-binaries', '~> 1.9.2.4' gem 'poltergeist', '~> 1.5.1' # We are using PhantomJS instead @@ -83,8 +83,8 @@ group :development, :test do gem 'faker', '~> 1.3.0' # Library to generate fake data # EPP - gem 'epp', '~> 1.4.0' # EPP client - gem 'epp-xml', '~> 0.10.3' # EPP XMLs + gem 'epp', '~> 1.4.0' # EPP client + gem 'epp-xml', '~> 0.10.3' # EPP XMLs gem 'uuidtools', '~> 2.1.4' # For unique IDs (used by the epp gem) # debug @@ -96,6 +96,8 @@ group :development, :test do gem 'bullet', '~> 4.14.0' # for finding database optimizations gem 'bundler-audit', '~> 0.3.1' # for finding future vulnerable gems gem 'brakeman', '~> 2.6.2', require: false # for security audit' + # tmp, otherwise conflics with breakman + gem 'html2haml', github: 'haml/html2haml', ref: '6984f50bdbbd6291535027726a5697f28778ee8d' gem 'sdoc', '~> 0.4.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'railroady', '~> 1.3.0' # to generate database diagrams diff --git a/Gemfile.lock b/Gemfile.lock index 4fe5d8289..634f958a4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,36 +1,56 @@ +GIT + remote: git://github.com/haml/html2haml.git + revision: 6984f50bdbbd6291535027726a5697f28778ee8d + ref: 6984f50bdbbd6291535027726a5697f28778ee8d + specs: + html2haml (2.0.0.beta.2) + erubis (~> 2.7.0) + haml (~> 4.0.0) + nokogiri (~> 1.6.0) + ruby_parser (~> 3.5) + GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.4) - actionpack (= 4.1.4) - actionview (= 4.1.4) - mail (~> 2.5.4) - actionpack (4.1.4) - actionview (= 4.1.4) - activesupport (= 4.1.4) - rack (~> 1.5.2) + actionmailer (4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.0) + actionview (= 4.2.0) + activesupport (= 4.2.0) + rack (~> 1.6.0) rack-test (~> 0.6.2) - actionview (4.1.4) - activesupport (= 4.1.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.4) - activesupport (= 4.1.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.0) + activesupport (= 4.2.0) + globalid (>= 0.3.0) + activemodel (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) - activerecord (4.1.4) - activemodel (= 4.1.4) - activesupport (= 4.1.4) - arel (~> 5.0.0) + activerecord (4.2.0) + activemodel (= 4.2.0) + activesupport (= 4.2.0) + arel (~> 6.0) activerecord-import (0.6.0) activerecord (>= 3.0) - activesupport (4.1.4) - i18n (~> 0.6, >= 0.6.9) + activesupport (4.2.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.6) - arel (5.0.1.20140414130214) + arel (6.0.0) ast (2.0.0) astrolabe (1.3.0) parser (>= 2.2.0.pre.3, < 3.0) @@ -38,16 +58,16 @@ GEM descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) - bcrypt (3.1.7) + bcrypt (3.1.9) better_errors (2.0.0) coderay (>= 1.0.0) erubis (>= 2.6.6) rack (>= 0.9.0) - binding_of_caller (0.7.3.pre1) + binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bootstrap-sass (3.2.0.2) + bootstrap-sass (3.3.1.0) sass (~> 3.2) - brakeman (2.6.2) + brakeman (2.6.3) erubis (~> 2.6) fastercsv (~> 1.5) haml (>= 3.0, < 5.0) @@ -66,7 +86,7 @@ GEM bundler (~> 1.2) thor (~> 0.18) cancancan (1.9.2) - capybara (2.4.3) + capybara (2.4.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -79,7 +99,7 @@ GEM coderay (1.1.0) coercible (1.0.0) descendants_tracker (~> 0.0.1) - coffee-rails (4.0.1) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.3.0) @@ -89,17 +109,18 @@ GEM daemons (1.1.9) database_cleaner (1.3.0) debug_inspector (0.0.2) - delayed_job (4.0.4) - activesupport (>= 3.0, < 4.2) - delayed_job_active_record (4.0.2) - activerecord (>= 3.0, < 4.2) + delayed_job (4.0.6) + activesupport (>= 3.0, < 5.0) + delayed_job_active_record (4.0.3) + activerecord (>= 3.0, < 5.0) delayed_job (>= 3.0, < 4.1) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (3.3.0) + devise (3.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) + responders thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) @@ -112,7 +133,7 @@ GEM builder (~> 3.2) equalizer (0.0.9) erubis (2.7.0) - execjs (2.2.1) + execjs (2.2.2) fabrication (2.11.3) faker (1.3.0) i18n (~> 0.5) @@ -125,6 +146,8 @@ GEM ruby_parser (~> 3.1, > 3.1.0) sexp_processor (~> 4.4) formatador (0.2.5) + globalid (0.3.0) + activesupport (>= 4.1.0) grape (0.10.1) activesupport builder @@ -147,12 +170,13 @@ GEM guard-rubocop (1.1.0) guard (~> 2.0) rubocop (~> 0.20) - haml (4.0.5) + haml (4.0.6) tilt - haml-rails (0.5.3) + haml-rails (0.6.0) actionpack (>= 4.0.1) activesupport (>= 4.0.1) haml (>= 3.1, < 5.0) + html2haml (>= 1.0.1) railties (>= 4.0.1) hashie (3.3.2) hashie_rails (0.0.1) @@ -163,14 +187,15 @@ GEM hitimes (1.2.2) hpricot (0.8.6) i18n (0.7.0) - ice_nine (0.11.0) + ice_nine (0.11.1) isikukood (0.1.2) iso8601 (0.8.2) jbuilder (2.2.6) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - jquery-rails (3.1.2) - railties (>= 3.0, < 5.0) + jquery-rails (4.0.3) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.1) kaminari (0.16.1) @@ -181,16 +206,17 @@ GEM addressable (~> 2.3) libv8 (3.16.14.7) libxml-ruby (2.7.0) - listen (2.7.11) + listen (2.8.5) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) + loofah (2.0.1) + nokogiri (>= 1.5.9) lumberjack (1.0.9) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) + mail (2.6.3) + mime-types (>= 1.16, < 3) method_source (0.8.2) - mime-types (1.25.1) + mime-types (2.4.3) mina (0.3.1) open4 (~> 1.3.4) rake @@ -200,13 +226,13 @@ GEM multi_xml (0.5.5) nokogiri (1.6.2.1) mini_portile (= 0.6.0) - nprogress-rails (0.1.3.1) + nprogress-rails (0.1.6.5) open4 (1.3.4) orm_adapter (0.5.0) paper_trail (3.0.6) activerecord (>= 3.0, < 5.0) activesupport (>= 3.0, < 5.0) - parser (2.2.0.pre.5) + parser (2.2.0.1) ast (>= 1.1, < 3.0) slop (~> 3.4, >= 3.4.5) pg (0.18.1) @@ -220,13 +246,12 @@ GEM websocket-driver (>= 0.2.0) polyamorous (1.1.0) activerecord (>= 3.0) - polyglot (0.3.5) powerpack (0.0.9) pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - rack (1.5.2) + rack (1.6.0) rack-accept (0.4.5) rack (>= 0.4) rack-mount (0.8.3) @@ -234,27 +259,36 @@ GEM rack-test (0.6.2) rack (>= 1.0) railroady (1.3.0) - rails (4.1.4) - actionmailer (= 4.1.4) - actionpack (= 4.1.4) - actionview (= 4.1.4) - activemodel (= 4.1.4) - activerecord (= 4.1.4) - activesupport (= 4.1.4) + rails (4.2.0) + actionmailer (= 4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) + activemodel (= 4.2.0) + activerecord (= 4.2.0) + activesupport (= 4.2.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.4) - sprockets-rails (~> 2.0) + railties (= 4.2.0) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.5) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.1) + loofah (~> 2.0) rails-settings-cached (0.4.1) rails (>= 4.0.0) - railties (4.1.4) - actionpack (= 4.1.4) - activesupport (= 4.1.4) + railties (4.2.0) + actionpack (= 4.2.0) + activesupport (= 4.2.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) raindrops (0.13.0) rake (10.4.2) - ransack (1.3.0) + ransack (1.5.1) actionpack (>= 3.0) activerecord (>= 3.0) activesupport (>= 3.0) @@ -263,7 +297,7 @@ GEM rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) - rdoc (4.1.2) + rdoc (4.2.0) json (~> 1.4) reek (1.3.8) rainbow (>= 1.99, < 3.0) @@ -271,6 +305,8 @@ GEM ruby_parser (~> 3.3) sexp_processor ref (1.0.5) + responders (2.0.2) + railties (>= 4.2.0.alpha, < 5) rspec (3.0.0) rspec-core (~> 3.0.0) rspec-expectations (~> 3.0.0) @@ -297,7 +333,7 @@ GEM powerpack (~> 0.0.6) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.4) - ruby-progressbar (1.6.0) + ruby-progressbar (1.7.1) ruby2ruby (2.1.3) ruby_parser (~> 3.1) sexp_processor (~> 4.0) @@ -310,16 +346,17 @@ GEM reek (= 1.3.8) ruby2ruby (>= 2.1.1, < 3.0) virtus (~> 1.0) - sass (3.2.19) - sass-rails (4.0.3) + sass (3.4.9) + sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) - sprockets-rails (~> 2.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - selectize-rails (0.11.0) + selectize-rails (0.11.2) sexp_processor (4.4.4) shoulda-matchers (2.6.2) activesupport (>= 3.0.0) @@ -329,25 +366,25 @@ GEM simplecov-html (~> 0.8.0) simplecov-html (0.8.0) simpleidn (0.0.5) - slim (2.0.3) - temple (~> 0.6.6) + slim (2.1.0) + temple (~> 0.6.9) tilt (>= 1.3.3, < 2.1) slop (3.6.0) spring (1.2.0) - spring-commands-rspec (1.0.2) + spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (2.8.0) + sprockets (2.12.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.1.4) + sprockets-rails (2.2.2) actionpack (>= 3.0) activesupport (>= 3.0) - sprockets (~> 2.8) + sprockets (>= 2.8, < 4.0) sys-uname (0.9.0) ffi (>= 1.0.0) - temple (0.6.8) + temple (0.6.10) terminal-table (1.4.5) therubyracer (0.12.1) libv8 (~> 3.16.14.0) @@ -359,14 +396,11 @@ GEM hitimes traceroute (0.4.0) rails (>= 3.0.0) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.5.3) + uglifier (2.6.1) execjs (>= 0.3.0) json (>= 1.8.0) unicorn (4.8.3) @@ -375,14 +409,16 @@ GEM raindrops (~> 0.7) uniform_notifier (1.6.2) uuidtools (2.1.5) - virtus (1.0.3) + virtus (1.0.4) axiom-types (~> 0.1) coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) equalizer (~> 0.0, >= 0.0.9) warden (1.2.3) rack (>= 1.0) - websocket-driver (0.3.5) + websocket-driver (0.5.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.1) whenever (0.9.4) chronic (>= 0.6.3) xpath (2.0.0) @@ -395,17 +431,17 @@ DEPENDENCIES activerecord-import (~> 0.6.0) better_errors (~> 2.0.0) binding_of_caller (~> 0.7.2) - bootstrap-sass (~> 3.2.0.1) + bootstrap-sass (~> 3.3.1.0) brakeman (~> 2.6.2) bullet (~> 4.14.0) bundler-audit (~> 0.3.1) cancancan (~> 1.9.2) capybara (~> 2.4.1) - coffee-rails (~> 4.0.0) + coffee-rails (~> 4.1.0) daemons (~> 1.1.9) database_cleaner (~> 1.3.0) - delayed_job_active_record (~> 4.0.2) - devise (~> 3.3.0) + delayed_job_active_record (~> 4.0.3) + devise (~> 3.4.1) epp (~> 1.4.0) epp-xml (~> 0.10.3) fabrication (~> 2.11.3) @@ -414,33 +450,34 @@ DEPENDENCIES guard (~> 2.6.1) guard-rspec (~> 4.3.1) guard-rubocop (~> 1.1.0) - haml-rails (~> 0.5.3) + haml-rails (~> 0.6.0) hashie_rails (~> 0.0.1) + html2haml! isikukood iso8601 (~> 0.8.2) jbuilder (~> 2.2.6) - jquery-rails (~> 3.1.1) + jquery-rails (~> 4.0.3) kaminari (~> 0.16.1) launchy (~> 2.4.3) mina (~> 0.3.1) nokogiri (~> 1.6.2.1) - nprogress-rails (~> 0.1.3.1) - paper_trail (~> 3.0.5) + nprogress-rails (~> 0.1.6.5) + paper_trail (~> 3.0.6) pg (~> 0.18.0) phantomjs (~> 1.9.7.1) phantomjs-binaries (~> 1.9.2.4) poltergeist (~> 1.5.1) pry (~> 0.10.1) railroady (~> 1.3.0) - rails (= 4.1.4) + rails (= 4.2.0) rails-settings-cached (~> 0.4.1) - ransack (~> 1.3.0) + ransack (~> 1.5.1) rspec-rails (~> 3.0.2) rubocop (~> 0.26.1) rubycritic (~> 1.1.1) - sass-rails (~> 4.0.3) + sass-rails (~> 5.0.1) sdoc (~> 0.4.0) - selectize-rails (~> 0.11.0) + selectize-rails (~> 0.11.2) shoulda-matchers (~> 2.6.1) simplecov (~> 0.9.1) simpleidn (~> 0.0.5) @@ -449,7 +486,7 @@ DEPENDENCIES therubyracer traceroute (~> 0.4.0) turbolinks (~> 2.5.3) - uglifier (>= 1.3.0) + uglifier (~> 2.6.1) unicorn uuidtools (~> 2.1.4) whenever (~> 0.9.4) diff --git a/config/application.rb b/config/application.rb index 72702bcfe..8a04a0355 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,6 +30,11 @@ module Registry config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')] + # Active Record used to suppresses errors raised within `after_rollback`/`after_commit` callbacks + # and only printed them to the logs. In the next version, these errors will no longer be suppressed. + # Instead, the errors will propagate normally just like in other Active Record callbacks. + config.active_record.raise_in_transactional_callbacks = true + config.generators do |g| g.stylesheets false g.javascripts false diff --git a/config/environments/production.rb b/config/environments/production.rb index c194ef526..386dcdd55 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -20,7 +20,7 @@ Rails.application.configure do # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false + config.serve_static_files = false # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier diff --git a/config/environments/test.rb b/config/environments/test.rb index 9b23de20e..ecc572090 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,7 +13,7 @@ Rails.application.configure do config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true + config.serve_static_files = true config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. From 1054a3d2ba8099ac96468d64b0ca2e6722d51136 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Thu, 8 Jan 2015 15:45:15 +0200 Subject: [PATCH 2/7] updated ruby --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index eca07e4c1..ccbccc3dc 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.2 +2.2.0 From 4d46e0b0a044d33b3f16240274857995f63c3de9 Mon Sep 17 00:00:00 2001 From: Priit Tark Date: Thu, 8 Jan 2015 15:51:52 +0200 Subject: [PATCH 3/7] cleanup readme --- config/application.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index 8a04a0355..8de7bca3d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -30,8 +30,9 @@ module Registry config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')] - # Active Record used to suppresses errors raised within `after_rollback`/`after_commit` callbacks - # and only printed them to the logs. In the next version, these errors will no longer be suppressed. + # Active Record used to suppresses errors raised within + # `after_rollback`/`after_commit` callbacks and only printed them to the logs. + # In the next version, these errors will no longer be suppressed. # Instead, the errors will propagate normally just like in other Active Record callbacks. config.active_record.raise_in_transactional_callbacks = true From 179845289bba48bcbdb1bd7e6850ecdd0e2bb5e8 Mon Sep 17 00:00:00 2001 From: Martin Lensment Date: Thu, 8 Jan 2015 16:48:04 +0200 Subject: [PATCH 4/7] Fix tests --- app/models/nameserver.rb | 9 --------- spec/models/dnskey_spec.rb | 4 ++-- spec/models/domain_spec.rb | 1 - spec/support/epp.rb | 16 ++++++++++------ 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/app/models/nameserver.rb b/app/models/nameserver.rb index 86ca827af..65373034d 100644 --- a/app/models/nameserver.rb +++ b/app/models/nameserver.rb @@ -10,9 +10,6 @@ class Nameserver < ActiveRecord::Base validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true } # rubocop: enable Metrics/LineLength - # caching - after_commit :create_cache, on: [:create, :update] - # archiving has_paper_trail class_name: 'NameserverVersion' after_destroy :domain_version @@ -55,12 +52,6 @@ class Nameserver < ActiveRecord::Base domain.create_version if domain end - def create_cache - CachedNameserver.create(snapshot) - rescue ActiveRecord::RecordNotUnique - logger.info('Nameserver already exists in cache; not caching') - end - def to_s hostname end diff --git a/spec/models/dnskey_spec.rb b/spec/models/dnskey_spec.rb index 6e84ae02f..4b891a676 100644 --- a/spec/models/dnskey_spec.rb +++ b/spec/models/dnskey_spec.rb @@ -14,7 +14,7 @@ describe Dnskey do dk.generate_digest expect(dk.ds_digest).to eq('0B62D1BC64EFD1EE652FB102BDF1011BF514CCD9A1A0CFB7472AEA3B01F38C92') - expect(dk.ds_key_tag).to eq(30607) + expect(dk.ds_key_tag).to eq('30607') end it 'generates correct DS digest and DS key tag for emta.ee' do @@ -37,6 +37,6 @@ describe Dnskey do dk.save expect(dk.ds_digest).to eq('D7045D3C2EF7332409A132D935C8E2834A2AAB769B35BC370FA68C9445398288') - expect(dk.ds_key_tag).to eq(31051) + expect(dk.ds_key_tag).to eq('31051') end end diff --git a/spec/models/domain_spec.rb b/spec/models/domain_spec.rb index 2d2abded4..b61c2aa19 100644 --- a/spec/models/domain_spec.rb +++ b/spec/models/domain_spec.rb @@ -48,7 +48,6 @@ describe Domain do d = Domain.new expect(d.valid?).to be false expect(d.errors.messages).to match_array({ - period: ['is not a number'], owner_contact: ['Registrant is missing'], admin_contacts: ['Admin contacts count must be between 1 - infinity'], nameservers: ['Nameservers count must be between 2-11'], diff --git a/spec/support/epp.rb b/spec/support/epp.rb index 6203c2efa..52250d63c 100644 --- a/spec/support/epp.rb +++ b/spec/support/epp.rb @@ -193,9 +193,11 @@ module Epp } ], registrant: { value: 'jd1234' }, - contact: { value: 'sh8013', attrs: { type: 'admin' } }, - contact: { value: 'sh8013', attrs: { type: 'tech' } }, - contact: { value: 'sh801333', attrs: { type: 'tech' } }, + _anonymus: [ + { contact: { value: 'sh8013', attrs: { type: 'admin' } } }, + { contact: { value: 'sh8013', attrs: { type: 'tech' } } }, + { contact: { value: 'sh801333', attrs: { type: 'tech' } } } + ], authInfo: { pw: { value: '2fooBAR' @@ -235,9 +237,11 @@ module Epp } ], registrant: { value: 'jd1234' }, - contact: { value: 'sh8013', attrs: { type: 'admin' } }, - contact: { value: 'sh8013', attrs: { type: 'tech' } }, - contact: { value: 'sh801333', attrs: { type: 'tech' } }, + _anonymus: [ + { contact: { value: 'sh8013', attrs: { type: 'admin' } } }, + { contact: { value: 'sh8013', attrs: { type: 'tech' } } }, + { contact: { value: 'sh801333', attrs: { type: 'tech' } } } + ], authInfo: { pw: { value: '2fooBAR' From c0357c7717d8d6886a6569d987714f7ed74072f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Thu, 8 Jan 2015 17:47:54 +0200 Subject: [PATCH 5/7] Contact associations loaded eagerly where needed --- app/helpers/epp/contacts_helper.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/helpers/epp/contacts_helper.rb b/app/helpers/epp/contacts_helper.rb index 702efa5ee..20982b336 100644 --- a/app/helpers/epp/contacts_helper.rb +++ b/app/helpers/epp/contacts_helper.rb @@ -39,9 +39,11 @@ module Epp::ContactsHelper def info_contact handle_errors(@contact) and return unless @contact handle_errors(@contact) and return unless rights? - @disclosure = ContactDisclosure.default_values.merge(@contact.disclosure.try(:as_hash) || {}) + @disclosure = ContactDisclosure.default_values.merge(@contact.disclosure.try(:as_hash) || {}) @disclosure_policy = @contact.disclosure.try(:attributes_with_flag) @owner = owner?(false) + # need to reload contact eagerly + @contact = find_contact('with eager load') if @owner # for clarity, could just be true render 'epp/contacts/info' end @@ -109,8 +111,12 @@ module Epp::ContactsHelper ## SHARED - def find_contact - contact = Contact.find_by(code: @ph[:id]) + def find_contact(eager_load=nil) + if eager_load + contact = Contact.includes(address: :country).find_by(code: @ph[:id]) + else + contact = Contact.find_by(code: @ph[:id]) + end unless contact epp_errors << { code: '2303', msg: t('errors.messages.epp_obj_does_not_exist'), From d57eac8f9820eab3fa76c6037455d662529663f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Fri, 9 Jan 2015 09:43:57 +0200 Subject: [PATCH 6/7] Rubocop style fixes --- app/helpers/epp/contacts_helper.rb | 4 ++-- spec/models/contact_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/epp/contacts_helper.rb b/app/helpers/epp/contacts_helper.rb index 20982b336..0c5b6fcf4 100644 --- a/app/helpers/epp/contacts_helper.rb +++ b/app/helpers/epp/contacts_helper.rb @@ -39,7 +39,7 @@ module Epp::ContactsHelper def info_contact handle_errors(@contact) and return unless @contact handle_errors(@contact) and return unless rights? - @disclosure = ContactDisclosure.default_values.merge(@contact.disclosure.try(:as_hash) || {}) + @disclosure = ContactDisclosure.default_values.merge(@contact.disclosure.try(:as_hash) || {}) @disclosure_policy = @contact.disclosure.try(:attributes_with_flag) @owner = owner?(false) # need to reload contact eagerly @@ -111,7 +111,7 @@ module Epp::ContactsHelper ## SHARED - def find_contact(eager_load=nil) + def find_contact(eager_load = nil) if eager_load contact = Contact.includes(address: :country).find_by(code: @ph[:id]) else diff --git a/spec/models/contact_spec.rb b/spec/models/contact_spec.rb index e8e65d9a4..d06b23525 100644 --- a/spec/models/contact_spec.rb +++ b/spec/models/contact_spec.rb @@ -18,11 +18,11 @@ describe Contact do end it 'validates birthday' do - invalid = [ '123' '12/12/2012', 'aaaa', '12/12/12', '02-11-1999' ] + invalid = ['123' '12/12/2012', 'aaaa', '12/12/12', '02-11-1999'] invalid.each do |date| expect(Fabricate.build(:contact, ident_type: 'birthday', ident: date).valid?).to be false end - valid = [ '2012-12-11', '1990-02-16' ] + valid = ['2012-12-11', '1990-02-16'] valid.each do |date| expect(Fabricate.build(:contact, ident_type: 'birthday', ident: date).valid?).to be true end From 9a3a9ed6f40e7075b0e5774a395fe93d000e4c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andres=20Keskk=C3=BCla?= Date: Fri, 9 Jan 2015 09:49:31 +0200 Subject: [PATCH 7/7] Cyclomatic complexity fix --- app/helpers/epp/contacts_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/epp/contacts_helper.rb b/app/helpers/epp/contacts_helper.rb index 0c5b6fcf4..3664c4aa9 100644 --- a/app/helpers/epp/contacts_helper.rb +++ b/app/helpers/epp/contacts_helper.rb @@ -37,8 +37,8 @@ module Epp::ContactsHelper end def info_contact - handle_errors(@contact) and return unless @contact - handle_errors(@contact) and return unless rights? + handle_errors(@contact) and return unless @contact && rights? + # handle_errors(@contact) and return unless rights? @disclosure = ContactDisclosure.default_values.merge(@contact.disclosure.try(:as_hash) || {}) @disclosure_policy = @contact.disclosure.try(:attributes_with_flag) @owner = owner?(false)