Skip to content

Commit

Permalink
Fix deprecation warnings in 3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
lylo committed Oct 9, 2023
1 parent f8ee6a5 commit b13abc2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/tailwindcss/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def executable(exe_path: DEFAULT_DIR)
MESSAGE
end
else
if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match(Gem::Platform.new(p)) }
if Tailwindcss::Upstream::NATIVE_PLATFORMS.keys.none? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), nil) }
raise UnsupportedPlatformException, <<~MESSAGE
tailwindcss-rails does not support the #{platform} platform
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
MESSAGE
end

exe_file = Dir.glob(File.expand_path(File.join(exe_path, "*", "tailwindcss"))).find do |f|
Gem::Platform.match(Gem::Platform.new(File.basename(File.dirname(f))))
Gem::Platform.match_gem?(Gem::Platform.new(File.basename(File.dirname(f))), nil)
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/lib/tailwindcss/commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def mock_exe_directory(platform)
FileUtils.mkdir(File.join(dir, platform))
path = File.join(dir, platform, "tailwindcss")
FileUtils.touch(path)
Gem::Platform.stub(:match, true) do
Gem::Platform.stub(:match_gem?, true) do
yield(dir, path)
end
end
Expand Down Expand Up @@ -35,7 +35,7 @@ def mock_local_tailwindcss_install
end

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

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

0 comments on commit b13abc2

Please sign in to comment.