Skip to content

Commit 457b988

Browse files
authored
Merge pull request #6 from flavorjones/flavorjones-dev-standard
style: standardrb
2 parents 1eceb1c + caea6e6 commit 457b988

File tree

5 files changed

+27
-19
lines changed

5 files changed

+27
-19
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@ on:
1515
- '*'
1616

1717
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- run: rm Gemfile.lock
23+
- uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: "3.3"
26+
bundler: latest
27+
bundler-cache: true
28+
- run: bundle exec rake standard
29+
1830
build:
31+
needs: [ lint ]
1932
runs-on: ubuntu-latest
2033
strategy:
2134
fail-fast: false

exe/tailwindcss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ begin
1414
exec(*command)
1515
end
1616
rescue Tailwindcss::Ruby::UnsupportedPlatformException, Tailwindcss::Ruby::ExecutableNotFoundException => e
17-
STDERR.puts("ERROR: " + e.message)
17+
warn("ERROR: " + e.message)
1818
exit 1
1919
end

lib/tailwindcss/ruby/upstream.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Upstream
1111
"x86_64-darwin" => "tailwindcss-macos-x64",
1212
"x86_64-linux" => "tailwindcss-linux-x64",
1313
"aarch64-linux" => "tailwindcss-linux-arm64",
14-
"arm-linux" => "tailwindcss-linux-armv7",
14+
"arm-linux" => "tailwindcss-linux-armv7"
1515
}
1616
end
1717
end

rakelib/package.rake

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# coding: utf-8
21
#
32
# Rake tasks to manage native gem packages with binary executables from tailwindlabs/tailwindcss
43
#
@@ -39,7 +38,7 @@
3938
# - pkg/tailwindcss-ruby-1.0.0-x64-mingw-ucrt.gem
4039
# - pkg/tailwindcss-ruby-1.0.0-x86_64-darwin.gem
4140
# - pkg/tailwindcss-ruby-1.0.0-x86_64-linux.gem
42-
#
41+
#
4342
# Note that in addition to the native gems, a vanilla "ruby" gem will also be created without
4443
# either the `exe/tailwindcss` script or a binary executable present.
4544
#
@@ -75,7 +74,7 @@ end
7574
TAILWINDCSS_RUBY_GEMSPEC = Bundler.load_gemspec("tailwindcss-ruby.gemspec")
7675

7776
# prepend the download task before the Gem::PackageTask tasks
78-
task :package => :download
77+
task package: :download
7978

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

105104
# lazy, but fine for now.
106-
URI.open(release_url) do |remote|
107-
File.open(exepath, "wb") do |local|
108-
local.write(remote.read)
109-
end
105+
URI.parse(release_url).open do |remote|
106+
File.binwrite(exepath, remote.read)
110107
end
111-
FileUtils.chmod(0755, exepath, verbose: true)
108+
FileUtils.chmod(0o755, exepath, verbose: true)
112109
end
113110
end
114111
end
@@ -119,11 +116,11 @@ task "check" => exepaths do
119116
sha_url = if File.exist?(sha_filename)
120117
sha_filename
121118
else
122-
sha_url = tailwindcss_download_url("sha256sums.txt")
119+
tailwindcss_download_url("sha256sums.txt")
123120
end
124121
gemspec = TAILWINDCSS_RUBY_GEMSPEC
125122

126-
checksums = URI.open(sha_url).each_line.map do |line|
123+
checksums = URI.parse(sha_url).open.each_line.map do |line|
127124
checksum, file = line.split
128125
[File.basename(file), checksum]
129126
end.to_h

test/tailwindcss/test_ruby.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,11 @@ def mock_local_tailwindcss_install
108108
end
109109

110110
it ".executable raises ExecutableNotFoundException is TAILWINDCSS_INSTALL_DIR is set to a nonexistent dir" do
111-
begin
112-
ENV["TAILWINDCSS_INSTALL_DIR"] = "/does/not/exist"
113-
assert_raises(Tailwindcss::Ruby::DirectoryNotFoundException) do
114-
Tailwindcss::Ruby.executable
115-
end
116-
ensure
117-
ENV["TAILWINDCSS_INSTALL_DIR"] = nil
111+
ENV["TAILWINDCSS_INSTALL_DIR"] = "/does/not/exist"
112+
assert_raises(Tailwindcss::Ruby::DirectoryNotFoundException) do
113+
Tailwindcss::Ruby.executable
118114
end
115+
ensure
116+
ENV["TAILWINDCSS_INSTALL_DIR"] = nil
119117
end
120118
end

0 commit comments

Comments
 (0)