io-watch 0.4.0 → 0.5.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
- checksums.yaml.gz.sig +0 -0
- data/bin/io-watch +30 -11
- data/lib/io/watch/monitor.rb +6 -2
- data/lib/io/watch/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc26487e8282e4fb61d521424ea49b98606676fb04768fbe94e5244a44b4642
|
4
|
+
data.tar.gz: '08666b566a234b2e64c49ea40ff878070d12cb53398cf3b883bff22ef1542bbb'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51ee161b28baae33c5745658a77a82dd01bca7b6b350a60af90a19d38c3bbb329b00c242a81ae58134ea91445101c719f6b6b2a85013bb668390f31c52d7580c
|
7
|
+
data.tar.gz: 9224e4d78d0509c987aba237df97babd0ed6caef5cc1f7012b4151c3ac84cd81ba2f67aa473163ce542d6325cbbf79c87ffeffb53b43de2c1142d5bc4596d618
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/io-watch
CHANGED
@@ -12,22 +12,41 @@ if command.first =~ /TERM|INT|KILL|QUIT|HUP/
|
|
12
12
|
end
|
13
13
|
|
14
14
|
if split = command.index('--')
|
15
|
-
roots = command.
|
16
|
-
command.
|
15
|
+
roots = command.shift(split)
|
16
|
+
command.shift
|
17
17
|
else
|
18
18
|
roots = [Dir.pwd]
|
19
19
|
end
|
20
20
|
|
21
|
+
Console.debug(self, "Watching", roots: roots, command: command, signal: signal)
|
22
|
+
|
23
|
+
if command.empty?
|
24
|
+
Console.error(self, "No command given")
|
25
|
+
exit 1
|
26
|
+
end
|
27
|
+
|
28
|
+
if roots.empty?
|
29
|
+
Console.error(self, "No roots given")
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
21
33
|
monitor = IO::Watch::Monitor.new(roots)
|
22
34
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
35
|
+
begin
|
36
|
+
monitor.run do
|
37
|
+
if pid
|
38
|
+
Console.debug(self, "Killing command...", pid: pid)
|
39
|
+
Process.kill(signal, pid)
|
40
|
+
Process.wait(pid)
|
41
|
+
end
|
42
|
+
|
43
|
+
Console.debug(self, "Starting command...")
|
44
|
+
pid = Process.spawn(*command)
|
45
|
+
Console.debug(self, "Started command", pid: pid)
|
28
46
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
47
|
+
rescue Interrupt
|
48
|
+
# Ignore.
|
49
|
+
ensure
|
50
|
+
Process.kill('TERM', pid)
|
51
|
+
Process.wait(pid)
|
33
52
|
end
|
data/lib/io/watch/monitor.rb
CHANGED
@@ -27,7 +27,7 @@ class IO
|
|
27
27
|
#
|
28
28
|
# @parameter roots [Array(String)] The list of root directories to watch. Changes to these directories, and their children, recursively, will be reported.
|
29
29
|
# @parameter latency [Float] The latency to use when watching the filesystem.
|
30
|
-
def initialize(roots, latency
|
30
|
+
def initialize(roots, latency: nil)
|
31
31
|
@roots = roots
|
32
32
|
@latency = latency
|
33
33
|
end
|
@@ -42,7 +42,11 @@ class IO
|
|
42
42
|
# @yields {|event| ...} Yielded for each event that occurs.
|
43
43
|
# @parameter event [Hash] The event that occurred.
|
44
44
|
def run
|
45
|
-
environment = {
|
45
|
+
environment = {}
|
46
|
+
if @latency
|
47
|
+
environment['IO_WATCH_LATENCY'] = @latency.to_s
|
48
|
+
end
|
49
|
+
|
46
50
|
IO.pipe do |input, output|
|
47
51
|
pid = Process.spawn(environment, self.class.command_path, *@roots, out: output)
|
48
52
|
output.close
|
data/lib/io/watch/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
A�"�:~gI�Щ҈��W���{h1�g-4�(�Lw~�+��9���څW�wɫ�?E�^%��5 H�'��D�6G5���Ϙ�e]��>���6ٯ�������������KH}�P�v�mU 7�F���x��M�)�0ʙ��$+������
|
2
|
+
O�$^�����
|