From ea566952fb426d7f159539f08e22f490921ab8eb Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Fri, 11 May 2012 14:07:52 -0700 Subject: [PATCH 01/30] Don't user env var for EY_PASSWORD --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index f630c8c..7bba5e9 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -24,7 +24,7 @@ set :keep_releases, 5 set :application, "translatable" set :user, "g5search" -set :password, ENV['EY_PASSWORD'] +set :password, EY_PASSWORD set :deploy_to, "/data/#{application}" set :monit_group, "translatable" set :runner, "g5search" From 766fc93039cd6df0426f238357b681b6928d98ef Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Fri, 11 May 2012 14:09:23 -0700 Subject: [PATCH 02/30] Include config/developers/logins.rb --- config/deploy.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index 7bba5e9..8a53904 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -3,6 +3,8 @@ require "eycap/recipes" require "bundler/capistrano" +require "config/developers/logins" if File.exist?("config/developers/logins.rb") + # Servers DEMO = "72.46.233.145:7000" From 5f617ee9658f09789a7716b344a090cc16584da1 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Fri, 11 May 2012 14:11:54 -0700 Subject: [PATCH 03/30] Add demo to deploy.rb --- config/deploy.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index 8a53904..4b0ebf1 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -83,6 +83,12 @@ set :rails_env, "staging" end +task :demo do + role :web, DEMO + role :app, DEMO, :mongrel => true + set :rails_env, "demo" +end + #after "deploy:update_code", "pipeline_precompile" # Do not change below unless you know what you are doing! From 55d81b194b8b530aca67454335f82f77c4c10f6e Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Fri, 11 May 2012 14:20:04 -0700 Subject: [PATCH 04/30] Fix busted trash can image --- app/views/translations/index.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/translations/index.html.haml b/app/views/translations/index.html.haml index b15e638..6c81027 100644 --- a/app/views/translations/index.html.haml +++ b/app/views/translations/index.html.haml @@ -34,7 +34,7 @@ - for translation in translations %tr{'data-key' => translation.key, 'data-url' => translation_url('x')} %td - = link_to(image_tag('/assets/trash_can1.png'), '#', :class => 'destroy-translation') + = link_to(image_tag(asset_path("trash_can1.png")), '#', :class => 'destroy-translation') %td.key= translation.key %td.value %span.editable= translation.value From bcbcd4d7c0d320904fc08388fadf5c8c755a31b6 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Thu, 8 Nov 2012 13:48:25 -0800 Subject: [PATCH 05/30] Update rb-fsevent gem in test block --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index b812690..88abaa2 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ unless ENV["TRAVIS"] #gem 'ruby-debug19', :require => 'ruby-debug', :group => [:developmen, :test] group :test do - gem 'rb-fsevent', '>= 0.4.3' + gem 'rb-fsevent', '0.9.2' gem 'growl', '>= 1.0.3' gem "spork", '>= 0.9.0.rc9' end diff --git a/Gemfile.lock b/Gemfile.lock index 79e8ebc..f41ec97 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -129,7 +129,7 @@ GEM thor (~> 0.14.6) raindrops (0.7.0) rake (0.9.2) - rb-fsevent (0.4.3.1) + rb-fsevent (0.9.2) rdoc (3.10) json (~> 1.4) redis (2.2.2) @@ -206,7 +206,7 @@ DEPENDENCIES haml (~> 3.1.3) jquery-rails (~> 1.0.14) rails (= 3.1.1) - rb-fsevent (>= 0.4.3) + rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) rspec-rails (~> 2.6.1) From 4485afb03163513e1e68c04e55bf5f10d6433b5c Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Thu, 8 Nov 2012 15:00:12 -0800 Subject: [PATCH 06/30] Only keep 3 releases --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 4b0ebf1..002fbba 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -23,7 +23,7 @@ # the URL of the repository you want this recipe to correspond to. The :deploy_to variable must be # the root of the application. -set :keep_releases, 5 +set :keep_releases, 3 set :application, "translatable" set :user, "g5search" set :password, EY_PASSWORD From 050d604795e6cb66403726980547c4950e9ee30d Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Wed, 16 Jan 2013 14:21:17 -0800 Subject: [PATCH 07/30] Update rails gem --- Gemfile | 4 +- Gemfile.lock | 104 +++++++++++++++++++++++++-------------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/Gemfile b/Gemfile index 88abaa2..9443b2d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -gem 'rails', '3.1.1' +gem 'rails', '3.1.10' gem 'haml', '~> 3.1.3' gem 'settingslogic', '~> 2.0.6' @@ -9,7 +9,7 @@ gem 'redis-store', '~> 1.0.0.rc1' gem "SystemTimer", "~> 1.2" gem 'thin', '~> 1.2.11' gem 'unicorn', '~> 4.1.1' -gem 'eycap', ">= 0.5.22" +gem "eycap", '0.5.22' gem 'therubyracer', '~> 0.9.4', :groups => [:staging, :production] diff --git a/Gemfile.lock b/Gemfile.lock index f41ec97..716aff3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,37 +2,37 @@ GEM remote: http://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (3.1.1) - actionpack (= 3.1.1) - mail (~> 2.3.0) - actionpack (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) + actionmailer (3.1.10) + actionpack (= 3.1.10) + mail (~> 2.3.3) + actionpack (3.1.10) + activemodel (= 3.1.10) + activesupport (= 3.1.10) builder (~> 3.0.0) erubis (~> 2.7.0) i18n (~> 0.6) - rack (~> 1.3.2) - rack-cache (~> 1.1) + rack (~> 1.3.6) + rack-cache (~> 1.2) rack-mount (~> 0.8.2) rack-test (~> 0.6.1) - sprockets (~> 2.0.2) - activemodel (3.1.1) - activesupport (= 3.1.1) + sprockets (~> 2.0.4) + activemodel (3.1.10) + activesupport (= 3.1.10) builder (~> 3.0.0) i18n (~> 0.6) - activerecord (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - arel (~> 2.2.1) + activerecord (3.1.10) + activemodel (= 3.1.10) + activesupport (= 3.1.10) + arel (~> 2.2.3) tzinfo (~> 0.3.29) - activeresource (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - activesupport (3.1.1) - multi_json (~> 1.0) + activeresource (3.1.10) + activemodel (= 3.1.10) + activesupport (= 3.1.10) + activesupport (3.1.10) + multi_json (>= 1.0, < 1.3) ansi (1.3.0) - arel (2.2.1) - builder (3.0.0) + arel (2.2.3) + builder (3.0.4) capistrano (2.8.0) highline net-scp (>= 1.0.0) @@ -76,61 +76,61 @@ GEM guard (>= 0.8.4) spork (>= 0.8.4) haml (3.1.3) - highline (1.6.2) + highline (1.6.15) hike (1.2.1) - hoe (3.0.5) - rake (~> 0.8) - i18n (0.6.0) + hoe (3.4.0) + rake (>= 0.8, < 11.0) + i18n (0.6.1) jquery-rails (1.0.14) railties (~> 3.0) thor (~> 0.14) - json (1.6.1) + json (1.7.6) json_pure (1.6.1) kgio (2.6.0) libv8 (3.3.10.2) - mail (2.3.0) + mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.16) - multi_json (1.0.3) + mime-types (1.19) + multi_json (1.2.0) net-scp (1.0.4) net-ssh (>= 1.99.1) net-sftp (2.0.5) net-ssh (>= 2.0.9) - net-ssh (2.2.1) + net-ssh (2.6.3) net-ssh-gateway (1.1.0) net-ssh (>= 1.99.1) nokogiri (1.5.0) - polyglot (0.3.2) - rack (1.3.4) - rack-cache (1.1) + polyglot (0.3.3) + rack (1.3.9) + rack-cache (1.2) rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) rack-ssl (1.3.2) rack - rack-test (0.6.1) + rack-test (0.6.2) rack (>= 1.0) - rails (3.1.1) - actionmailer (= 3.1.1) - actionpack (= 3.1.1) - activerecord (= 3.1.1) - activeresource (= 3.1.1) - activesupport (= 3.1.1) + rails (3.1.10) + actionmailer (= 3.1.10) + actionpack (= 3.1.10) + activerecord (= 3.1.10) + activeresource (= 3.1.10) + activesupport (= 3.1.10) bundler (~> 1.0) - railties (= 3.1.1) - railties (3.1.1) - actionpack (= 3.1.1) - activesupport (= 3.1.1) + railties (= 3.1.10) + railties (3.1.10) + actionpack (= 3.1.10) + activesupport (= 3.1.10) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) raindrops (0.7.0) - rake (0.9.2) + rake (10.0.3) rb-fsevent (0.9.2) - rdoc (3.10) + rdoc (3.12) json (~> 1.4) redis (2.2.2) redis-store (1.0.0.1) @@ -163,7 +163,7 @@ GEM rubyzip settingslogic (2.0.6) spork (0.9.0.rc9) - sprockets (2.0.2) + sprockets (2.0.4) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) @@ -175,12 +175,12 @@ GEM rack (>= 1.0.0) thor (0.14.6) tilt (1.3.3) - treetop (1.4.10) + treetop (1.4.12) polyglot polyglot (>= 0.3.1) turn (0.8.2) ansi (>= 1.2.2) - tzinfo (0.3.30) + tzinfo (0.3.35) uglifier (1.0.3) execjs (>= 0.3.0) multi_json (>= 1.0.2) @@ -199,13 +199,13 @@ DEPENDENCIES capistrano (~> 2.8.0) capybara-webkit (>= 0.6.1) coffee-rails (~> 3.1.1) - eycap (>= 0.5.22) + eycap (= 0.5.22) growl (>= 1.0.3) guard-rspec (>= 0.4.3) guard-spork (>= 0.2.1) haml (~> 3.1.3) jquery-rails (~> 1.0.14) - rails (= 3.1.1) + rails (= 3.1.10) rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) From b8d14c10259ced453c37649e8c6e8d4d5c4e6a55 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Wed, 13 Feb 2013 20:53:47 -0800 Subject: [PATCH 08/30] Bump rails and various json gems --- Gemfile | 4 ++-- Gemfile.lock | 66 ++++++++++++++++++++++++++-------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Gemfile b/Gemfile index 9443b2d..c1648e2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -gem 'rails', '3.1.10' +gem 'rails', '3.1.11' gem 'haml', '~> 3.1.3' gem 'settingslogic', '~> 2.0.6' @@ -9,7 +9,6 @@ gem 'redis-store', '~> 1.0.0.rc1' gem "SystemTimer", "~> 1.2" gem 'thin', '~> 1.2.11' gem 'unicorn', '~> 4.1.1' -gem "eycap", '0.5.22' gem 'therubyracer', '~> 0.9.4', :groups => [:staging, :production] @@ -25,6 +24,7 @@ gem 'jquery-rails', "~> 1.0.14" group :development do gem 'capistrano', "~> 2.8.0" + gem "eycap", '0.5.22' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 716aff3..ff180a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,12 +2,12 @@ GEM remote: http://rubygems.org/ specs: SystemTimer (1.2.3) - actionmailer (3.1.10) - actionpack (= 3.1.10) + actionmailer (3.1.11) + actionpack (= 3.1.11) mail (~> 2.3.3) - actionpack (3.1.10) - activemodel (= 3.1.10) - activesupport (= 3.1.10) + actionpack (3.1.11) + activemodel (= 3.1.11) + activesupport (= 3.1.11) builder (~> 3.0.0) erubis (~> 2.7.0) i18n (~> 0.6) @@ -16,20 +16,20 @@ GEM rack-mount (~> 0.8.2) rack-test (~> 0.6.1) sprockets (~> 2.0.4) - activemodel (3.1.10) - activesupport (= 3.1.10) + activemodel (3.1.11) + activesupport (= 3.1.11) builder (~> 3.0.0) i18n (~> 0.6) - activerecord (3.1.10) - activemodel (= 3.1.10) - activesupport (= 3.1.10) + activerecord (3.1.11) + activemodel (= 3.1.11) + activesupport (= 3.1.11) arel (~> 2.2.3) tzinfo (~> 0.3.29) - activeresource (3.1.10) - activemodel (= 3.1.10) - activesupport (= 3.1.10) - activesupport (3.1.10) - multi_json (>= 1.0, < 1.3) + activeresource (3.1.11) + activemodel (= 3.1.11) + activesupport (= 3.1.11) + activesupport (3.1.11) + multi_json (~> 1.0) ansi (1.3.0) arel (2.2.3) builder (3.0.4) @@ -84,16 +84,16 @@ GEM jquery-rails (1.0.14) railties (~> 3.0) thor (~> 0.14) - json (1.7.6) - json_pure (1.6.1) + json (1.7.7) + json_pure (1.7.7) kgio (2.6.0) libv8 (3.3.10.2) mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.19) - multi_json (1.2.0) + mime-types (1.21) + multi_json (1.6.0) net-scp (1.0.4) net-ssh (>= 1.99.1) net-sftp (2.0.5) @@ -103,26 +103,26 @@ GEM net-ssh (>= 1.99.1) nokogiri (1.5.0) polyglot (0.3.3) - rack (1.3.9) + rack (1.3.10) rack-cache (1.2) rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) - rack-ssl (1.3.2) + rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) - rails (3.1.10) - actionmailer (= 3.1.10) - actionpack (= 3.1.10) - activerecord (= 3.1.10) - activeresource (= 3.1.10) - activesupport (= 3.1.10) + rails (3.1.11) + actionmailer (= 3.1.11) + actionpack (= 3.1.11) + activerecord (= 3.1.11) + activeresource (= 3.1.11) + activesupport (= 3.1.11) bundler (~> 1.0) - railties (= 3.1.10) - railties (3.1.10) - actionpack (= 3.1.10) - activesupport (= 3.1.10) + railties (= 3.1.11) + railties (3.1.11) + actionpack (= 3.1.11) + activesupport (= 3.1.11) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -130,7 +130,7 @@ GEM raindrops (0.7.0) rake (10.0.3) rb-fsevent (0.9.2) - rdoc (3.12) + rdoc (3.12.1) json (~> 1.4) redis (2.2.2) redis-store (1.0.0.1) @@ -205,7 +205,7 @@ DEPENDENCIES guard-spork (>= 0.2.1) haml (~> 3.1.3) jquery-rails (~> 1.0.14) - rails (= 3.1.10) + rails (= 3.1.11) rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) From ac0751f5b9c3a685b0384c783145b6104f2b3cfe Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Thu, 14 Feb 2013 10:16:01 -0800 Subject: [PATCH 09/30] Bump various gems Bump rails, multi_json, and several test related gems. Also remove, refactor and/or bump a few other gems in the Gemfile. Needed to tweak the spec_helper a bit after this to support the changes. --- Gemfile | 8 ++- Gemfile.lock | 128 ++++++++++++++++++++------------------------ spec/spec_helper.rb | 3 +- 3 files changed, 62 insertions(+), 77 deletions(-) diff --git a/Gemfile b/Gemfile index c1648e2..1ec597a 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem "SystemTimer", "~> 1.2" gem 'thin', '~> 1.2.11' gem 'unicorn', '~> 4.1.1' -gem 'therubyracer', '~> 0.9.4', :groups => [:staging, :production] +gem 'therubyracer', :groups => [:staging, :production] # Gems used only for assets and not required # in production environments by default. @@ -29,10 +29,8 @@ end group :test do gem 'turn', :require => false - gem 'rspec-rails', '~> 2.6.1' - gem 'guard-rspec', '>= 0.4.3' - gem 'guard-spork', '>= 0.2.1' - gem 'capybara-webkit', '>= 0.6.1' + gem 'rspec-rails' + gem 'capybara' end unless ENV["TRAVIS"] diff --git a/Gemfile.lock b/Gemfile.lock index ff180a6..e77b2db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,7 +30,7 @@ GEM activesupport (= 3.1.11) activesupport (3.1.11) multi_json (~> 1.0) - ansi (1.3.0) + ansi (1.4.3) arel (2.2.3) builder (3.0.4) capistrano (2.8.0) @@ -39,69 +39,59 @@ GEM net-sftp (>= 2.0.0) net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) - capybara (1.1.1) + capybara (2.0.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) - xpath (~> 0.1.4) - capybara-webkit (0.7.2) - capybara (>= 1.0.0, < 1.2) - childprocess (0.2.2) - ffi (~> 1.0.6) + xpath (~> 1.0.0) + childprocess (0.3.8) + ffi (~> 1.0, >= 1.0.11) coffee-rails (3.1.1) coffee-script (>= 2.2.0) railties (~> 3.1.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.1.2) - daemons (1.1.4) + coffee-script-source (1.4.0) + daemons (1.1.9) diff-lcs (1.1.3) erubis (2.7.0) - eventmachine (0.12.10) - execjs (1.2.9) + eventmachine (1.0.0) + execjs (1.4.0) multi_json (~> 1.0) eycap (0.5.22) capistrano (>= 2.2.0) hoe (>= 1.5.1) - ffi (1.0.9) + ffi (1.3.1) growl (1.0.3) - guard (0.8.4) - thor (~> 0.14.6) - guard-rspec (0.5.0) - guard (>= 0.8.4) - guard-spork (0.3.1) - guard (>= 0.8.4) - spork (>= 0.8.4) - haml (3.1.3) + haml (3.1.8) highline (1.6.15) hike (1.2.1) - hoe (3.4.0) + hoe (3.5.0) rake (>= 0.8, < 11.0) i18n (0.6.1) - jquery-rails (1.0.14) + jquery-rails (1.0.19) railties (~> 3.0) thor (~> 0.14) json (1.7.7) - json_pure (1.7.7) - kgio (2.6.0) - libv8 (3.3.10.2) + kgio (2.8.0) + libv8 (3.11.8.13) mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.21) multi_json (1.6.0) - net-scp (1.0.4) - net-ssh (>= 1.99.1) - net-sftp (2.0.5) - net-ssh (>= 2.0.9) - net-ssh (2.6.3) - net-ssh-gateway (1.1.0) - net-ssh (>= 1.99.1) - nokogiri (1.5.0) + net-scp (1.1.0) + net-ssh (>= 2.6.5) + net-sftp (2.1.1) + net-ssh (>= 2.6.5) + net-ssh (2.6.5) + net-ssh-gateway (1.2.0) + net-ssh (>= 2.6.5) + nokogiri (1.5.6) polyglot (0.3.3) rack (1.3.10) rack-cache (1.2) @@ -127,7 +117,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) - raindrops (0.7.0) + raindrops (0.10.0) rake (10.0.3) rb-fsevent (0.9.2) rdoc (3.12.1) @@ -135,40 +125,39 @@ GEM redis (2.2.2) redis-store (1.0.0.1) redis (~> 2.2.1) - rspec (2.6.0) - rspec-core (~> 2.6.0) - rspec-expectations (~> 2.6.0) - rspec-mocks (~> 2.6.0) - rspec-core (2.6.4) - rspec-expectations (2.6.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.6.0) - rspec-rails (2.6.1) - actionpack (~> 3.0) - activesupport (~> 3.0) - railties (~> 3.0) - rspec (~> 2.6.0) - rubyzip (0.9.4) - sass (3.1.10) - sass-rails (3.1.4) + ref (1.0.2) + rspec-core (2.12.2) + rspec-expectations (2.12.1) + diff-lcs (~> 1.1.3) + rspec-mocks (2.12.2) + rspec-rails (2.12.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 2.12.0) + rspec-expectations (~> 2.12.0) + rspec-mocks (~> 2.12.0) + rubyzip (0.9.9) + sass (3.2.5) + sass-rails (3.1.7) actionpack (~> 3.1.0) railties (~> 3.1.0) - sass (>= 3.1.4) - sprockets (~> 2.0.0) + sass (>= 3.1.10) tilt (~> 1.3.2) - selenium-webdriver (2.8.0) - childprocess (>= 0.2.1) - ffi (>= 1.0.7) - json_pure + selenium-webdriver (2.29.0) + childprocess (>= 0.2.5) + multi_json (~> 1.0) rubyzip - settingslogic (2.0.6) - spork (0.9.0.rc9) + websocket (~> 1.0.4) + settingslogic (2.0.9) + spork (1.0.0rc3) sprockets (2.0.4) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - therubyracer (0.9.8) - libv8 (~> 3.3.10) + therubyracer (0.11.3) + libv8 (~> 3.11.8.12) + ref thin (1.2.11) daemons (>= 1.0.9) eventmachine (>= 0.12.6) @@ -178,17 +167,18 @@ GEM treetop (1.4.12) polyglot polyglot (>= 0.3.1) - turn (0.8.2) - ansi (>= 1.2.2) + turn (0.9.6) + ansi tzinfo (0.3.35) - uglifier (1.0.3) + uglifier (1.3.0) execjs (>= 0.3.0) - multi_json (>= 1.0.2) + multi_json (~> 1.0, >= 1.0.2) unicorn (4.1.1) kgio (~> 2.4) rack raindrops (~> 0.6) - xpath (0.1.4) + websocket (1.0.7) + xpath (1.0.0) nokogiri (~> 1.3) PLATFORMS @@ -197,23 +187,21 @@ PLATFORMS DEPENDENCIES SystemTimer (~> 1.2) capistrano (~> 2.8.0) - capybara-webkit (>= 0.6.1) + capybara coffee-rails (~> 3.1.1) eycap (= 0.5.22) growl (>= 1.0.3) - guard-rspec (>= 0.4.3) - guard-spork (>= 0.2.1) haml (~> 3.1.3) jquery-rails (~> 1.0.14) rails (= 3.1.11) rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) - rspec-rails (~> 2.6.1) + rspec-rails sass-rails (~> 3.1.4) settingslogic (~> 2.0.6) spork (>= 0.9.0.rc9) - therubyracer (~> 0.9.4) + therubyracer thin (~> 1.2.11) turn uglifier (>= 1.0.3) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 94e67d3..efe1d28 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,7 @@ require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'capybara/rails' + require 'capybara/rspec' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -15,6 +16,4 @@ config.mock_with :rspec end - Capybara.javascript_driver = :webkit - end From 43b48dfd4ee52b133cca2229a2dc3b4ca7f69f1e Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Thu, 14 Feb 2013 10:18:39 -0800 Subject: [PATCH 10/30] Refactor translations integration tests Moved to features dir as per new version of Capybara. Also changed matchers as the within syntax was failing for odd reasons. Lastly modified the test that uses Selenium to use a local Firefox instance instead of going out to Perry's old http://translatable-qa.herokuapp.com/ app sitting on Heroku. --- spec/features/translations_spec.rb | 70 ++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 spec/features/translations_spec.rb diff --git a/spec/features/translations_spec.rb b/spec/features/translations_spec.rb new file mode 100644 index 0000000..6bcbad9 --- /dev/null +++ b/spec/features/translations_spec.rb @@ -0,0 +1,70 @@ +require 'spec_helper' + +describe "Translations" do + + before(:each) do + Translation.send(:store).flushdb + end + + describe "GET /" do + before(:each) do + visit translations_path + end + + it "displays i18n locale filtering" do + page.should have_content("Locales") + page.should have_css("input#filter_by[type=text]") + end + + it "displays create key form" do + within(:css, 'form.new_translation') { + page.should have_css("label[for=translation_key]") + page.should have_css("label[for=translation_value]") + page.should have_css("input[type=submit]") + } + end + + it "displays key/value grid" do + page.should have_content("I18n Key") + page.should have_content("Value") + end + end + + describe "update translation" do + before(:each) do + @key = "foo" + @locale = 'en-US' + Translation.new(:locale => @locale, :key => @key, :value => 'bar').save + visit translations_path(:locale => @locale) + page.should have_css("tr[data-key=#{@key}]") + end + + # Note that this test actually fires up Selenium and requires you to have Firefox installed + it "updates the translation's value", :js => true do + within(:css, "tr[data-key=#{@key}]") { + find('span.editable').click + find('input[type=text]').set('baz') + find('button.save').click + } + page.driver.browser.switch_to.alert.accept + visit translations_path(:locale => @locale) + + find("tbody tr[data-key=#{@key}] td.value span.editable").should have_text("baz") + end + end + + describe "create translation" do + it "should create valid translation" do + visit translations_path + fill_in 'Key', :with => 'trankey' + fill_in 'Value', :with => 'tranvalue' + click_button 'Create' + + find_field('Key').value.should be_blank + find_field('Value').value.should be_blank + + find("tbody tr td.key").should have_text("trankey") + find("tbody tr td.value span.editable").should have_text("tranvalue") + end + end +end From 4f9c0c6323916823e91389de702eefa30e095ad6 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Thu, 14 Feb 2013 10:21:06 -0800 Subject: [PATCH 11/30] Deleting old file --- spec/integration/translations_spec.rb | 78 --------------------------- 1 file changed, 78 deletions(-) delete mode 100644 spec/integration/translations_spec.rb diff --git a/spec/integration/translations_spec.rb b/spec/integration/translations_spec.rb deleted file mode 100644 index 9689ed3..0000000 --- a/spec/integration/translations_spec.rb +++ /dev/null @@ -1,78 +0,0 @@ -require 'spec_helper' - -describe "Translations" do - def set_host (host) - host! host - Capybara.app_host = "http://" + host - end - - before(:each) do - set_host "translatable-qa.herokuapp.com" - Translation.send(:store).flushdb - end - - describe "GET /" do - before(:each) do - visit translations_url - end - - it "displays i18n locale filtering" do - page.should have_content("Locales") - page.should have_css("input#filter_by[type=text]") - end - - it "displays create key form" do - within(:css, 'form.new_translation') { - page.should have_css("label[for=translation_key]") - page.should have_css("label[for=translation_value]") - page.should have_css("input[type=submit]") - } - end - - it "displays key/value grid" do - page.should have_content("I18n Key") - page.should have_content("Value") - end - end - - describe "update translation" do - before(:each) do - @key = "foo" - @locale = 'en-US' - Translation.new(:locale => @locale, :key => @key, :value => 'bar').save - visit translations_url(:locale => @locale) - page.should have_css("tr[data-key=#{@key}]") - end - - it "updates the translation's value", :js => true do - within(:css, "tr[data-key=#{@key}]") { - find('span.editable').click - find('input[type=text]').set('baz') - find('button.save').click - } - visit translations_url(:locale => @locale) - - within(:css, "tbody tr[data-key=#{@key}]") { - find('td.key').text.should == @key - find('td.value span.editable').text.should == 'baz' - } - end - end - - describe "create translation" do - it "should create valid translation" do - visit translations_url - fill_in 'Key', :with => 'trankey' - fill_in 'Value', :with => 'tranvalue' - click_button 'Create' - - find_field('Key').value.should be_blank - find_field('Value').value.should be_blank - - within(:css, 'tbody tr') { - find('td.key').text.should == 'trankey' - find('td.value span.editable').text.should == 'tranvalue' - } - end - end -end From 8bb9f63da7f1c07695f134c3a5eb415aad9ad99c Mon Sep 17 00:00:00 2001 From: maeve Date: Thu, 11 Jul 2013 09:38:09 -0700 Subject: [PATCH 12/30] Upgrade ruby from ree 1.8.7 to mri 1.9.3 --- .rvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rvmrc b/.rvmrc index 3f7b2ac..69c95db 100644 --- a/.rvmrc +++ b/.rvmrc @@ -1 +1 @@ -rvm use --create ree-1.8.7-2011.12@translatable +rvm use --create ruby-1.9.3-p392@translatable From 56e2dfdd9146b912a9d2eae9f491e0ee9fc98d6c Mon Sep 17 00:00:00 2001 From: maeve Date: Thu, 11 Jul 2013 09:38:41 -0700 Subject: [PATCH 13/30] Uninstall SystemTimer as it breaks with ruby 1.9 It's only intended to work around an issue with ruby 1.8. See: http://ph7spot.com/musings/system-timer --- Gemfile | 1 - Gemfile.lock | 2 -- 2 files changed, 3 deletions(-) diff --git a/Gemfile b/Gemfile index 1ec597a..cc3e379 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,6 @@ gem 'haml', '~> 3.1.3' gem 'settingslogic', '~> 2.0.6' gem 'redis', '~> 2.2.2' gem 'redis-store', '~> 1.0.0.rc1' -gem "SystemTimer", "~> 1.2" gem 'thin', '~> 1.2.11' gem 'unicorn', '~> 4.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index e77b2db..923bc0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,6 @@ GEM remote: http://rubygems.org/ specs: - SystemTimer (1.2.3) actionmailer (3.1.11) actionpack (= 3.1.11) mail (~> 2.3.3) @@ -185,7 +184,6 @@ PLATFORMS ruby DEPENDENCIES - SystemTimer (~> 1.2) capistrano (~> 2.8.0) capybara coffee-rails (~> 3.1.1) From f38bb010758f273143ecd02cc34a0d6a4cfec93c Mon Sep 17 00:00:00 2001 From: maeve Date: Thu, 11 Jul 2013 10:03:01 -0700 Subject: [PATCH 14/30] Run capybara specs with poltergeist/phantomjs The selenium driver was having issues. Using a headless browser for testing is way nicer anyway. --- Gemfile | 1 + Gemfile.lock | 8 ++++++++ spec/features/translations_spec.rb | 2 -- spec/spec_helper.rb | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index cc3e379..950ff78 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ group :test do gem 'turn', :require => false gem 'rspec-rails' gem 'capybara' + gem 'poltergeist' end unless ENV["TRAVIS"] diff --git a/Gemfile.lock b/Gemfile.lock index 923bc0f..166372a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,6 +63,8 @@ GEM eycap (0.5.22) capistrano (>= 2.2.0) hoe (>= 1.5.1) + faye-websocket (0.4.7) + eventmachine (>= 0.12.0) ffi (1.3.1) growl (1.0.3) haml (3.1.8) @@ -70,6 +72,7 @@ GEM hike (1.2.1) hoe (3.5.0) rake (>= 0.8, < 11.0) + http_parser.rb (0.5.3) i18n (0.6.1) jquery-rails (1.0.19) railties (~> 3.0) @@ -91,6 +94,10 @@ GEM net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) nokogiri (1.5.6) + poltergeist (1.1.2) + capybara (~> 2.0.1) + faye-websocket (~> 0.4.4) + http_parser.rb (~> 0.5.3) polyglot (0.3.3) rack (1.3.10) rack-cache (1.2) @@ -191,6 +198,7 @@ DEPENDENCIES growl (>= 1.0.3) haml (~> 3.1.3) jquery-rails (~> 1.0.14) + poltergeist rails (= 3.1.11) rb-fsevent (= 0.9.2) redis (~> 2.2.2) diff --git a/spec/features/translations_spec.rb b/spec/features/translations_spec.rb index 6bcbad9..95d316b 100644 --- a/spec/features/translations_spec.rb +++ b/spec/features/translations_spec.rb @@ -39,14 +39,12 @@ page.should have_css("tr[data-key=#{@key}]") end - # Note that this test actually fires up Selenium and requires you to have Firefox installed it "updates the translation's value", :js => true do within(:css, "tr[data-key=#{@key}]") { find('span.editable').click find('input[type=text]').set('baz') find('button.save').click } - page.driver.browser.switch_to.alert.accept visit translations_path(:locale => @locale) find("tbody tr[data-key=#{@key}] td.value span.editable").should have_text("baz") diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index efe1d28..e9a61fb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,6 +7,7 @@ require 'rspec/rails' require 'capybara/rails' require 'capybara/rspec' + require 'capybara/poltergeist' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. @@ -16,4 +17,5 @@ config.mock_with :rspec end + Capybara.javascript_driver = :poltergeist end From 9b2659e2575d7a283f8f4a16f30778d97cfb5fd6 Mon Sep 17 00:00:00 2001 From: maeve Date: Thu, 11 Jul 2013 10:18:17 -0700 Subject: [PATCH 15/30] Replace .rvmrc with .ruby-version and .ruby-gemset --- .ruby-gemset | 1 + .ruby-version | 1 + .rvmrc | 1 - 3 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version delete mode 100644 .rvmrc diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..36ff528 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +translatable diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..2aaf252 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-1.9.3-p392 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 69c95db..0000000 --- a/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm use --create ruby-1.9.3-p392@translatable From 391523148a94f2a65183aed943e11a3adbf511d9 Mon Sep 17 00:00:00 2001 From: maeve Date: Thu, 11 Jul 2013 10:25:04 -0700 Subject: [PATCH 16/30] bundle update A lot of gems dropped support for ruby 1.8 in later versions, so now we can finally upgrade. --- Gemfile.lock | 91 +++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 50 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 166372a..f260c50 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,26 +38,23 @@ GEM net-sftp (>= 2.0.0) net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) - capybara (2.0.2) + capybara (2.1.0) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) - selenium-webdriver (~> 2.0) - xpath (~> 1.0.0) - childprocess (0.3.8) - ffi (~> 1.0, >= 1.0.11) + xpath (~> 2.0) coffee-rails (3.1.1) coffee-script (>= 2.2.0) railties (~> 3.1.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.4.0) + coffee-script-source (1.6.3) daemons (1.1.9) - diff-lcs (1.1.3) + diff-lcs (1.2.4) erubis (2.7.0) - eventmachine (1.0.0) + eventmachine (1.0.3) execjs (1.4.0) multi_json (~> 1.0) eycap (0.5.22) @@ -65,38 +62,39 @@ GEM hoe (>= 1.5.1) faye-websocket (0.4.7) eventmachine (>= 0.12.0) - ffi (1.3.1) growl (1.0.3) haml (3.1.8) - highline (1.6.15) - hike (1.2.1) - hoe (3.5.0) + highline (1.6.19) + hike (1.2.3) + hoe (3.6.3) rake (>= 0.8, < 11.0) http_parser.rb (0.5.3) - i18n (0.6.1) + i18n (0.6.4) jquery-rails (1.0.19) railties (~> 3.0) thor (~> 0.14) - json (1.7.7) + json (1.8.0) kgio (2.8.0) - libv8 (3.11.8.13) + libv8 (3.11.8.17) mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.21) - multi_json (1.6.0) - net-scp (1.1.0) + mime-types (1.23) + mini_portile (0.5.1) + multi_json (1.7.7) + net-scp (1.1.2) net-ssh (>= 2.6.5) - net-sftp (2.1.1) + net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (2.6.5) + net-ssh (2.6.8) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - nokogiri (1.5.6) - poltergeist (1.1.2) - capybara (~> 2.0.1) - faye-websocket (~> 0.4.4) + nokogiri (1.6.0) + mini_portile (~> 0.5.0) + poltergeist (1.3.0) + capybara (~> 2.1.0) + faye-websocket (>= 0.4.4, < 0.5.0) http_parser.rb (~> 0.5.3) polyglot (0.3.3) rack (1.3.10) @@ -123,45 +121,39 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) - raindrops (0.10.0) - rake (10.0.3) + raindrops (0.11.0) + rake (10.1.0) rb-fsevent (0.9.2) - rdoc (3.12.1) + rdoc (3.12.2) json (~> 1.4) redis (2.2.2) redis-store (1.0.0.1) redis (~> 2.2.1) - ref (1.0.2) - rspec-core (2.12.2) - rspec-expectations (2.12.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.12.2) - rspec-rails (2.12.2) + ref (1.0.5) + rspec-core (2.14.2) + rspec-expectations (2.14.0) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.14.1) + rspec-rails (2.14.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 2.12.0) - rspec-expectations (~> 2.12.0) - rspec-mocks (~> 2.12.0) - rubyzip (0.9.9) - sass (3.2.5) + rspec-core (~> 2.14.0) + rspec-expectations (~> 2.14.0) + rspec-mocks (~> 2.14.0) + sass (3.2.9) sass-rails (3.1.7) actionpack (~> 3.1.0) railties (~> 3.1.0) sass (>= 3.1.10) tilt (~> 1.3.2) - selenium-webdriver (2.29.0) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip - websocket (~> 1.0.4) settingslogic (2.0.9) spork (1.0.0rc3) sprockets (2.0.4) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - therubyracer (0.11.3) + therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref thin (1.2.11) @@ -169,22 +161,21 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.14.6) - tilt (1.3.3) - treetop (1.4.12) + tilt (1.3.7) + treetop (1.4.14) polyglot polyglot (>= 0.3.1) turn (0.9.6) ansi - tzinfo (0.3.35) - uglifier (1.3.0) + tzinfo (0.3.37) + uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) unicorn (4.1.1) kgio (~> 2.4) rack raindrops (~> 0.6) - websocket (1.0.7) - xpath (1.0.0) + xpath (2.0.0) nokogiri (~> 1.3) PLATFORMS From 7370b4c081bc04ebbb3dff4b3a8f2896a3601fb0 Mon Sep 17 00:00:00 2001 From: maeve Date: Thu, 11 Jul 2013 12:17:07 -0700 Subject: [PATCH 17/30] Fix deploy script to work under ruby 1.9.3 Ruby 1.9 removes '.' from the load path --- config/deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 002fbba..7605c8b 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -3,8 +3,9 @@ require "eycap/recipes" require "bundler/capistrano" -require "config/developers/logins" if File.exist?("config/developers/logins.rb") +parent_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) +require "#{parent_dir}/config/developers/logins" if File.exist?("#{parent_dir}/config/developers/logins.rb") # Servers DEMO = "72.46.233.145:7000" From 60efdb8aef99fc6e644ec39a8a9b55d2ba85d01e Mon Sep 17 00:00:00 2001 From: maeve Date: Tue, 30 Jul 2013 13:26:22 -0700 Subject: [PATCH 18/30] Use fakeredis for tests --- Gemfile | 1 + Gemfile.lock | 3 +++ spec/spec_helper.rb | 1 + 3 files changed, 5 insertions(+) diff --git a/Gemfile b/Gemfile index 950ff78..62fbed8 100644 --- a/Gemfile +++ b/Gemfile @@ -31,6 +31,7 @@ group :test do gem 'rspec-rails' gem 'capybara' gem 'poltergeist' + gem 'fakeredis' end unless ENV["TRAVIS"] diff --git a/Gemfile.lock b/Gemfile.lock index f260c50..39e758c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,6 +60,8 @@ GEM eycap (0.5.22) capistrano (>= 2.2.0) hoe (>= 1.5.1) + fakeredis (0.3.3) + redis (~> 2.2.0) faye-websocket (0.4.7) eventmachine (>= 0.12.0) growl (1.0.3) @@ -186,6 +188,7 @@ DEPENDENCIES capybara coffee-rails (~> 3.1.1) eycap (= 0.5.22) + fakeredis growl (>= 1.0.3) haml (~> 3.1.3) jquery-rails (~> 1.0.14) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e9a61fb..a94d0e7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,7 @@ require 'capybara/rails' require 'capybara/rspec' require 'capybara/poltergeist' + require 'fakeredis/rspec' # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. From 41584b70a8da0e15c1c691ea5f468999bab84cee Mon Sep 17 00:00:00 2001 From: maeve Date: Tue, 6 Aug 2013 11:24:11 -0700 Subject: [PATCH 19/30] Convert all translation input into valid UTF-8 Unfortunately, this introduced chattiness in the test suite. Something is printing "error : string is not in UTF-8" to STDOUT during feature specs around cp1252 encoded input. I suspect it's one of the test gems. --- app/controllers/translations_controller.rb | 20 ++- .../translations_controller_spec.rb | 135 +++++++++++++++--- spec/features/translations_spec.rb | 45 ++++-- 3 files changed, 172 insertions(+), 28 deletions(-) diff --git a/app/controllers/translations_controller.rb b/app/controllers/translations_controller.rb index 5c1a9cf..5034639 100644 --- a/app/controllers/translations_controller.rb +++ b/app/controllers/translations_controller.rb @@ -1,8 +1,13 @@ class TranslationsController < ApplicationController respond_to :html, :json + before_filter :tidy_params, :only => [:create, :update] before_filter :load_translation, :only => [:update, :destroy] + def tidy_params + tidy_hash(params) + end + def index @translation ||= Translation.new(:locale => locale) end @@ -14,7 +19,8 @@ def create flash[:notice] = "Successfully created I18N Translation." redirect_to translations_url else - render :action => :index + flash[:error] = "Error saving invalid translation." + render :action => :index, :status => 500 end end @@ -47,4 +53,16 @@ def load_translation @translation = Translation.find(:locale => locale, :key => params[:key]) @translation.value = params[:value] if @translation && params[:value] end + + def tidy_hash(hash) + hash.each_pair do |k,v| + if v.respond_to?(:each_pair) + hash[k] = tidy_hash(v) + else + hash[k] = ActiveSupport::Multibyte::Unicode.tidy_bytes(v) + end + end + + hash + end end diff --git a/spec/controllers/translations_controller_spec.rb b/spec/controllers/translations_controller_spec.rb index 5841d49..3daceaa 100644 --- a/spec/controllers/translations_controller_spec.rb +++ b/spec/controllers/translations_controller_spec.rb @@ -35,21 +35,80 @@ end describe "post create" do - before(:each) do - Translation.send(:store).flushdb + subject(:create) do + xhr :post, :create, translation: {key: key, value: value, locale: locale} + end + + before(:each) { Translation.send(:store).flushdb } + + let(:key) { 'create.key' } + let(:value) { 'value for you' } + let(:locale) { 'ck-KK' } + + context 'when translation is valid ASCII' do + it 'should redirect to the translations index' do + create + response.should redirect_to(translations_url) + end + + it 'should create the translation' do + create + expect(Translation.locale_value(locale, key)).to eq(value) + end + end + + context 'when translation key is invalid' do + let(:key) { '' } + + it 'should return 500' do + create + expect(response.status).to eq(500) + end + + it 'should render the translation index' do + create + expect(response).to render_template(:index) + end + + it 'should display an error message' do + create + expect(flash[:error]).to eq('Error saving invalid translation.') + end + + it 'should not save the translation' do + create + expect(Translation.locale_value(locale, key)).to_not be + end end - it "should create translation if valid" do - xhr :post, :create, :translation => {:key => 'create.key', :value => 'value for you', :locale => 'ck-KK'} + context 'when translation key is not UTF-8' do + let(:key) { "\x91key\x92".force_encoding('cp1252') } + + it 'should redirect to the translations index' do + create + response.should redirect_to(translations_url) + end - response.should redirect_to(translations_url) - Translation.locale_value('ck-KK', 'create.key').should == 'value for you' + it 'should create the translation with a UTF-8 string as the key' do + create + utf8_encoded_key = "\u2018key\u2019".force_encoding('utf-8') + expect(Translation.locale_value(locale, utf8_encoded_key)).to eq(value) + end end - it "should return 500 and not save if not valid" do - xhr :post, :create, :translation => {:key => '', :value => 'value for you', :locale => 'ck-KK'} + context 'when translation value is not UTF-8' do + let(:value) { "testing \x97 value".force_encoding('cp1252') } + + it 'should redirect to the translations index' do + create + response.should redirect_to(translations_url) + end - response.should render_template :index + it 'should create the translation with a UTF-8 string as the value' do + create + utf8_encoded_value = "testing \u2014 value".force_encoding('utf-8') + expect(Translation.locale_value(locale, key)).to eq(utf8_encoded_value) + end end end @@ -68,23 +127,63 @@ end describe "put update" do + subject(:update) do + xhr :put, :update, id: translation_id, key: key, value: value + end + before(:each) do Translation.send(:store).flushdb - Translation.new(:locale => 'en-US', :key => 'error', :value => 'big error!').save - Translation.locale_value('en-US', 'error').should == 'big error!' + Translation.new(locale: locale, key: key, value: orig_value).save + end + + let(:locale) { 'en-US' } + let(:translation_id) { 'yada' } + let(:key) { 'error' } + let(:orig_value) { 'big error!' } + + context 'when value is valid ASCII' do + let(:value) { 'even bigger' } + + it 'should respond successfully' do + update + expect(response).to be_success + end + + it 'should update the stored translation value' do + update + expect(Translation.locale_value(locale, key)).to eq(value) + end end - it "should update key" do - xhr :put, :update, :id => 'yada', :key => 'error', :value => 'even bigger' + context 'when translation does not exist' do + let(:translation_id) { 'xx' } + let(:key) { '' } + let(:value) { 'should never happen' } + + it 'should return 500' do + update + expect(response.status).to eq(500) + end - response.should be_success - Translation.locale_value('en-US', 'error').should == 'even bigger' + it 'should not save translation' do + update + expect(Translation.locale_value(locale, key)).to be_nil + end end - it "should return 500 and not save if key not found" do - xhr :put, :update, :id => 'xx', :key => '', :value => 'value for you', :locale => 'ck-KK' + context 'when new value is not UTF-8' do + let(:value) { "testing \x97 value".force_encoding('binary') } + + it 'should response successfully' do + update + expect(response).to be_success + end - response.status.should == 500 + it 'should update the stored translation value' do + utf8_encoded_value = "testing \u2014 value".force_encoding('utf-8') + update + expect(Translation.locale_value(locale, key)).to eq(utf8_encoded_value) + end end end end diff --git a/spec/features/translations_spec.rb b/spec/features/translations_spec.rb index 95d316b..59543e7 100644 --- a/spec/features/translations_spec.rb +++ b/spec/features/translations_spec.rb @@ -31,6 +31,14 @@ end describe "update translation" do + def update_value(value) + within(:css, "tr[data-key=#{@key}]") { + find('span.editable').click + find('input[type=text]').set(value) + find('button.save').click + } + end + before(:each) do @key = "foo" @locale = 'en-US' @@ -40,23 +48,30 @@ end it "updates the translation's value", :js => true do - within(:css, "tr[data-key=#{@key}]") { - find('span.editable').click - find('input[type=text]').set('baz') - find('button.save').click - } + update_value('baz') visit translations_path(:locale => @locale) - find("tbody tr[data-key=#{@key}] td.value span.editable").should have_text("baz") end + + it "replaces invalid encoded characters", :js => true do + windows_encoded_value = "\x93quoted \x97 value\x94".force_encoding('cp1252') + utf8_encoded_value = "\u201cquoted \u2014 value\u201d".force_encoding('utf-8') + update_value(windows_encoded_value) + visit translations_path(:locale => @locale) + find("tbody tr[data-key=#{@key}] td.value span.editable").should have_text(utf8_encoded_value) + end end describe "create translation" do - it "should create valid translation" do + def create_translation(key, value) visit translations_path - fill_in 'Key', :with => 'trankey' - fill_in 'Value', :with => 'tranvalue' + fill_in 'Key', :with => key + fill_in 'Value', :with => value click_button 'Create' + end + + it "should create valid translation" do + create_translation('trankey', 'tranvalue') find_field('Key').value.should be_blank find_field('Value').value.should be_blank @@ -64,5 +79,17 @@ find("tbody tr td.key").should have_text("trankey") find("tbody tr td.value span.editable").should have_text("tranvalue") end + + it "should replace invalid encoded characters" do + windows_encoded_key = "\x91key\x92".force_encoding('cp1252') + utf8_encoded_key = "\u2018key\u2019".force_encoding('utf-8') + + windows_encoded_value = "testing \x97 value".force_encoding('cp1252') + utf8_encoded_value = "testing \u2014 value".force_encoding('utf-8') + create_translation(windows_encoded_key, windows_encoded_value) + + find("tbody tr td.key").should have_text(utf8_encoded_key) + find("tbody tr td.value span.editable").should have_text(utf8_encoded_value) + end end end From 82c757886d09ffbc0d9d0f286bb84b313f16617d Mon Sep 17 00:00:00 2001 From: maeve Date: Tue, 6 Aug 2013 13:17:49 -0700 Subject: [PATCH 20/30] Fix typo in spec description --- spec/controllers/translations_controller_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/controllers/translations_controller_spec.rb b/spec/controllers/translations_controller_spec.rb index 3daceaa..33b685c 100644 --- a/spec/controllers/translations_controller_spec.rb +++ b/spec/controllers/translations_controller_spec.rb @@ -174,7 +174,7 @@ context 'when new value is not UTF-8' do let(:value) { "testing \x97 value".force_encoding('binary') } - it 'should response successfully' do + it 'should respond successfully' do update expect(response).to be_success end From 5171920bdcaa77cdceec1b57bf79f6221ce389d4 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Wed, 5 Mar 2014 10:45:31 -0800 Subject: [PATCH 21/30] Bump rails and related gems --- Gemfile | 23 +++----- Gemfile.lock | 160 +++++++++++++++++++++++---------------------------- 2 files changed, 82 insertions(+), 101 deletions(-) diff --git a/Gemfile b/Gemfile index 62fbed8..f7830ba 100644 --- a/Gemfile +++ b/Gemfile @@ -1,26 +1,21 @@ source 'http://rubygems.org' -gem 'rails', '3.1.11' +gem 'rails', '~> 3.2.17' -gem 'haml', '~> 3.1.3' +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + gem 'uglifier', '>= 1.0.3', :require => 'uglifier' +end + +gem 'haml', '~> 4.0.5' gem 'settingslogic', '~> 2.0.6' gem 'redis', '~> 2.2.2' gem 'redis-store', '~> 1.0.0.rc1' -gem 'thin', '~> 1.2.11' gem 'unicorn', '~> 4.1.1' gem 'therubyracer', :groups => [:staging, :production] -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', "~> 3.1.4" - gem 'coffee-rails', "~> 3.1.1" - gem 'uglifier', ">= 1.0.3" -end - -gem 'jquery-rails', "~> 1.0.14" - group :development do gem 'capistrano', "~> 2.8.0" gem "eycap", '0.5.22' @@ -35,7 +30,7 @@ group :test do end unless ENV["TRAVIS"] - #gem 'ruby-debug19', :require => 'ruby-debug', :group => [:developmen, :test] + #gem 'ruby-debug19', :require => 'ruby-debug', :group => [:development, :test] group :test do gem 'rb-fsevent', '0.9.2' diff --git a/Gemfile.lock b/Gemfile.lock index 39e758c..4800a6d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,36 +1,35 @@ GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.11) - actionpack (= 3.1.11) - mail (~> 2.3.3) - actionpack (3.1.11) - activemodel (= 3.1.11) - activesupport (= 3.1.11) + actionmailer (3.2.17) + actionpack (= 3.2.17) + mail (~> 2.5.4) + actionpack (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) builder (~> 3.0.0) erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.6) + journey (~> 1.0.4) + rack (~> 1.4.5) rack-cache (~> 1.2) - rack-mount (~> 0.8.2) rack-test (~> 0.6.1) - sprockets (~> 2.0.4) - activemodel (3.1.11) - activesupport (= 3.1.11) + sprockets (~> 2.2.1) + activemodel (3.2.17) + activesupport (= 3.2.17) builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.11) - activemodel (= 3.1.11) - activesupport (= 3.1.11) - arel (~> 2.2.3) + activerecord (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) + arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.1.11) - activemodel (= 3.1.11) - activesupport (= 3.1.11) - activesupport (3.1.11) + activeresource (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) + activesupport (3.2.17) + i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) ansi (1.4.3) - arel (2.2.3) + arel (3.0.3) builder (3.0.4) capistrano (2.8.0) highline @@ -38,53 +37,46 @@ GEM net-sftp (>= 2.0.0) net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) - capybara (2.1.0) + capybara (2.2.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - coffee-rails (3.1.1) + cliver (0.3.2) + coffee-rails (3.2.2) coffee-script (>= 2.2.0) - railties (~> 3.1.0) + railties (~> 3.2.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.3) - daemons (1.1.9) + coffee-script-source (1.7.0) diff-lcs (1.2.4) erubis (2.7.0) - eventmachine (1.0.3) - execjs (1.4.0) - multi_json (~> 1.0) + execjs (2.0.2) eycap (0.5.22) capistrano (>= 2.2.0) hoe (>= 1.5.1) fakeredis (0.3.3) redis (~> 2.2.0) - faye-websocket (0.4.7) - eventmachine (>= 0.12.0) growl (1.0.3) - haml (3.1.8) + haml (4.0.5) + tilt highline (1.6.19) hike (1.2.3) hoe (3.6.3) rake (>= 0.8, < 11.0) - http_parser.rb (0.5.3) - i18n (0.6.4) - jquery-rails (1.0.19) - railties (~> 3.0) - thor (~> 0.14) - json (1.8.0) + i18n (0.6.9) + journey (1.0.4) + json (1.8.1) kgio (2.8.0) libv8 (3.11.8.17) - mail (2.3.3) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.23) - mini_portile (0.5.1) - multi_json (1.7.7) + mime-types (1.25.1) + mini_portile (0.5.2) + multi_json (1.9.0) net-scp (1.1.2) net-ssh (>= 2.6.5) net-sftp (2.1.2) @@ -92,39 +84,38 @@ GEM net-ssh (2.6.8) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - nokogiri (1.6.0) + nokogiri (1.6.1) mini_portile (~> 0.5.0) - poltergeist (1.3.0) - capybara (~> 2.1.0) - faye-websocket (>= 0.4.4, < 0.5.0) - http_parser.rb (~> 0.5.3) - polyglot (0.3.3) - rack (1.3.10) + poltergeist (1.5.0) + capybara (~> 2.1) + cliver (~> 0.3.1) + multi_json (~> 1.0) + websocket-driver (>= 0.2.0) + polyglot (0.3.4) + rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) - rails (3.1.11) - actionmailer (= 3.1.11) - actionpack (= 3.1.11) - activerecord (= 3.1.11) - activeresource (= 3.1.11) - activesupport (= 3.1.11) + rails (3.2.17) + actionmailer (= 3.2.17) + actionpack (= 3.2.17) + activerecord (= 3.2.17) + activeresource (= 3.2.17) + activesupport (= 3.2.17) bundler (~> 1.0) - railties (= 3.1.11) - railties (3.1.11) - actionpack (= 3.1.11) - activesupport (= 3.1.11) + railties (= 3.2.17) + railties (3.2.17) + actionpack (= 3.2.17) + activesupport (= 3.2.17) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) - thor (~> 0.14.6) + thor (>= 0.14.6, < 2.0) raindrops (0.11.0) - rake (10.1.0) + rake (10.1.1) rb-fsevent (0.9.2) rdoc (3.12.2) json (~> 1.4) @@ -143,40 +134,37 @@ GEM rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - sass (3.2.9) - sass-rails (3.1.7) - actionpack (~> 3.1.0) - railties (~> 3.1.0) + sass (3.2.14) + sass-rails (3.2.6) + railties (~> 3.2.0) sass (>= 3.1.10) - tilt (~> 1.3.2) + tilt (~> 1.3) settingslogic (2.0.9) spork (1.0.0rc3) - sprockets (2.0.4) + sprockets (2.2.2) hike (~> 1.2) + multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref - thin (1.2.11) - daemons (>= 1.0.9) - eventmachine (>= 0.12.6) - rack (>= 1.0.0) - thor (0.14.6) - tilt (1.3.7) - treetop (1.4.14) + thor (0.18.1) + tilt (1.4.1) + treetop (1.4.15) polyglot polyglot (>= 0.3.1) turn (0.9.6) ansi - tzinfo (0.3.37) - uglifier (2.1.1) + tzinfo (0.3.38) + uglifier (2.4.0) execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) + json (>= 1.8.0) unicorn (4.1.1) kgio (~> 2.4) rack raindrops (~> 0.6) + websocket-driver (0.3.2) xpath (2.0.0) nokogiri (~> 1.3) @@ -186,23 +174,21 @@ PLATFORMS DEPENDENCIES capistrano (~> 2.8.0) capybara - coffee-rails (~> 3.1.1) + coffee-rails (~> 3.2.1) eycap (= 0.5.22) fakeredis growl (>= 1.0.3) - haml (~> 3.1.3) - jquery-rails (~> 1.0.14) + haml (~> 4.0.5) poltergeist - rails (= 3.1.11) + rails (~> 3.2.17) rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) rspec-rails - sass-rails (~> 3.1.4) + sass-rails (~> 3.2.3) settingslogic (~> 2.0.6) spork (>= 0.9.0.rc9) therubyracer - thin (~> 1.2.11) turn uglifier (>= 1.0.3) unicorn (~> 4.1.1) From cc16da0a17f9c4b46c00de3d5fad524a6b0540fc Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Wed, 5 Mar 2014 10:47:18 -0800 Subject: [PATCH 22/30] Asset pipeline changes just use cdn jquery version for a quick win --- app/assets/javascripts/application.js | 3 --- app/views/layouts/application.html.haml | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9b71e63..cc50d20 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,7 +1,4 @@ // - //= require jquery - //= require jquery-ui - //= require jquery_ujs //= require ../../../vendor/assets/javascripts/externals //= require_tree . diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index f4f2358..09552c0 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -2,6 +2,7 @@ %html %head %title translatable + = javascript_include_tag "http://code.jquery.com/jquery-1.5.2.min.js" = stylesheet_link_tag "application" = javascript_include_tag "application" = csrf_meta_tags From bafde6152890e14fcecf0d725067b0f130099f05 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Wed, 5 Mar 2014 10:52:57 -0800 Subject: [PATCH 23/30] Deploy updates --- Gemfile | 5 +++-- Gemfile.lock | 18 +++++++++--------- config/deploy.rb | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Gemfile b/Gemfile index f7830ba..2b0018b 100644 --- a/Gemfile +++ b/Gemfile @@ -17,8 +17,9 @@ gem 'unicorn', '~> 4.1.1' gem 'therubyracer', :groups => [:staging, :production] group :development do - gem 'capistrano', "~> 2.8.0" - gem "eycap", '0.5.22' + gem "capistrano", "~> 2.14.1" + gem "capistrano-maintenance", :require => false + gem "eycap", " ~> 0.6.11", :require => false end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 4800a6d..874372f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,12 +31,14 @@ GEM ansi (1.4.3) arel (3.0.3) builder (3.0.4) - capistrano (2.8.0) + capistrano (2.14.2) highline net-scp (>= 1.0.0) net-sftp (>= 2.0.0) net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) + capistrano-maintenance (0.0.4) + capistrano (>= 2.0.0) capybara (2.2.1) mime-types (>= 1.16) nokogiri (>= 1.3.3) @@ -54,18 +56,15 @@ GEM diff-lcs (1.2.4) erubis (2.7.0) execjs (2.0.2) - eycap (0.5.22) + eycap (0.6.11) capistrano (>= 2.2.0) - hoe (>= 1.5.1) fakeredis (0.3.3) redis (~> 2.2.0) growl (1.0.3) haml (4.0.5) tilt - highline (1.6.19) + highline (1.6.21) hike (1.2.3) - hoe (3.6.3) - rake (>= 0.8, < 11.0) i18n (0.6.9) journey (1.0.4) json (1.8.1) @@ -81,7 +80,7 @@ GEM net-ssh (>= 2.6.5) net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (2.6.8) + net-ssh (2.8.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) nokogiri (1.6.1) @@ -172,10 +171,11 @@ PLATFORMS ruby DEPENDENCIES - capistrano (~> 2.8.0) + capistrano (~> 2.14.1) + capistrano-maintenance capybara coffee-rails (~> 3.2.1) - eycap (= 0.5.22) + eycap (~> 0.6.11) fakeredis growl (>= 1.0.3) haml (~> 4.0.5) diff --git a/config/deploy.rb b/config/deploy.rb index 7605c8b..34be346 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,8 +1,8 @@ # For complete deployment instructions, see the following support guide: # http://www.engineyard.com/support/guides/deploying_your_application_with_capistrano -require "eycap/recipes" -require "bundler/capistrano" +require "eycap" +require 'capistrano/maintenance' parent_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) require "#{parent_dir}/config/developers/logins" if File.exist?("#{parent_dir}/config/developers/logins.rb") From 2f88b1b76e5d097bbe7914c1b86ae36c32262502 Mon Sep 17 00:00:00 2001 From: Chris Stringer Date: Wed, 5 Mar 2014 11:06:36 -0800 Subject: [PATCH 24/30] Bundle on deploys --- config/deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index 34be346..c653f90 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -2,7 +2,8 @@ # http://www.engineyard.com/support/guides/deploying_your_application_with_capistrano require "eycap" -require 'capistrano/maintenance' +require "capistrano/maintenance" +require "bundler/capistrano" parent_dir = File.expand_path(File.join(File.dirname(__FILE__), "..")) require "#{parent_dir}/config/developers/logins" if File.exist?("#{parent_dir}/config/developers/logins.rb") From 6807bbf217004d77e11df42743fc4849b3dc160e Mon Sep 17 00:00:00 2001 From: Perry Hertler Date: Wed, 12 Mar 2014 12:25:38 -0500 Subject: [PATCH 25/30] restore redis task delegates to redis_reload gem --- .gitignore | 2 ++ Gemfile | 1 + Gemfile.lock | 10 ++++++++++ lib/redis_restore.rb | 22 ++++++++++++++++++++++ lib/tasks/restore.rake | 15 +++++++++++++++ spec/lib/redis_restore_spec.rb | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+) create mode 100644 lib/redis_restore.rb create mode 100644 lib/tasks/restore.rake create mode 100644 spec/lib/redis_restore_spec.rb diff --git a/.gitignore b/.gitignore index 3ddd6a1..2f516e9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ public/uploads/**/* .sass-cache/ uploads/* config/developers/* + +/.idea/ diff --git a/Gemfile b/Gemfile index 2b0018b..1719f4f 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ gem 'settingslogic', '~> 2.0.6' gem 'redis', '~> 2.2.2' gem 'redis-store', '~> 1.0.0.rc1' gem 'unicorn', '~> 4.1.1' +gem 'redis_reload', git: 'git@github.com:g5search/redis_reload.git' gem 'therubyracer', :groups => [:staging, :production] diff --git a/Gemfile.lock b/Gemfile.lock index 874372f..010ce10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,11 @@ +GIT + remote: git@github.com:g5search/redis_reload.git + revision: 4ac3b2fd2ee5d8600afca094df3371c503a3bfbb + specs: + redis_reload (0.0.1) + redis + redis-rdb + GEM remote: http://rubygems.org/ specs: @@ -119,6 +127,7 @@ GEM rdoc (3.12.2) json (~> 1.4) redis (2.2.2) + redis-rdb (0.1.0) redis-store (1.0.0.1) redis (~> 2.2.1) ref (1.0.5) @@ -184,6 +193,7 @@ DEPENDENCIES rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) + redis_reload! rspec-rails sass-rails (~> 3.2.3) settingslogic (~> 2.0.6) diff --git a/lib/redis_restore.rb b/lib/redis_restore.rb new file mode 100644 index 0000000..15a174c --- /dev/null +++ b/lib/redis_restore.rb @@ -0,0 +1,22 @@ +class RedisRestore + attr_accessor :src_rdb, :src_db + + def initialize(atts={}) + self.src_rdb = atts[:src_rdb] || raise('src_rdb is required') + self.src_db = atts[:src_db] || raise('src_db is required') + end + + def restore + RedisReload::Reloader.new(reloader_options).reload + end + + def reloader_options + { + rdb_filename: self.src_rdb, + source_db: self.src_db, + redis_host: Settings.redis_host, + redis_port: Settings.redis_port, + target_db: Settings.redis_db + } + end +end \ No newline at end of file diff --git a/lib/tasks/restore.rake b/lib/tasks/restore.rake new file mode 100644 index 0000000..15e2f4e --- /dev/null +++ b/lib/tasks/restore.rake @@ -0,0 +1,15 @@ +require 'rake' + +namespace :translatable do + # SRC_RDB=/usr/local/var/db/redis/dump.rdb + # SRC_DB=6 + desc 'restore Redis from rdb file' + task restore: :environment do + redis_restore = RedisRestore.new(src_rdb: ENV['SRC_RDB'], src_db: ENV['SRC_DB']) + + puts "restoring with #{redis_restore.reloader_options}" + redis_restore.restore + + puts "finished!" + end +end \ No newline at end of file diff --git a/spec/lib/redis_restore_spec.rb b/spec/lib/redis_restore_spec.rb new file mode 100644 index 0000000..886ab68 --- /dev/null +++ b/spec/lib/redis_restore_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe RedisRestore do + let(:src_rdb) { 'dump.rdb' } + let(:src_db) { 4 } + + describe :initialize do + describe :failure do + specify { lambda { RedisRestore.new() }.should raise_error('src_rdb is required') } + specify { lambda { RedisRestore.new(src_db: 3) }.should raise_error('src_rdb is required') } + specify { lambda { RedisRestore.new(src_rdb: src_rdb) }.should raise_error('src_db is required') } + end + end + + let(:expected_reloader_options) { {rdb_filename: src_rdb, + source_db: src_db, + redis_host: Settings.redis_host, + redis_port: Settings.redis_port, + target_db: Settings.redis_db} } + + subject { RedisRestore.new(src_rdb: src_rdb, src_db: src_db) } + + its(:reloader_options) { should eq(expected_reloader_options) } + + describe :restore do + it 'delegates to RedisReload' do + reload_stub = stub('reload', reload: 'yes!') + RedisReload::Reloader.should_receive(:new).with(expected_reloader_options).and_return(reload_stub) + subject.restore.should eq('yes!') + end + end +end \ No newline at end of file From 0416104af2a4dbbdb707305233cecd42d913814f Mon Sep 17 00:00:00 2001 From: Chris Kraybill Date: Thu, 15 May 2014 07:57:09 -0700 Subject: [PATCH 26/30] Bump rails for CVE-2014-0130 --- Gemfile | 3 +-- Gemfile.lock | 60 ++++++++++++++++++++++++++-------------------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index 1719f4f..ce7c0e2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -gem 'rails', '~> 3.2.17' +gem 'rails', '~> 3.2.18' group :assets do gem 'sass-rails', '~> 3.2.3' @@ -40,4 +40,3 @@ unless ENV["TRAVIS"] gem "spork", '>= 0.9.0.rc9' end end - diff --git a/Gemfile.lock b/Gemfile.lock index 010ce10..8eeff20 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,12 +9,12 @@ GIT GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.17) - actionpack (= 3.2.17) + actionmailer (3.2.18) + actionpack (= 3.2.18) mail (~> 2.5.4) - actionpack (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) + actionpack (3.2.18) + activemodel (= 3.2.18) + activesupport (= 3.2.18) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -22,18 +22,18 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.17) - activesupport (= 3.2.17) + activemodel (3.2.18) + activesupport (= 3.2.18) builder (~> 3.0.0) - activerecord (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) + activerecord (3.2.18) + activemodel (= 3.2.18) + activesupport (= 3.2.18) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - activesupport (3.2.17) + activeresource (3.2.18) + activemodel (= 3.2.18) + activesupport (= 3.2.18) + activesupport (3.2.18) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) ansi (1.4.3) @@ -83,7 +83,7 @@ GEM treetop (~> 1.4.8) mime-types (1.25.1) mini_portile (0.5.2) - multi_json (1.9.0) + multi_json (1.10.0) net-scp (1.1.2) net-ssh (>= 2.6.5) net-sftp (2.1.2) @@ -102,27 +102,27 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-ssl (1.3.3) + rack-ssl (1.3.4) rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.17) - actionmailer (= 3.2.17) - actionpack (= 3.2.17) - activerecord (= 3.2.17) - activeresource (= 3.2.17) - activesupport (= 3.2.17) + rails (3.2.18) + actionmailer (= 3.2.18) + actionpack (= 3.2.18) + activerecord (= 3.2.18) + activeresource (= 3.2.18) + activesupport (= 3.2.18) bundler (~> 1.0) - railties (= 3.2.17) - railties (3.2.17) - actionpack (= 3.2.17) - activesupport (= 3.2.17) + railties (= 3.2.18) + railties (3.2.18) + actionpack (= 3.2.18) + activesupport (= 3.2.18) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.11.0) - rake (10.1.1) + rake (10.3.1) rb-fsevent (0.9.2) rdoc (3.12.2) json (~> 1.4) @@ -157,14 +157,14 @@ GEM therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref - thor (0.18.1) + thor (0.19.1) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) turn (0.9.6) ansi - tzinfo (0.3.38) + tzinfo (0.3.39) uglifier (2.4.0) execjs (>= 0.3.0) json (>= 1.8.0) @@ -189,7 +189,7 @@ DEPENDENCIES growl (>= 1.0.3) haml (~> 4.0.5) poltergeist - rails (~> 3.2.17) + rails (~> 3.2.18) rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) From e20be8b4d1b3e7213c5222e1062d287afafb2a4c Mon Sep 17 00:00:00 2001 From: Chris Kraybill Date: Thu, 15 May 2014 09:29:44 -0700 Subject: [PATCH 27/30] Bump ruby-version --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 2aaf252..7a895c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-1.9.3-p392 +1.9.3-p484 From 1fb90d0d7b97d43eda8361504f648d25f230be64 Mon Sep 17 00:00:00 2001 From: sleverbor Date: Thu, 6 Nov 2014 11:56:54 -0800 Subject: [PATCH 28/30] upgrade rails to 3.2.20 --- Gemfile | 2 +- Gemfile.lock | 62 ++++++++++++++++++++++++++-------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index ce7c0e2..3576e67 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'http://rubygems.org' -gem 'rails', '~> 3.2.18' +gem 'rails', '3.2.20' group :assets do gem 'sass-rails', '~> 3.2.3' diff --git a/Gemfile.lock b/Gemfile.lock index 8eeff20..911aadf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,12 +9,12 @@ GIT GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.18) - actionpack (= 3.2.18) + actionmailer (3.2.20) + actionpack (= 3.2.20) mail (~> 2.5.4) - actionpack (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) + actionpack (3.2.20) + activemodel (= 3.2.20) + activesupport (= 3.2.20) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -22,18 +22,18 @@ GEM rack-cache (~> 1.2) rack-test (~> 0.6.1) sprockets (~> 2.2.1) - activemodel (3.2.18) - activesupport (= 3.2.18) + activemodel (3.2.20) + activesupport (= 3.2.20) builder (~> 3.0.0) - activerecord (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) + activerecord (3.2.20) + activemodel (= 3.2.20) + activesupport (= 3.2.20) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.18) - activemodel (= 3.2.18) - activesupport (= 3.2.18) - activesupport (3.2.18) + activeresource (3.2.20) + activemodel (= 3.2.20) + activesupport (= 3.2.20) + activesupport (3.2.20) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) ansi (1.4.3) @@ -73,7 +73,7 @@ GEM tilt highline (1.6.21) hike (1.2.3) - i18n (0.6.9) + i18n (0.6.11) journey (1.0.4) json (1.8.1) kgio (2.8.0) @@ -83,7 +83,7 @@ GEM treetop (~> 1.4.8) mime-types (1.25.1) mini_portile (0.5.2) - multi_json (1.10.0) + multi_json (1.10.1) net-scp (1.1.2) net-ssh (>= 2.6.5) net-sftp (2.1.2) @@ -98,7 +98,7 @@ GEM cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - polyglot (0.3.4) + polyglot (0.3.5) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) @@ -106,23 +106,23 @@ GEM rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.18) - actionmailer (= 3.2.18) - actionpack (= 3.2.18) - activerecord (= 3.2.18) - activeresource (= 3.2.18) - activesupport (= 3.2.18) + rails (3.2.20) + actionmailer (= 3.2.20) + actionpack (= 3.2.20) + activerecord (= 3.2.20) + activeresource (= 3.2.20) + activesupport (= 3.2.20) bundler (~> 1.0) - railties (= 3.2.18) - railties (3.2.18) - actionpack (= 3.2.18) - activesupport (= 3.2.18) + railties (= 3.2.20) + railties (3.2.20) + actionpack (= 3.2.20) + activesupport (= 3.2.20) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.11.0) - rake (10.3.1) + rake (10.3.2) rb-fsevent (0.9.2) rdoc (3.12.2) json (~> 1.4) @@ -149,7 +149,7 @@ GEM tilt (~> 1.3) settingslogic (2.0.9) spork (1.0.0rc3) - sprockets (2.2.2) + sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) @@ -164,7 +164,7 @@ GEM polyglot (>= 0.3.1) turn (0.9.6) ansi - tzinfo (0.3.39) + tzinfo (0.3.42) uglifier (2.4.0) execjs (>= 0.3.0) json (>= 1.8.0) @@ -189,7 +189,7 @@ DEPENDENCIES growl (>= 1.0.3) haml (~> 4.0.5) poltergeist - rails (~> 3.2.18) + rails (= 3.2.20) rb-fsevent (= 0.9.2) redis (~> 2.2.2) redis-store (~> 1.0.0.rc1) From 63da4ef19d028a6f77b1761998719ed0f6f6e825 Mon Sep 17 00:00:00 2001 From: Randy Leighton Date: Tue, 15 Dec 2015 16:38:46 -0800 Subject: [PATCH 29/30] bump rubyracer --- Gemfile.lock | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 911aadf..b48e552 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,7 +77,7 @@ GEM journey (1.0.4) json (1.8.1) kgio (2.8.0) - libv8 (3.11.8.17) + libv8 (3.16.14.13) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) @@ -130,7 +130,7 @@ GEM redis-rdb (0.1.0) redis-store (1.0.0.1) redis (~> 2.2.1) - ref (1.0.5) + ref (2.0.0) rspec-core (2.14.2) rspec-expectations (2.14.0) diff-lcs (>= 1.1.3, < 2.0) @@ -154,8 +154,8 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - therubyracer (0.11.4) - libv8 (~> 3.11.8.12) + therubyracer (0.12.2) + libv8 (~> 3.16.14.0) ref thor (0.19.1) tilt (1.4.1) @@ -202,3 +202,6 @@ DEPENDENCIES turn uglifier (>= 1.0.3) unicorn (~> 4.1.1) + +BUNDLED WITH + 1.11.1 From acec47e8ea1e0ee95705ecf3b3fc5697fe82c5f8 Mon Sep 17 00:00:00 2001 From: Randy Leighton Date: Tue, 15 Dec 2015 16:46:45 -0800 Subject: [PATCH 30/30] update nokogiri for security fix --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b48e552..335f5a8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -82,7 +82,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_portile (0.5.2) + mini_portile2 (2.0.0) multi_json (1.10.1) net-scp (1.1.2) net-ssh (>= 2.6.5) @@ -91,8 +91,8 @@ GEM net-ssh (2.8.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - nokogiri (1.6.1) - mini_portile (~> 0.5.0) + nokogiri (1.6.7) + mini_portile2 (~> 2.0.0.rc2) poltergeist (1.5.0) capybara (~> 2.1) cliver (~> 0.3.1)