Skip to content
Permalink
Browse files

Update to Rails 3.2.8

  • Loading branch information...
meineerde authored and thegcat committed Jul 18, 2012
1 parent 214d179 commit 7488671b43f1193128bccb29594c7768f0e145bd
16 Gemfile
@@ -1,19 +1,29 @@
# -*- coding: utf-8 -*-
source "https://rubygems.org"

gem "rails", "2.3.18"
gem "rails", "3.2.8"

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 8, 2013

As I described at https://www.chiliproject.org/issues/601#note-21 ,
It is too hard to port jumping Rails 3.2.
You should port Rails 3.0 -> 3.1 -> 3.2.


gem "json", "~> 1.7.7"
gem "coderay", "~> 1.0.0"
gem "i18n", "~> 0.4.2"
gem "rubytree", "~> 0.5.2", :require => 'tree'
gem "rdoc", ">= 2.4.2"
gem "liquid", "~> 2.3.0"
gem "acts-as-taggable-on", "= 2.1.0"
gem 'gravatarify', '~> 3.0.0'
# Needed only on RUBY_VERSION = 1.8, ruby 1.9+ compatible interpreters should bring their csv
gem "fastercsv", "~> 1.5.0", :platforms => [:ruby_18, :jruby, :mingw_18]
gem "tzinfo", "~> 0.3.31" # Fixes #903. Not required for Rails >= 3.2

# Gems used only for assets and not required

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 8, 2013

Why did you add "assets"?

This comment has been minimized.

Copy link
@meineerde

meineerde Jul 9, 2013

Author

As it says in the comment: The group is for gems used for asset compiling which are not required on a production server if the assets are already precompiled. Of course, this applies only when using the assets pipeline which we intend do do later.

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 9, 2013

You did disabled asset in 52b395e.
Why do not you remove in this revision?

This comment has been minimized.

Copy link
@meineerde

meineerde Jul 9, 2013

Author

We disabled it for now as we still need to update about all of the asset handling for that to work. But the group doesn't hurt in any way and if we add the new gems in a group now, we don't need to chase them later.

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 9, 2013

But installing these gems is very heavy.
Will you manage gems version of unused gems?

This comment has been minimized.

Copy link
@meineerde

meineerde Jul 9, 2013

Author

This is still work in progress. The plan is to enable the assets pipeline before releasing 4.0. If that doesn't work out, we can still remove the gems. Relax...

# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3'
end

group :test do
gem 'shoulda', '~> 2.10.3'
@@ -1,12 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require File.expand_path('../config/application', __FILE__)

require 'rake'
require 'rake/testtask'
require 'rdoc/task'

