Skip to content

Commit 8d24fa1

Browse files
committed
[UPGRADING TO RAILS 2.3.2]
- Removed all vendored gems and added proper config.gem entries in the environment file - Refactored configurations to proper locations such as config/session_store.rb - Upgraded Rspec, Rspec Rails and Cucumber and fixed tests to make them pass - CommentsController is missing index.atom.builder - removed until properly implemented - Upgraded open_id_authentication plugin - Run rake gems:unpack if you want to vendorize the gems again
1 parent 53b217c commit 8d24fa1

File tree

3,002 files changed

+233
-387934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,002 files changed

+233
-387934
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
log/**/*
2+
log
3+
tmp/**/*
14
tmp
5+
config/database.yml
6+
db/schema.rb
File renamed without changes.

app/controllers/comments_controller.rb

+17-25
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
class CommentsController < ApplicationController
22
include UrlHelper
3+
OPEN_ID_ERRORS = {
4+
:missing => "Sorry, the OpenID server couldn't be found",
5+
:canceled => "OpenID verification was canceled",
6+
:failed => "Sorry, the OpenID verification failed" }
37

48
before_filter :find_post, :except => [:new]
59

610
def index
711
if request.post? || using_open_id?
812
create
913
else
10-
respond_to do |format|
11-
format.html { redirect_to(post_path(@post)) }
12-
format.atom { @comments = @post.approved_comments }
13-
end
14+
redirect_to(post_path(@post))
1415
end
1516
end
1617

@@ -30,36 +31,27 @@ def create
3031

3132
session[:pending_comment] = nil
3233

33-
if @comment.requires_openid_authentication?
34+
unless @comment.requires_openid_authentication?
35+
@comment.blank_openid_fields
36+
else
3437
session[:pending_comment] = params[:comment]
35-
return if authenticate_with_open_id(@comment.author,
36-
:optional => [:nickname, :fullname, :email]
37-
) do |result, identity_url, registration|
38-
39-
case result.status
40-
when :missing
41-
@comment.openid_error = "Sorry, the OpenID server couldn't be found"
42-
when :canceled
43-
@comment.openid_error = "OpenID verification was canceled"
44-
when :failed
45-
@comment.openid_error = "Sorry, the OpenID verification failed"
46-
when :successful
38+
return if authenticate_with_open_id(@comment.author, :optional => [:nickname, :fullname, :email]) do |result, identity_url, registration|
39+
if result.status == :successful
4740
@comment.post = @post
4841

49-
@comment.author_url = @comment.author
50-
@comment.author = (registration["fullname"] || registration["nickname"] || @comment.author_url).to_s
51-
@comment.author_email = registration["email"].to_s
42+
@comment.author_url = @comment.author
43+
@comment.author = (registration["fullname"] || registration["nickname"] || @comment.author_url).to_s
44+
@comment.author_email = (registration["email"] || @comment.author_url).to_s
5245

5346
@comment.openid_error = ""
47+
session[:pending_comment] = nil
48+
else
49+
@comment.openid_error = OPEN_ID_ERRORS[ result.status ]
5450
end
55-
56-
session[:pending_comment] = nil
5751
end
58-
else
59-
@comment.blank_openid_fields
6052
end
6153

62-
if @comment.save
54+
if session[:pending_comment].nil? && @comment.save
6355
redirect_to post_path(@post)
6456
else
6557
render :template => 'posts/show'

app/helpers/url_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def formatted_posts_path(options = {})
1515
options[:tag] = options[:tag].downcase
1616
formatted_posts_with_tag_path(options)
1717
else
18-
super
18+
posts_path(options)
1919
end
2020
end
2121

config/boot.rb

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class VendorBoot < Boot
4444
def load_initializer
4545
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
4646
Rails::Initializer.run(:install_gem_spec_stubs)
47+
Rails::GemDependency.add_frozen_gem_path
4748
end
4849
end
4950

config/enki.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ author:
66
name: Don Alias # For copyright notice and ATOM feeds
77
email: [email protected] # Exception emails will go here, and it is used in ATOM feeds
88
open_id: # These are used to login to the admin area
9-
- http://enkiblog.com
10-
- http://secondaryopenid.com
9+
- http://enkiblog.com
10+
- http://secondaryopenid.com
1111

1212
# Delete the following section if your site will not be acting as an OpenID delegate (http://wiki.openid.net/Delegation)
1313
# If you're deploying with mongrel, make sure you read http://rhnh.net/2008/04/13/nginx-openid-delegation-and-yadis

config/environment.rb

+21-54
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Be sure to restart your server when you modify this file
22

3-
# Uncomment below to force Rails into production mode when
4-
# you don't control web/app server and can't set it the proper way
5-
# ENV['RAILS_ENV'] ||= 'production'
6-
73
# Specifies gem version of Rails to use when vendor/rails is not present
8-
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
4+
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
95

106
# Bootstrap the Rails environment, frameworks, and default configuration
117
require File.join(File.dirname(__FILE__), 'boot')
@@ -14,63 +10,34 @@
1410
# Settings in config/environments/* take precedence over those specified here.
1511
# Application configuration should go into files in config/initializers
1612
# -- all .rb files in that directory are automatically loaded.
17-
# See Rails::Configuration for more options.
18-
19-
# Skip frameworks you're not going to use (only works if using vendor/rails).
20-
# To use Rails without a database, you must remove the Active Record framework
21-
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
22-
23-
# Only load the plugins named here, in the order given. By default, all plugins
24-
# in vendor/plugins are loaded in alphabetical order.
25-
# :all can be used as a placeholder for all plugins not explicitly named
26-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
2713

