aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorAnil Wadghule <anildigital@gmail.com>2010-04-26 20:55:07 +0530
committerJeremy Kemper <jeremy@bitsweat.net>2010-04-26 11:12:52 -0700
commit53c13f1acaa2eb05e7f418b53f6156a4f5a773e0 (patch)
treee6a0a66b7f4af519f03a190db5443b2e6d11fcce /railties
parente813ad2a42549e308a69fd9473f1b9ed531a0d7e (diff)
downloadrails-53c13f1acaa2eb05e7f418b53f6156a4f5a773e0.tar.gz
rails-53c13f1acaa2eb05e7f418b53f6156a4f5a773e0.tar.bz2
rails-53c13f1acaa2eb05e7f418b53f6156a4f5a773e0.zip
Use Config::CONFIG['host_os'] instead of RUBY_PLATFORM [#4477 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'railties')
-rw-r--r--railties/Rakefile1
-rw-r--r--railties/lib/rails/commands/runner.rb3
-rw-r--r--railties/lib/rails/engine.rb3
-rw-r--r--railties/lib/rails/generators/actions.rb5
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb3
-rw-r--r--railties/lib/rails/test_unit/testing.rake2
6 files changed, 11 insertions, 6 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index d88036f829..daffd8ce30 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -6,6 +6,7 @@ require 'rake/gempackagetask'
require 'date'
require 'rbconfig'
+
task :default => :test
task :test => 'test:isolated'
diff --git a/railties/lib/rails/commands/runner.rb b/railties/lib/rails/commands/runner.rb
index 5634ee0f69..1dd11e1241 100644
--- a/railties/lib/rails/commands/runner.rb
+++ b/railties/lib/rails/commands/runner.rb
@@ -1,4 +1,5 @@
require 'optparse'
+require 'rbconfig'
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
code_or_file = nil
@@ -18,7 +19,7 @@ ARGV.clone.options do |opts|
opts.on("-h", "--help",
"Show this help message.") { $stderr.puts opts; exit }
- if RUBY_PLATFORM !~ /mswin|mingw/
+ if Config::CONFIG['host_os'] !~ /mswin|mingw/
opts.separator ""
opts.separator "You can also use runner as a shebang line for your scripts like this:"
opts.separator "-------------------------------------------------------------"
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index 98da7e2b4a..36fcc896ae 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -1,6 +1,7 @@
require 'rails/railtie'
require 'active_support/core_ext/module/delegation'
require 'pathname'
+require 'rbconfig'
module Rails
# Rails::Engine allows you to wrap a specific Rails application and share it accross
@@ -119,7 +120,7 @@ module Rails
root = File.exist?("#{root_path}/#{flag}") ? root_path : default
raise "Could not find root path for #{self}" unless root
- RUBY_PLATFORM =~ /mswin|mingw/ ?
+ Config::CONFIG['host_os'] =~ /mswin|mingw/ ?
Pathname.new(root).expand_path : Pathname.new(root).realpath
end
end
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 7dec4d446a..a31932906d 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -1,5 +1,6 @@
require 'open-uri'
require 'active_support/deprecation'
+require 'rbconfig'
module Rails
module Generators
@@ -240,7 +241,7 @@ module Rails
def rake(command, options={})
log :rake, command
env = options[:env] || 'development'
- sudo = options[:sudo] && RUBY_PLATFORM !~ /mswin|mingw/ ? 'sudo ' : ''
+ sudo = options[:sudo] && Config::CONFIG['host_os'] !~ /mswin|mingw/ ? 'sudo ' : ''
in_root { run("#{sudo}#{extify(:rake)} #{command} RAILS_ENV=#{env}", :verbose => false) }
end
@@ -307,7 +308,7 @@ module Rails
# Add an extension to the given name based on the platform.
#
def extify(name)
- if RUBY_PLATFORM =~ /mswin|mingw/
+ if Config::CONFIG['host_os'] =~ /mswin|mingw/
"#{name}.bat"
else
name
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 6818fafbe9..aa066fe3c4 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -1,6 +1,7 @@
require 'digest/md5'
require 'active_support/secure_random'
require 'rails/version' unless defined?(Rails::VERSION)
+require 'rbconfig'
module Rails::Generators
# We need to store the RAILS_DEV_PATH in a constant, otherwise the path
@@ -265,7 +266,7 @@ module Rails::Generators
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
"/opt/lampp/var/mysql/mysql.sock" # xampp for linux
- ].find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /mswin|mingw/
+ ].find { |f| File.exist?(f) } unless Config::CONFIG['host_os'] =~ /mswin|mingw/
end
def empty_directory_with_gitkeep(destination, config = {})
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index f69a1169d9..79fa667ed1 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -32,7 +32,7 @@ end
module Kernel
def silence_stderr
old_stderr = STDERR.dup
- STDERR.reopen(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
+ STDERR.reopen(Config::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
STDERR.sync = true
yield
ensure