require 'tasks/rails'
# Load rake tasks from plugins in chiliproject_plugins
Dir["#{RAILS_ROOT}/vendor/chiliproject_plugins/*/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
ChiliProject::Application.load_tasks
@@ -0,0 +1,18 @@
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2012 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# See doc/COPYRIGHT.rdoc for more details.
#++

# This file is used by Rack-based servers to start the application.

require ::File.expand_path('../config/environment', __FILE__)
run ChiliProject::Application
@@ -1,5 +1,5 @@
# Copy this file to additional_environment.rb and add any statements
# that need to be passed to the Rails::Initializer. `config` is
# that need to be passed to the ChiliProject::Application. `config` is
# available in this context.
#
# Example:
@@ -0,0 +1,68 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'

if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end

module ChiliProject
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.

# Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W[#{config.root}/lib #{config.root}/app/drops]

# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]

# Activate observers that should always be running.
config.active_record.observers = :journal_observer, :message_observer, :issue_observer, :news_observer, :document_observer, :comment_observer
config.active_record.store_full_sti_class = true

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.active_record.default_timezone = :local

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :en

# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]

# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true

# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql

# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
config.active_record.whitelist_attributes = true

# Enable the asset pipeline
config.assets.enabled = true

# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'

if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end
end
end
@@ -12,126 +12,9 @@
# See doc/COPYRIGHT.rdoc for more details.
#++

# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
require 'rubygems'

RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end

def booted?
defined? Rails::Initializer
end

def pick_boot
(vendor_rails? ? VendorBoot : GemBoot).new
end

def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails")
end

def preinitialize
load(preinitializer_path) if File.exist?(preinitializer_path)
end

def preinitializer_path
"#{RAILS_ROOT}/config/preinitializer.rb"
end
end

class Boot
def run
load_initializer

# This block was added for bundler support while following setup
# instructions from http://gembundler.com/rails23.html
Rails::Initializer.class_eval do
def load_gems
@bundler_loaded ||= Bundler.require :default, Rails.env
end
end

Rails::Initializer.run(:set_load_path)
end
end

class VendorBoot < Boot
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::GemDependency.add_frozen_gem_path
end
end

class GemBoot < Boot
def load_initializer
self.class.load_rubygems
load_rails_gem
require 'initializer'
end

def load_rails_gem
if version = self.class.gem_version
gem 'rails', version
else
gem 'rails'
end
rescue Gem::LoadError => load_error
if load_error.message =~ /Could not find RubyGem rails/
STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
exit 1
else
raise
end
end

class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
end

def gem_version
if defined? RAILS_GEM_VERSION
RAILS_GEM_VERSION
elsif ENV.include?('RAILS_GEM_VERSION')
ENV['RAILS_GEM_VERSION']
else
parse_gem_version(read_environment_rb)
end
end

def load_rubygems
min_version = '1.3.2'
require 'rubygems'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end

rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end

def parse_gem_version(text)
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
end

private
def read_environment_rb
File.read("#{RAILS_ROOT}/config/environment.rb")
end
end
end
end

# All that for this:
Rails.boot!
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -3,14 +3,16 @@
production:
adapter: mysql
database: chiliproject
pool: 5

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 9, 2013

I cannot understand why does this need.

This comment has been minimized.

Copy link
@meineerde

meineerde Jul 9, 2013

Author

http://guides.rubyonrails.org/2_2_release_notes.html#connection-pooling

While this is certainly not needed for single threaded servers, it doesn't hurt and is one step into supporting multithreaded servers one day.

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 9, 2013

But this pull request is for Rails3 porting.
Is this change related Rails3 porting/

This comment has been minimized.

Copy link
@meineerde

meineerde Jul 9, 2013

Author

Note that the unstable branch is not named rails3-porting. We use this to clean up rather many areas and try to move much closer to Rails's defaults. As such, you will see more than just commits to update to Rails 3 here.

host: localhost
username: root
password:
encoding: utf8

This comment has been minimized.

Copy link
@marutosi

marutosi Jul 9, 2013

You can cherry-pick to Rails2.


development:
adapter: mysql
database: chiliproject_development
pool: 5
host: localhost
username: root
password:
@@ -22,6 +24,7 @@ development:
test:
adapter: mysql
database: chiliproject_test
pool: 5
host: localhost
username: root
password:
@@ -30,10 +33,13 @@ test:
test_pgsql:
adapter: postgresql
database: chiliproject_test
pool: 5
host: localhost
username: postgres
password: "postgres"

test_sqlite3:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
@@ -12,79 +12,5 @@
# See doc/COPYRIGHT.rdoc for more details.
#++

# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# use RACK_ENV if we are running as a simple rack app
ENV['RAILS_ENV'] ||= ENV['RACK_ENV'] if ENV['RACK_ENV']

# this is replaced by config.encoding = "utf-8" in rails3
if RUBY_VERSION >= '1.9'
Encoding.default_external = 'UTF-8'
Encoding.default_internal = 'UTF-8'
else
$KCODE='UTF-8'
end

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

# Load Engine plugin if available
begin
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
rescue LoadError
# Not available
end

Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence those specified here

# Skip frameworks you're not going to use
# config.frameworks -= [ :action_web_service, :action_mailer ]

# Add additional load paths for sweepers
config.autoload_paths += %W( #{RAILS_ROOT}/app/sweepers )

# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug

# Liquid drops
config.autoload_paths += %W( #{RAILS_ROOT}/app/drops )

# Enable page/fragment caching by setting a file-based store
# (remember to create the caching directory and make it readable to the application)
# config.action_controller.cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache"

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector
config.active_record.observers = :journal_observer, :message_observer, :issue_observer, :news_observer, :document_observer, :comment_observer

# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc

# Use Active Record's schema dumper instead of SQL when creating the test database
# (enables use of different database adapters for development and test environments)
# config.active_record.schema_format = :ruby

# Deliveries are disabled by default. Do NOT modify this section.
# Define your email configuration in configuration.yml instead.
# It will automatically turn deliveries on
config.action_mailer.perform_deliveries = false

# Insert vendor/chiliproject_plugins at the top of the plugin load paths
config.plugin_paths.insert(0, File.join(Rails.root, "vendor", "chiliproject_plugins"))

# Use redmine's custom plugin locater
require File.join(RAILS_ROOT, "lib/redmine_plugin_locator")
config.plugin_locators << RedminePluginLocator

# Load any local configuration that is kept out of source control
# (e.g. patches).
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end
end
require File.expand_path('../application', __FILE__)
ChiliProject::Application.initialize!

0 comments on commit 7488671

Please sign in to comment.
You can’t perform that action at this time.