Skip to content

Commit 6f2e748

Browse files
authored
Merge pull request #280 from lylo/gem-3.5.0-deprecation-warning
Fix deprecation warnings in 3.5.0
2 parents 8d2230c + a5dd494 commit 6f2e748

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
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::Platform.new(p)) }
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::Platform.new(File.basename(File.dirname(f))))
46+
Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), GEM_NAME)
4647
end
4748
end
4849

test/lib/tailwindcss/commands_test.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def mock_exe_directory(platform)
77
FileUtils.mkdir(File.join(dir, platform))
88
path = File.join(dir, platform, "tailwindcss")
99
FileUtils.touch(path)
10-
Gem::Platform.stub(:match, true) do
10+
Gem::Platform.stub(:match_gem?, true) do
1111
yield(dir, path)
1212
end
1313
end
@@ -35,7 +35,7 @@ def mock_local_tailwindcss_install
3535
end
3636

3737
test ".executable raises UnsupportedPlatformException when we're not on a supported platform" do
38-
Gem::Platform.stub(:match, false) do # nothing is supported
38+
Gem::Platform.stub(:match_gem?, false) do # nothing is supported
3939
assert_raises(Tailwindcss::Commands::UnsupportedPlatformException) do
4040
Tailwindcss::Commands.executable
4141
end
@@ -66,7 +66,7 @@ def mock_local_tailwindcss_install
6666
end
6767

6868
test ".executable returns the executable in TAILWINDCSS_INSTALL_DIR when we're not on a supported platform" do
69-
Gem::Platform.stub(:match, false) do # nothing is supported
69+
Gem::Platform.stub(:match_gem?, false) do # nothing is supported
7070
mock_local_tailwindcss_install do |local_install_dir, expected|
7171
result = nil
7272
begin

0 commit comments

Comments
 (0)