tailwindcss-rails 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tailwindcss/process_runner.rb +59 -0
- data/lib/tailwindcss/version.rb +1 -1
- data/lib/tailwindcss-rails.rb +1 -0
- data/lib/tasks/build.rake +2 -3
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f267a171a6a28b6a5f433e4957f72f4edf6c027cfd386c3aa1ed96fc6a2eb6f6
|
|
4
|
+
data.tar.gz: 025b01f752fafb76b48717d2ce07b03bd23fed1106a4ca2dafe2bea850538341
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d04850588508ebf0adc736879845b1cb8d6f992768487ed9274f752388183280860d75640096953a2dc1dbac9be32730962ccd9292c04487692baecbe8d5c1ed
|
|
7
|
+
data.tar.gz: 8b008e2b24fcfd5e238155ae456ca1249c3d7767fa6b96db34349173493291dfcdce20dffc3d97799322c6669f77b77bfd3a52723a3d72de9f940b1c6a690678
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Tailwindcss
|
|
2
|
+
# Runs a child process and forwards stop signals (INT/TERM) to it, blocking
|
|
3
|
+
# until it exits, so a process manager that signals this process directly
|
|
4
|
+
# (e.g. foreman) doesn't leave the child orphaned. Shaped like
|
|
5
|
+
# +Process.spawn+/+Kernel#system+: it takes an +env+ hash followed by the
|
|
6
|
+
# command.
|
|
7
|
+
module ProcessRunner
|
|
8
|
+
# Signals we forward to the spawned process so it shuts down with us instead
|
|
9
|
+
# of being orphaned.
|
|
10
|
+
FORWARDED_SIGNALS = %w[INT TERM].freeze
|
|
11
|
+
|
|
12
|
+
class << self
|
|
13
|
+
# Spawn +command+ with +env+ and block until it exits, forwarding INT
|
|
14
|
+
# (Ctrl-C) and TERM (e.g. foreman shutdown) to it so a process manager
|
|
15
|
+
# that signals us directly doesn't leave an orphaned child behind.
|
|
16
|
+
# Restores the previous signal handlers before returning so the
|
|
17
|
+
# process-global traps aren't left changed. Returns the name of the signal
|
|
18
|
+
# that was received (e.g. "TERM"), or nil if the child exited on its own.
|
|
19
|
+
def spawn_and_wait(env, *command)
|
|
20
|
+
pid = nil
|
|
21
|
+
received_signal = nil
|
|
22
|
+
previous_traps = {}
|
|
23
|
+
|
|
24
|
+
forward_signal = ->(signal) do
|
|
25
|
+
if pid
|
|
26
|
+
Process.kill(signal, pid)
|
|
27
|
+
end
|
|
28
|
+
rescue Errno::ESRCH
|
|
29
|
+
# the child already exited
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Trap immediately before spawning. If a signal lands before pid is
|
|
33
|
+
# assigned, remember it and forward it once the child exists.
|
|
34
|
+
FORWARDED_SIGNALS.each do |signal|
|
|
35
|
+
previous_traps[signal] = trap(signal) do
|
|
36
|
+
received_signal ||= signal
|
|
37
|
+
forward_signal.call(signal)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
pid = Process.spawn(env, *command)
|
|
42
|
+
# If a signal arrived during spawn (before pid was set), the handler
|
|
43
|
+
# couldn't forward it yet, so forward it now.
|
|
44
|
+
if received_signal
|
|
45
|
+
forward_signal.call(received_signal)
|
|
46
|
+
end
|
|
47
|
+
Process.wait(pid)
|
|
48
|
+
# Drop the pid so a late signal can't kill a process that reused it.
|
|
49
|
+
pid = nil
|
|
50
|
+
|
|
51
|
+
received_signal
|
|
52
|
+
ensure
|
|
53
|
+
previous_traps.each do |signal, previous_trap|
|
|
54
|
+
trap(signal, previous_trap)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/tailwindcss/version.rb
CHANGED
data/lib/tailwindcss-rails.rb
CHANGED
data/lib/tasks/build.rake
CHANGED
|
@@ -23,9 +23,8 @@ namespace :tailwindcss do
|
|
|
23
23
|
env = Tailwindcss::Commands.command_env(verbose: verbose)
|
|
24
24
|
puts "Running: #{Shellwords.join(command)}" if verbose
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
puts "Received interrupt, exiting tailwindcss:watch" if args.extras.include?("verbose")
|
|
26
|
+
received_signal = Tailwindcss::ProcessRunner.spawn_and_wait(env, *command)
|
|
27
|
+
puts "Received #{received_signal}, exiting tailwindcss:watch" if verbose && received_signal
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
desc "Create Tailwind CSS entry point files for Rails Engines"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tailwindcss-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -74,6 +74,7 @@ files:
|
|
|
74
74
|
- lib/tailwindcss/commands.rb
|
|
75
75
|
- lib/tailwindcss/engine.rb
|
|
76
76
|
- lib/tailwindcss/engines.rb
|
|
77
|
+
- lib/tailwindcss/process_runner.rb
|
|
77
78
|
- lib/tailwindcss/upstream.rb
|
|
78
79
|
- lib/tailwindcss/version.rb
|
|
79
80
|
- lib/tasks/build.rake
|