提交 75607a67 编写于 作者: Y yuuji.yaginuma

use `Gem.win_platform?` to check windows Ruby platforms

`Gem.win_platform?` check if it is Windows more accurately.
Ref: https://github.com/ruby/ruby/blob/ruby_2_2/lib/rubygems.rb#L945..L952
上级 0e97cd1a
......@@ -204,7 +204,7 @@ def test_ignores_unknown_http_methods
end
# Windows doesn't allow \ / : * ? " < > | in filenames
unless RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
unless Gem.win_platform?
def test_serves_static_file_with_colon
with_static_file "/foo/foo:bar.html" do |file|
assert_html file, get("/foo/foo%3Abar.html")
......
......@@ -252,7 +252,7 @@ def test_layout_status_is_rendered
end
end
unless /mswin|mingw/.match?(RbConfig::CONFIG["host_os"])
unless Gem.win_platform?
class LayoutSymlinkedTest < LayoutTest
layout "symlinked/symlinked_layout"
end
......
......@@ -8,7 +8,7 @@ Run the Ruby file located at `path/to/filename.rb` after loading the app:
<%= executable %> path/to/filename.rb
<% if RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ %>
<% unless Gem.win_platform? %>
You can also use the runner command as a shebang line for your executables:
#!/usr/bin/env <%= File.expand_path(executable) %>
......
......@@ -279,13 +279,13 @@ def log(*args)
def execute_command(executor, command, options = {})
log executor, command
env = options[:env] || ENV["RAILS_ENV"] || "development"
sudo = options[:sudo] && RbConfig::CONFIG["host_os"] !~ /mswin|mingw/ ? "sudo " : ""
sudo = options[:sudo] && !Gem.win_platform? ? "sudo " : ""
in_root { run("#{sudo}#{extify(executor)} #{command} RAILS_ENV=#{env}", verbose: false) }
end
# Add an extension to the given name based on the platform.
def extify(name)
if RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
if Gem.win_platform?
"#{name}.bat"
else
name
......
......@@ -433,7 +433,7 @@ def package_json_exist?
def yarn_path
commands = ["yarn"]
if RbConfig::CONFIG["host_os"] =~ /mswin|cygwin/
if Gem.win_platform?
ENV["PATHEXT"].split(File::PATH_SEPARATOR).each do |ext|
commands << commands[0] + ext
end
......
......@@ -428,7 +428,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 RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
].find { |f| File.exist?(f) } unless Gem.win_platform?
end
def get_builder_class
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册