Skip to content

Commit a5dd494

Browse files
committed
pass the gem name to Gem::Platform.match_gem?
Although this argument isn't used in the CRuby implementation, other implementations (specifically TruffleRuby) reserve the right to re-implement this method with special cases for specific gems. More context at rubygems/rubygems#3817
1 parent b473e19 commit a5dd494

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/tailwindcss/commands.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module Tailwindcss
44
module Commands
55
DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe"))
6+
GEM_NAME = "tailwindcss-rails"
67

78
# raised when the host platform is not supported by upstream tailwindcss's binary releases
89
class UnsupportedPlatformException < StandardError
@@ -34,15 +35,15 @@ def executable(exe_path: DEFAULT_DIR)
3435
MESSAGE
3536
end
3637
else
37-
if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), nil) }
38+
if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), GEM_NAME) }
3839
raise UnsupportedPlatformException, <<~MESSAGE
3940
tailwindcss-rails does not support the #{platform} platform
4041
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
4142
MESSAGE
4243
end
4344

4445
exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
45-
Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), nil)
46+
Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
4647
end
4748
end
4849

0 commit comments

Comments
 (0)