/
tailwindcss
executable file
·46 lines (36 loc) · 1.51 KB
/
tailwindcss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env ruby
# because rubygems shims assume a gem's executables are Ruby
require "shellwords"
require "tailwindcss/upstream"
supported_platforms = Tailwindcss::Upstream::NATIVE_PLATFORMS.keys
platform = [:cpu, :os].map { |m| Gem::Platform.local.send(m) }.join("-")
if supported_platforms.none? { |supported_platform| Gem::Platform.match(supported_platform) }
STDERR.puts(<<~ERRMSG)
ERROR: tailwindcss-rails does not support the #{platform} platform
Please install tailwindcss following instructions at https://tailwindcss.com/docs/installation
ERRMSG
exit 1
end
exe_path = Dir.glob(File.join(__dir__, "*", "tailwindcss")).find do |f|
Gem::Platform.match(File.basename(File.dirname(f)))
end
if exe_path.nil?
STDERR.puts(<<~ERRMSG)
ERROR: Cannot find the tailwindcss executable for #{platform} in #{__dir__}
If you're using bundler, please make sure you're on the latest bundler version:
gem install bundler
bundle update --bundler
Then make sure your lock file includes this platform by running:
bundle lock --add-platform #{platform}
bundle install
See `bundle lock --help` output for details.
If you're still seeing this message after taking those steps, try running
`bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
https://github.com/rails/tailwindcss-rails#check-bundle_force_ruby_platform
for more details.
ERRMSG
exit 1
end
command = Shellwords.join([exe_path, ARGV].flatten)
puts "+ #{command}"
exec(command)