Permalink
Browse files

Use Config::CONFIG['host_os'] instead of RUBY_PLATFORM [#4477 state:r…

…esolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent e813ad2 commit 53c13f1acaa2eb05e7f418b53f6156a4f5a773e0 @anildigital anildigital committed with jeremy Apr 26, 2010
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'rbconfig'
# The view_paths array must be set on Base and not LayoutTest so that LayoutTest's inherited
# method has access to the view_paths array when looking for a layout to automatically assign.
@@ -209,7 +210,7 @@ def test_layout_status_is_rendered
end
end
-unless RUBY_PLATFORM =~ /mswin|mingw/
+unless Config::CONFIG['host_os'] =~ /mswin|mingw/
class LayoutSymlinkedTest < LayoutTest
layout "symlinked/symlinked_layout"
end
@@ -1,3 +1,4 @@
+require 'rbconfig'
module Kernel
# Sets $VERBOSE to nil for the duration of the block and back to its original value afterwards.
#
@@ -37,7 +38,7 @@ def silence_stderr #:nodoc:
# puts 'But this will'
def silence_stream(stream)
old_stream = stream.dup
- stream.reopen(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
+ stream.reopen(Config::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
stream.sync = true
yield
ensure
@@ -1,3 +1,4 @@
+require 'rbconfig'
module ActiveSupport
module Testing
class RemoteError < StandardError
@@ -33,7 +34,7 @@ def method_missing(name, *args)
module Isolation
def self.forking_env?
- !ENV["NO_FORK"] && RUBY_PLATFORM !~ /mswin|mingw|java/
+ !ENV["NO_FORK"] && ((Config::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
end
def self.included(base)
View
@@ -6,6 +6,7 @@ require 'rake/gempackagetask'
require 'date'
require 'rbconfig'
+
task :default => :test
task :test => 'test:isolated'
@@ -1,4 +1,5 @@
require 'optparse'
+require 'rbconfig'
options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
code_or_file = nil
@@ -18,7 +19,7 @@
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 "-------------------------------------------------------------"
@@ -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 @@ def find_root_with_flag(flag, default=nil)
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
@@ -1,5 +1,6 @@
require 'open-uri'
require 'active_support/deprecation'
+require 'rbconfig'
module Rails
module Generators
@@ -240,7 +241,7 @@ def generate(what, *args)
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 @@ def log(*args)
# 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
@@ -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 @@ def mysql_socket
"/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 = {})
@@ -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

0 comments on commit 53c13f1

Please sign in to comment.