2814
# Add additional load paths for your own custom dirs
2915
# config.load_paths += %W( #{RAILS_ROOT}/extras )
3016

31-
# Force all environments to use the same logger level
32-
# (by default production uses :info, the others :debug)
33-
# config.log_level = :debug
34-
35-
# Your secret key for verifying cookie session data integrity.
36-
# If you change this key, all old sessions will become invalid!
37-
# Make sure the secret is at least 30 characters and all random,
38-
# no regular words or you'll be exposed to dictionary attacks.
39-
config.action_controller.session_store = :memory_store
40-
config.action_controller.session = {
41-
:session_key => '_enki_session',
42-
:secret => 'd9b13a4ed2cfce88d62a6765b99530fd5a984ac827aa9068bf893aff51233f486c5f57f83d537945fb89caf2cd8bd3f42a5c3bfc5adce818afe28fca0452b52b'
43-
}
17+
# Specify gems that this application depends on and have them installed with rake gems:install
18+
config.gem "RedCloth", :lib => "redcloth", :version => "~> 4.1.0"
19+
config.gem "ruby-openid", :lib => "openid", :version => "~> 2.1.0"
20+
config.gem "chronic", :version => "~> 0.2.0"
21+
config.gem "coderay", :version => "~> 0.8.0"
22+
config.gem "lesstile", :version => "~> 0.3"
23+
config.gem "mislav-will_paginate", :lib => "will_paginate", :version => "~> 2.3"
4424

45-
# Use the database for sessions instead of the cookie-based default,
46-
# which shouldn't be used to store highly confidential information
47-
# (create the session table with 'rake db:sessions:create')
48-
config.action_controller.session_store = :active_record_store
25+
# Only load the plugins named here, in the order given (default is alphabetical).
26+
# :all can be used as a placeholder for all plugins not explicitly named
27+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
4928

50-
# Use SQL instead of Active Record's schema dumper when creating the test database.
51-
# This is necessary if your schema can't be completely dumped by the schema dumper,
52-
# like if you have constraints or database-specific column types
53-
# config.active_record.schema_format = :sql
29+
# Skip frameworks you're not going to use. To use Rails without a database,
30+
# you must remove the Active Record framework.
31+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
5432

5533
# Activate observers that should always be running
56-
# config.active_record.observers = :cacher, :garbage_collector
34+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
5735

58-
# Make Active Record use UTC-base instead of local time
59-
# config.active_record.default_timezone = :utc
36+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
37+
# Run "rake -D time" for a list of tasks for finding time zone names.
38+
config.time_zone = 'UTC'
6039

61-
Dir.glob(File.join(RAILS_ROOT,'vendor','*','lib')).each do |dir|
62-
config.load_paths += [dir]
63-
end
40+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
41+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
42+
# config.i18n.default_locale = :de
6443
end
65-
66-
require 'lesstile'
67-
require 'coderay'
68-
69-
require 'core_extensions/string'
70-
require 'core_extensions/object'
71-
72-
require 'openid'
73-
require 'openid/store/filesystem'
74-
require 'openid/extensions/sreg'
75-
76-
require 'chronic'

config/environments/test.rb

+7
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,10 @@
2020
# The :test delivery method accumulates sent emails in the
2121
# ActionMailer::Base.deliveries array.
2222
config.action_mailer.delivery_method = :test
23+
24+
# defining test gems
25+
config.gem "cucumber"
26+
config.gem "aslakhellesoy-webrat", :lib => "webrat", :version => "~> 0.3", :source => "http://gems.github.com"
27+
config.gem "thoughtbot-factory_girl", :lib => "factory_girl", :version => "~> 1.2.0", :source => "http://gems.github.com"
28+
config.gem "rspec", :lib => false, :version => ">= 1.2.0"
29+
config.gem "rspec-rails", :lib => false, :version => ">= 1.2.0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5+
6+
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
7+
# Rails.backtrace_cleaner.remove_silencers!

config/initializers/enki_ext.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require 'core_extensions/string'
2+
require 'core_extensions/object'

vendor/rails/railties/configs/initializers/new_rails_defaults.rb config/initializers/new_rails_defaults.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Be sure to restart your server when you modify this file.
2+
13
# These settings change the behavior of Rails 2 apps and will be defaults
24
# for Rails 3. You can remove this initializer when Rails 3 is released.
35

config/initializers/session_store.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# Your secret key for verifying cookie session data integrity.
4+
# If you change this key, all old sessions will become invalid!
5+
# Make sure the secret is at least 30 characters and all random,
6+
# no regular words or you'll be exposed to dictionary attacks.
7+
ActionController::Base.session = {
8+
:key => '_enki_session',
9+
:secret => 'd9b13a4ed2cfce88d62a6765b99530fd5a984ac827aa9068bf893aff51233f486c5f57f83d537945fb89caf2cd8bd3f42a5c3bfc5adce818afe28fca0452b52b'
10+
}
11+
12+
# Use the database for sessions instead of the cookie-based default,
13+
# which shouldn't be used to store highly confidential information
14+
# (create the session table with "rake db:sessions:create")
15+
ActionController::Base.session_store = :active_record_store

db/schema.rb

-105
This file was deleted.

0 commit comments

Comments
 (0)