Skip to content

Commit

Permalink
Ruby 1.9 compatibility. References #1689.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8431 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Dec 17, 2007
1 parent 0f6c86f commit ab9e4c0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
5 changes: 5 additions & 0 deletions railties/CHANGELOG
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,8 @@
*SVN*

* Ruby 1.9 compatibility. #1689 [Cheah Chu Yeow]


*2.0.2* (December 16th, 2007) *2.0.2* (December 16th, 2007)


* Changed the default database from mysql to sqlite3, so now running "rails myapp" will have a config/database.yml that's setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run "rails -d mysql myapp" [DHH] * Changed the default database from mysql to sqlite3, so now running "rails myapp" will have a config/database.yml that's setup for SQLite3 (which in OS X Leopard is installed by default, so is the gem, so everything Just Works with no database configuration at all). To get a Rails application preconfigured for MySQL, just run "rails -d mysql myapp" [DHH]
Expand Down
4 changes: 2 additions & 2 deletions railties/dispatches/gateway.cgi
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def listener_socket(number)
File.expand_path(File.join(File.dirname(__FILE__), "../log/drb_gateway/listener_#{number}.sock")) File.expand_path(File.join(File.dirname(__FILE__), "../log/drb_gateway/listener_#{number}.sock"))
end end


unless File.exists? TrackerSocket unless File.exist? TrackerSocket
message "Starting tracker and #{Listeners} listeners" message "Starting tracker and #{Listeners} listeners"
fork do fork do
Process.setsid Process.setsid
Expand Down Expand Up @@ -62,7 +62,7 @@ unless File.exists? TrackerSocket
ready = false ready = false
10.times do 10.times do
sleep 0.5 sleep 0.5
break if (ready = File.exists?(TrackerSocket) && File.exists?(listener_socket(0))) break if (ready = File.exist?(TrackerSocket) && File.exist?(listener_socket(0)))
end end


if ready if ready
Expand Down
3 changes: 1 addition & 2 deletions railties/environments/boot.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ def vendor_rails?
File.exist?("#{RAILS_ROOT}/vendor/rails") File.exist?("#{RAILS_ROOT}/vendor/rails")
end end


# FIXME : Ruby 1.9
def preinitialize def preinitialize
load(preinitializer_path) if File.exists?(preinitializer_path) load(preinitializer_path) if File.exist?(preinitializer_path)
end end


def preinitializer_path def preinitializer_path
Expand Down
6 changes: 3 additions & 3 deletions railties/lib/commands/console.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
libs << " -r console_with_helpers" libs << " -r console_with_helpers"


ENV['RAILS_ENV'] = case ARGV.first ENV['RAILS_ENV'] = case ARGV.first
when "p": "production" when "p"; "production"
when "d": "development" when "d"; "development"
when "t": "test" when "t"; "test"
else else
ARGV.first || ENV['RAILS_ENV'] || 'development' ARGV.first || ENV['RAILS_ENV'] || 'development'
end end
Expand Down
4 changes: 2 additions & 2 deletions railties/lib/tasks/documentation.rake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ namespace :doc do
options << '-T html' options << '-T html'


files.include("#{plugin_base}/lib/**/*.rb") files.include("#{plugin_base}/lib/**/*.rb")
if File.exists?("#{plugin_base}/README") if File.exist?("#{plugin_base}/README")
files.include("#{plugin_base}/README") files.include("#{plugin_base}/README")
options << "--main '#{plugin_base}/README'" options << "--main '#{plugin_base}/README'"
end end
files.include("#{plugin_base}/CHANGELOG") if File.exists?("#{plugin_base}/CHANGELOG") files.include("#{plugin_base}/CHANGELOG") if File.exist?("#{plugin_base}/CHANGELOG")


options << files.to_s options << files.to_s


Expand Down
2 changes: 1 addition & 1 deletion railties/lib/tasks/framework.rake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace :rails do
require 'railties_path' require 'railties_path'
project_dir = RAILS_ROOT + '/public/javascripts/' project_dir = RAILS_ROOT + '/public/javascripts/'
scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js'] scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js']
scripts.reject!{|s| File.basename(s) == 'application.js'} if File.exists?(project_dir + 'application.js') scripts.reject!{|s| File.basename(s) == 'application.js'} if File.exist?(project_dir + 'application.js')
FileUtils.cp(scripts, project_dir) FileUtils.cp(scripts, project_dir)
end end


Expand Down
4 changes: 2 additions & 2 deletions railties/lib/tasks/testing.rake
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)


# For modified files in app/ run the tests for it. ex. /test/functional/account_controller.rb # For modified files in app/ run the tests for it. ex. /test/functional/account_controller.rb
test = "#{modified_test_path}/#{source_file}_test.rb" test = "#{modified_test_path}/#{source_file}_test.rb"
tests.push test if File.exists?(test) tests.push test if File.exist?(test)


# For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb # For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb
test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}" test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}"
FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exists?(test) FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exist?(test)


return tests return tests


Expand Down
2 changes: 2 additions & 0 deletions railties/test/boot_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ def test_load_preinitializer_loads_preinitializer_file


def test_boot_vendor_rails_by_default def test_boot_vendor_rails_by_default
Rails.expects(:booted?).returns(false) Rails.expects(:booted?).returns(false)
Rails.expects(:preinitialize)
File.expects(:exist?).with("#{RAILS_ROOT}/vendor/rails").returns(true) File.expects(:exist?).with("#{RAILS_ROOT}/vendor/rails").returns(true)
Rails::VendorBoot.any_instance.expects(:run).returns('result') Rails::VendorBoot.any_instance.expects(:run).returns('result')
assert_equal 'result', Rails.boot! assert_equal 'result', Rails.boot!
end end


def test_boot_gem_rails_otherwise def test_boot_gem_rails_otherwise
Rails.expects(:booted?).returns(false) Rails.expects(:booted?).returns(false)
Rails.expects(:preinitialize)
File.expects(:exist?).with("#{RAILS_ROOT}/vendor/rails").returns(false) File.expects(:exist?).with("#{RAILS_ROOT}/vendor/rails").returns(false)
Rails::GemBoot.any_instance.expects(:run).returns('result') Rails::GemBoot.any_instance.expects(:run).returns('result')
assert_equal 'result', Rails.boot! assert_equal 'result', Rails.boot!
Expand Down

0 comments on commit ab9e4c0

Please sign in to comment.