Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ on:
- '*'

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rm Gemfile.lock
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler: latest
bundler-cache: true
- run: bundle exec rake standard

build:
needs: [ lint ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
2 changes: 1 addition & 1 deletion exe/tailwindcss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ begin
exec(*command)
end
rescue Tailwindcss::Ruby::UnsupportedPlatformException, Tailwindcss::Ruby::ExecutableNotFoundException => e
STDERR.puts("ERROR: " + e.message)
warn("ERROR: " + e.message)
exit 1
end
2 changes: 1 addition & 1 deletion lib/tailwindcss/ruby/upstream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Upstream
"x86_64-darwin" => "tailwindcss-macos-x64",
"x86_64-linux" => "tailwindcss-linux-x64",
"aarch64-linux" => "tailwindcss-linux-arm64",
"arm-linux" => "tailwindcss-linux-armv7",
"arm-linux" => "tailwindcss-linux-armv7"
}
end
end
Expand Down
17 changes: 7 additions & 10 deletions rakelib/package.rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# coding: utf-8
#
# Rake tasks to manage native gem packages with binary executables from tailwindlabs/tailwindcss
#
Expand Down Expand Up @@ -39,7 +38,7 @@
# - pkg/tailwindcss-ruby-1.0.0-x64-mingw-ucrt.gem
# - pkg/tailwindcss-ruby-1.0.0-x86_64-darwin.gem
# - pkg/tailwindcss-ruby-1.0.0-x86_64-linux.gem
#
#
# Note that in addition to the native gems, a vanilla "ruby" gem will also be created without
# either the `exe/tailwindcss` script or a binary executable present.
#
Expand Down Expand Up @@ -75,7 +74,7 @@ end
TAILWINDCSS_RUBY_GEMSPEC = Bundler.load_gemspec("tailwindcss-ruby.gemspec")

# prepend the download task before the Gem::PackageTask tasks
task :package => :download
task package: :download

gem_path = Gem::PackageTask.new(TAILWINDCSS_RUBY_GEMSPEC).define
desc "Build the ruby gem"
Expand Down Expand Up @@ -103,12 +102,10 @@ Tailwindcss::Ruby::Upstream::NATIVE_PLATFORMS.each do |platform, filename|
warn "Downloading #{exepath} from #{release_url} ..."

# lazy, but fine for now.
URI.open(release_url) do |remote|
File.open(exepath, "wb") do |local|
local.write(remote.read)
end
URI.parse(release_url).open do |remote|
File.binwrite(exepath, remote.read)
end
FileUtils.chmod(0755, exepath, verbose: true)
FileUtils.chmod(0o755, exepath, verbose: true)
end
end
end
Expand All @@ -119,11 +116,11 @@ task "check" => exepaths do
sha_url = if File.exist?(sha_filename)
sha_filename
else
sha_url = tailwindcss_download_url("sha256sums.txt")
tailwindcss_download_url("sha256sums.txt")
end
gemspec = TAILWINDCSS_RUBY_GEMSPEC

checksums = URI.open(sha_url).each_line.map do |line|
checksums = URI.parse(sha_url).open.each_line.map do |line|
checksum, file = line.split
[File.basename(file), checksum]
end.to_h
Expand Down
12 changes: 5 additions & 7 deletions test/tailwindcss/test_ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ def mock_local_tailwindcss_install
end

it ".executable raises ExecutableNotFoundException is TAILWINDCSS_INSTALL_DIR is set to a nonexistent dir" do
begin
ENV["TAILWINDCSS_INSTALL_DIR"] = "/does/not/exist"
assert_raises(Tailwindcss::Ruby::DirectoryNotFoundException) do
Tailwindcss::Ruby.executable
end
ensure
ENV["TAILWINDCSS_INSTALL_DIR"] = nil
ENV["TAILWINDCSS_INSTALL_DIR"] = "/does/not/exist"
assert_raises(Tailwindcss::Ruby::DirectoryNotFoundException) do
Tailwindcss::Ruby.executable
end
ensure
ENV["TAILWINDCSS_INSTALL_DIR"] = nil
end
end