From 8fd1164fd1e47e721942e2fdb9f3611d3c1a8f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 18:06:40 +0200 Subject: [PATCH 1/7] update all the gems Rails 3.2 has been released a while ago and it brings some benefits during development and other improvements. Also other gems have received new features and bug-fixes. Since the test-coverage of anduin is quite high, I consider it safe to upgrade and fix the failing tests. --- Gemfile | 4 +- Gemfile.lock | 243 ++++++++++++++++++++++++++------------------------- 2 files changed, 126 insertions(+), 121 deletions(-) diff --git a/Gemfile b/Gemfile index 89fed84..c13c731 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,12 @@ source 'http://rubygems.org' -gem 'rails', '~> 3.1' +gem 'rails', '~> 3.2' gem 'sqlite3' # Asset template engines gem 'json' -gem 'sass-rails', "~> 3.1.0" +gem 'sass-rails', "~> 3.2" gem 'haml' gem 'coffee-script' gem 'therubyracer' diff --git a/Gemfile.lock b/Gemfile.lock index 28a3489..0d9b570 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,38 +1,37 @@ GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.3) - actionpack (= 3.1.3) - mail (~> 2.3.0) - actionpack (3.1.3) - activemodel (= 3.1.3) - activesupport (= 3.1.3) + actionmailer (3.2.3) + actionpack (= 3.2.3) + mail (~> 2.4.4) + actionpack (3.2.3) + activemodel (= 3.2.3) + activesupport (= 3.2.3) builder (~> 3.0.0) erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.5) - rack-cache (~> 1.1) - rack-mount (~> 0.8.2) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.0.3) - activemodel (3.1.3) - activesupport (= 3.1.3) + sprockets (~> 2.1.2) + activemodel (3.2.3) + activesupport (= 3.2.3) builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.3) - activemodel (= 3.1.3) - activesupport (= 3.1.3) - arel (~> 2.2.1) + activerecord (3.2.3) + activemodel (= 3.2.3) + activesupport (= 3.2.3) + arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.1.3) - activemodel (= 3.1.3) - activesupport (= 3.1.3) - activesupport (3.1.3) + activeresource (3.2.3) + activemodel (= 3.2.3) + activesupport (= 3.2.3) + activesupport (3.2.3) + i18n (~> 0.6) multi_json (~> 1.0) - albino (1.3.3) - posix-spawn (>= 0.3.6) - arel (2.2.1) + addressable (2.2.8) + arel (3.0.2) bcrypt-ruby (3.0.1) + blankslate (2.1.2.4) builder (3.0.0) cancan (1.6.7) capybara (1.1.2) @@ -42,113 +41,117 @@ GEM rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 0.1.4) - childprocess (0.2.2) + childprocess (0.3.2) ffi (~> 1.0.6) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.1.3) + coffee-script-source (1.3.1) commonjs (0.2.6) - cucumber (1.1.3) + cucumber (1.2.0) builder (>= 2.1.2) - diff-lcs (>= 1.1.2) - gherkin (~> 2.6.7) + diff-lcs (>= 1.1.3) + gherkin (~> 2.10.0) json (>= 1.4.6) - term-ansicolor (>= 1.0.6) - cucumber-rails (1.2.0) - capybara (>= 1.1.1) - cucumber (>= 1.1.1) + cucumber-rails (1.3.0) + capybara (>= 1.1.2) + cucumber (>= 1.1.8) nokogiri (>= 1.5.0) - database_cleaner (0.7.0) - devise (1.5.2) + database_cleaner (0.7.2) + devise (2.0.4) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) - warden (~> 1.1) - devise_ldap_authenticatable (0.5.1) - devise (~> 1.5.0) - net-ldap (~> 0.2.2) + railties (~> 3.1) + warden (~> 1.1.1) + devise_ldap_authenticatable (0.4.4) + devise (> 1.0.4) + net-ldap (>= 0.1.1) diff-lcs (1.1.3) email_spec (1.2.1) mail (~> 2.2) rspec (~> 2.0) erubis (2.7.0) - execjs (1.2.9) + execjs (1.3.2) multi_json (~> 1.0) ffi (1.0.11) - gherkin (2.6.7) + gherkin (2.10.0) json (>= 1.4.6) - github-markup (0.5.3) - gollum (1.3.1) - albino (~> 1.3.2) - github-markup (>= 0.4.0, < 1.0.0) + github-markdown (0.4.1) + github-markup (0.7.2) + gollum (2.0.0) + github-markdown + github-markup (>= 0.7.0, < 1.0.0) grit (~> 2.4.1) mustache (>= 0.11.2, < 1.0.0) nokogiri (~> 1.4) - redcarpet + posix-spawn (~> 0.3.0) + pygments.rb (~> 0.2.0) sanitize (~> 2.0.0) sinatra (~> 1.0) grit (2.4.1) diff-lcs (~> 1.1) mime-types (~> 1.15) - guard (1.0.0) + guard (1.0.2) ffi (>= 0.5.0) thor (~> 0.14.6) - guard-cucumber (0.7.5) - cucumber (>= 0.10) + guard-cucumber (0.8.0) + cucumber (>= 1.2.0) guard (>= 0.8.3) - guard-rspec (0.6.0) + guard-rspec (0.7.0) guard (>= 0.10.0) - guard-spork (0.5.2) + guard-spork (0.8.0) guard (>= 0.10.0) spork (>= 0.8.4) - haml (3.1.4) + haml (3.1.5) hike (1.2.1) i18n (0.6.0) - jquery-rails (1.0.18) - railties (~> 3.0) + journey (1.0.3) + jquery-rails (2.0.2) + railties (>= 3.2.0, < 5.0) thor (~> 0.14) - json (1.6.1) - json_pure (1.6.1) + json (1.7.1) less (2.2.1) commonjs (~> 0.2.6) less-rails (2.2.2) actionpack (>= 3.1) less (~> 2.2.0) libv8 (3.3.10.4) - mail (2.3.0) + libwebsocket (0.1.3) + addressable + mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.17.2) - multi_json (1.0.3) + mime-types (1.18) + multi_json (1.3.4) mustache (0.99.4) - net-ldap (0.2.2) - nokogiri (1.5.0) - orm_adapter (0.0.5) + net-ldap (0.3.1) + nokogiri (1.5.2) + orm_adapter (0.0.7) polyglot (0.3.3) posix-spawn (0.3.6) - rack (1.3.5) - rack-cache (1.1) + pygments.rb (0.2.12) + rubypython (~> 0.5.3) + rack (1.4.1) + rack-cache (1.2) rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) - rack-protection (1.1.4) + rack-protection (1.2.0) rack rack-ssl (1.3.2) rack rack-test (0.6.1) rack (>= 1.0) - rails (3.1.3) - actionmailer (= 3.1.3) - actionpack (= 3.1.3) - activerecord (= 3.1.3) - activeresource (= 3.1.3) - activesupport (= 3.1.3) + rails (3.2.3) + actionmailer (= 3.2.3) + actionpack (= 3.2.3) + activerecord (= 3.2.3) + activeresource (= 3.2.3) + activesupport (= 3.2.3) bundler (~> 1.0) - railties (= 3.1.3) - railties (3.1.3) - actionpack (= 3.1.3) - activesupport (= 3.1.3) + railties (= 3.2.3) + railties (3.2.3) + actionpack (= 3.2.3) + activesupport (= 3.2.3) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) @@ -156,63 +159,65 @@ GEM rake (0.9.2.2) rdiscount (1.6.8) rdoc (3.9.4) - redcarpet (1.17.2) - rspec (2.7.0) - rspec-core (~> 2.7.0) - rspec-expectations (~> 2.7.0) - rspec-mocks (~> 2.7.0) - rspec-core (2.7.1) - rspec-expectations (2.7.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.7.0) - rspec-rails (2.7.0) - actionpack (~> 3.0) - activesupport (~> 3.0) - railties (~> 3.0) - rspec (~> 2.7.0) - rubyzip (0.9.4) + rspec (2.10.0) + rspec-core (~> 2.10.0) + rspec-expectations (~> 2.10.0) + rspec-mocks (~> 2.10.0) + rspec-core (2.10.0) + rspec-expectations (2.10.0) + diff-lcs (~> 1.1.3) + rspec-mocks (2.10.1) + rspec-rails (2.10.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.10.0) + rubypython (0.5.3) + blankslate (>= 2.1.2.3) + ffi (~> 1.0.7) + rubyzip (0.9.8) sanitize (2.0.3) nokogiri (>= 1.4.4, < 1.6) - sass (3.1.10) - sass-rails (3.1.5) - actionpack (~> 3.1.0) - railties (~> 3.1.0) - sass (~> 3.1.10) - tilt (~> 1.3.2) - selenium-webdriver (2.13.0) - childprocess (>= 0.2.1) - ffi (~> 1.0.9) - json_pure + sass (3.1.17) + sass-rails (3.2.5) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + selenium-webdriver (2.21.2) + childprocess (>= 0.2.5) + ffi (~> 1.0) + libwebsocket (~> 0.1.3) + multi_json (~> 1.0) rubyzip - simple-navigation (3.5.1) + simple-navigation (3.7.0) activesupport (>= 2.3.2) - sinatra (1.3.1) - rack (~> 1.3, >= 1.3.4) - rack-protection (~> 1.1, >= 1.1.2) + sinatra (1.3.2) + rack (~> 1.3, >= 1.3.6) + rack-protection (~> 1.2) tilt (~> 1.3, >= 1.3.3) - spork (0.8.5) - sprockets (2.0.3) + spork (0.9.1) + sprockets (2.1.3) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.4) - term-ansicolor (1.0.7) - therubyracer (0.9.9) + sqlite3 (1.3.6) + therubyracer (0.10.1) libv8 (~> 3.3.10) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) polyglot polyglot (>= 0.3.1) - twitter-bootstrap-rails (2.0.6) + twitter-bootstrap-rails (2.0.7) actionpack (>= 3.1) - less-rails (~> 2.2.0) + less-rails (~> 2.2.2) railties (>= 3.1) - tzinfo (0.3.31) - uglifier (1.1.0) + therubyracer (~> 0.10.1) + tzinfo (0.3.33) + uglifier (1.2.4) execjs (>= 0.3.0) multi_json (>= 1.0.2) - warden (1.1.0) + warden (1.1.1) rack (>= 1.0) xpath (0.1.4) nokogiri (~> 1.3) @@ -236,11 +241,11 @@ DEPENDENCIES jquery-rails json net-ldap - rails (~> 3.1) + rails (~> 3.2) rdiscount rdoc (< 3.10) rspec-rails - sass-rails (~> 3.1.0) + sass-rails (~> 3.2) simple-navigation spork sqlite3 From 7dbc7d598585e531d54854084e8f616b325ac1e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 18:19:46 +0200 Subject: [PATCH 2/7] remove use_salt_as_remember_token from config As stated by the devise documentation, this is no longer advised: > Devise.use_salt_as_remember_token is false which is no longer > supported. Devise now only uses the salt as remember token and > the remember_token column can be removed from your models. --- config/initializers/devise.rb | 5 +- ...161417_remove_remember_token_from_users.rb | 7 ++ db/schema.rb | 80 ++++++++++++++++++- 3 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20120509161417_remove_remember_token_from_users.rb diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 96a5f70..be03cbb 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -88,8 +88,9 @@ # config.extend_remember_period = false # If true, uses the password salt as remember token. This should be turned - # to false if you are not using database authenticatable. - config.use_salt_as_remember_token = false + # to false if you are not using database authenticatable. Since false is no + # longer supported, this has to be set to true. + config.use_salt_as_remember_token = true # Options to be passed to the created cookie. For instance, you can set # :secure => true in order to force SSL only cookies. diff --git a/db/migrate/20120509161417_remove_remember_token_from_users.rb b/db/migrate/20120509161417_remove_remember_token_from_users.rb new file mode 100644 index 0000000..b64899b --- /dev/null +++ b/db/migrate/20120509161417_remove_remember_token_from_users.rb @@ -0,0 +1,7 @@ +class RemoveRememberTokenFromUsers < ActiveRecord::Migration + def up + remove_column :users, :rember_token + end + + # down method not needed. this column isn’t supported in devise any longer +end diff --git a/db/schema.rb b/db/schema.rb index dac39c5..72e8c87 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,46 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111001235522) do +ActiveRecord::Schema.define(:version => 20120509161417) do + + create_table "assets", :force => true do |t| + t.string "name" + t.boolean "public" + t.integer "content_id" + t.string "content_type" + t.integer "user_id" + t.integer "classifications_count" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "catalogs", :force => true do |t| + t.string "title" + t.string "permalink" + t.text "info" + end + + create_table "classifications", :force => true do |t| + t.integer "catalog_id" + t.integer "asset_id" + end + + create_table "facets", :force => true do |t| + t.string "caption" + t.string "color" + t.string "order" + t.integer "catalog_id" + t.string "label_order" + end + + create_table "file_assets", :force => true do |t| + t.string "file_file_name" + t.string "file_content_type" + t.integer "file_file_size" + t.integer "file_width" + t.integer "file_height" + t.datetime "file_updated_at" + end create_table "git_configs", :force => true do |t| t.string "name" @@ -21,13 +60,46 @@ t.datetime "updated_at" end + create_table "labelings", :force => true do |t| + t.integer "classification_id" + t.integer "label_id" + end + + create_table "labels", :force => true do |t| + t.string "caption" + t.integer "facet_id" + t.integer "position" + t.integer "value" + end + + create_table "prancing_pony_stocks", :force => true do |t| + t.string "name", :null => false + t.decimal "amount" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "prancing_pony_stocks", ["name"], :name => "index_prancing_pony_stocks_on_name" + + create_table "tray_positions", :force => true do |t| + t.integer "user_id" + t.integer "position" + t.integer "asset_id" + t.string "clipboard_type" + t.integer "clipboard_id" + end + + create_table "urls", :force => true do |t| + t.string "url" + end + create_table "users", :force => true do |t| - t.string "email", :default => "", :null => false + t.string "email", :default => "", :null => false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.string "remember_token" t.datetime "remember_created_at" - t.integer "sign_in_count", :default => 0 + t.integer "sign_in_count", :default => 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" @@ -35,6 +107,8 @@ t.datetime "created_at" t.datetime "updated_at" t.string "nick" + t.integer "drunk", :default => 0, :null => false + t.decimal "debit", :precision => 10, :scale => 2, :default => 0.0, :null => false end add_index "users", ["nick"], :name => "index_users_on_nick" From d5841789ab7c65e40bfede817243c041c873a44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 18:23:55 +0200 Subject: [PATCH 3/7] remove mime-type registrations This fixes two warnings during initialisation. Seems pdf and png are now already being registered within rails. --- config/initializers/mime_types.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 7dea72b..5b531c2 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,8 +1,6 @@ # Be sure to restart your server when you modify this file. -Mime::Type.register "image/png", :png Mime::Type.register "image/jpeg", :jpg -Mime::Type.register "application/pdf", :pdf # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf From f20ba333eafc35858fb4f7d2bc344778944b5900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 18:42:39 +0200 Subject: [PATCH 4/7] pass format of rendered file as option passing in the format in the filename is deprecated and so a warning was raised. This is now gone. --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index fc7729c..3e760ae 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -67,7 +67,7 @@ def reset_password end rescue_from CanCan::AccessDenied do |exception| - render :file => "#{Rails.root}/public/403.html", :status => 403, :layout => false + render :file => "#{Rails.root}/public/403", :status => 403, :layout => false, :format => :html end private From 7c081a398c453096c25e37e08fd97888fd7ed52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 18:51:39 +0200 Subject: [PATCH 5/7] install new devise i18n file Some strings changed, this is the new version of this file as generated by `rails g devise:install`. --- config/locales/devise.en.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 25022e1..73df488 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -1,4 +1,4 @@ -# Additional translations at http://github.com/plataformatec/devise/wiki/I18n +# Additional translations at https://github.com/plataformatec/devise/wiki/I18n en: errors: @@ -27,17 +27,24 @@ en: passwords: send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' updated: 'Your password was changed successfully. You are now signed in.' + updated_not_active: 'Your password was changed successfully.' + send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail" confirmations: send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' + send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.' confirmed: 'Your account was successfully confirmed. You are now signed in.' registrations: signed_up: 'Welcome! You have signed up successfully.' - inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.' + signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' + signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' + signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' updated: 'You updated your account successfully.' + update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' unlocks: send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' - unlocked: 'Your account was successfully unlocked. You are now signed in.' + unlocked: 'Your account has been unlocked successfully. Please sign in to continue.' + send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' omniauth_callbacks: success: 'Successfully authorized from %{kind} account.' failure: 'Could not authorize you from %{kind} because "%{reason}".' From 30944628d4d737d018e309f02b88869dfc04512c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 19:21:22 +0200 Subject: [PATCH 6/7] fix step definitions after upgrade The form for the sign in process is named new_user instead of user_new, now. Therefor the step definitions needed to be adjusted. Everything passing fine, again. --- features/step_definitions/authentication_steps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/step_definitions/authentication_steps.rb b/features/step_definitions/authentication_steps.rb index 707618a..dccd70f 100644 --- a/features/step_definitions/authentication_steps.rb +++ b/features/step_definitions/authentication_steps.rb @@ -5,7 +5,7 @@ Given /^I am logged in as "([^"]*)"$/ do |nick| User.create!(:nick => nick) visit new_user_session_path - within("#user_new") do + within("#new_user") do fill_in "Nick", :with => nick fill_in "Password", :with => "secure!" # fake_auth.rb allows to use any nick with this pw to authenticate end From 25cd116c6526440e12839fb789c716703852cebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20B=C3=A4ume?= Date: Wed, 9 May 2012 21:43:09 +0200 Subject: [PATCH 7/7] force version of twitter-bootstrap-rails 2.0.7 has a bug, that is fixed in current master, but without a release. This bug makes it unusable with ruby 1.8. This can be removed, once the bug-fixed version is released. --- Gemfile | 2 +- Gemfile.lock | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index c13c731..a075202 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ gem 'haml' gem 'coffee-script' gem 'therubyracer' gem 'uglifier' -gem 'twitter-bootstrap-rails' +gem 'twitter-bootstrap-rails', "< 2.0.7" gem 'jquery-rails' gem 'simple-navigation' diff --git a/Gemfile.lock b/Gemfile.lock index 0d9b570..2136e9f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -208,11 +208,10 @@ GEM treetop (1.4.10) polyglot polyglot (>= 0.3.1) - twitter-bootstrap-rails (2.0.7) + twitter-bootstrap-rails (2.0.6) actionpack (>= 3.1) - less-rails (~> 2.2.2) + less-rails (~> 2.2.0) railties (>= 3.1) - therubyracer (~> 0.10.1) tzinfo (0.3.33) uglifier (1.2.4) execjs (>= 0.3.0) @@ -250,5 +249,5 @@ DEPENDENCIES spork sqlite3 therubyracer - twitter-bootstrap-rails + twitter-bootstrap-rails (< 2.0.7) uglifier