Skip to content

Commit 1ecc9ba

Browse files
committed
Fix platform detection for jruby
1 parent 35cd405 commit 1ecc9ba

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

exe/dartsass

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
# because rubygems shims assume a gem's executables are Ruby
33

44
require "shellwords"
5+
require "rbconfig"
56

6-
platform_info = Gem::Platform.local
7-
platform_string = "#{platform_info.cpu}-#{platform_info.os}"
7+
system_config = RbConfig::CONFIG
8+
platform_string = "#{system_config["host_cpu"]}-#{system_config["host_os"]}"
89

9-
exe_path =
10+
exe_path =
1011
case platform_string
11-
when "aarch64-linux" then File.join(__dir__, "aarch64-linux/sass")
12-
when "arm64-darwin" then File.join(__dir__, "arm64-darwin/sass")
13-
when /darwin\z/ then File.join(__dir__, "darwin/sass")
14-
when /linux\z/ then File.join(__dir__, "linux/sass")
15-
when /mingw32\z/ then File.join(__dir__, "mingw32/sass.bat")
12+
when /aarch64-linux/ then File.join(__dir__, "aarch64-linux/sass")
13+
when /arm64-darwin/ then File.join(__dir__, "arm64-darwin/sass")
14+
when /darwin/ then File.join(__dir__, "darwin/sass")
15+
when /linux/ then File.join(__dir__, "linux/sass")
16+
when /mswin|mingw|cygwin/ then File.join(__dir__, "mingw32/sass.bat")
1617
else
1718
STDERR.puts(<<~ERRMSG)
1819
ERROR: dartsass-rails does not support the #{platform_string} platform

0 commit comments

Comments
 (0)