filewatcher-cli 1.0.0 → 1.1.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/CHANGELOG.md +6 -0
- data/lib/filewatcher/cli/command.rb +3 -1
- data/lib/filewatcher/cli/constants.rb +1 -1
- data/lib/filewatcher/cli/spec_helper/dump_to_file.rb +7 -1
- data/lib/filewatcher/cli/spec_helper/dumpers/env_dumper.rb +1 -1
- data/lib/filewatcher/cli/spec_helper/shell_watch_run.rb +19 -10
- data/lib/filewatcher/cli/spec_helper.rb +0 -2
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6f941a4729f6f4fd84d8343acf978073fc733d55420a8f11b133209ff627eb3
|
4
|
+
data.tar.gz: 4992a109feae47f97992af65ebbdc790bcfa0261fc9c46e6f1898ccd85dcf7b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aea329b7ee4998092192c617a413b05836ecbc8ae3e72cb524be8f6b73e518e9e1e80242c2ba3cdb3a8aa9283cf1a016bcfb501e57806d64f35403c9c7621972
|
7
|
+
data.tar.gz: 54f9a98af365f1425bb49709204649e13719e96eaf844face8f7e4d6d190c066e511d391e38529102e9e0d21cea0ab0ce02fdb163eed00910de1ade22a0ead3c
|
data/CHANGELOG.md
CHANGED
@@ -18,7 +18,9 @@ class Filewatcher
|
|
18
18
|
|
19
19
|
require_relative 'command/options'
|
20
20
|
|
21
|
-
parameter 'FILES', 'file names to scan'
|
21
|
+
parameter 'FILES', 'file names to scan' do |string|
|
22
|
+
split_files_void_escaped_whitespace string.split unless string.to_s.empty?
|
23
|
+
end
|
22
24
|
|
23
25
|
parameter '[COMMAND]', 'shell command to execute when file changes'
|
24
26
|
|
@@ -3,5 +3,11 @@
|
|
3
3
|
require_relative 'shell_watch_run'
|
4
4
|
|
5
5
|
def dump_to_file(content)
|
6
|
-
|
6
|
+
Filewatcher::CLI::SpecHelper.debug "#{__method__} #{content.inspect}"
|
7
|
+
|
8
|
+
File.write(
|
9
|
+
File.join(Filewatcher::CLI::SpecHelper::ShellWatchRun::DUMP_FILE),
|
10
|
+
"#{content}\n",
|
11
|
+
mode: 'a+'
|
12
|
+
)
|
7
13
|
end
|
@@ -16,8 +16,10 @@ class Filewatcher
|
|
16
16
|
|
17
17
|
DUMP_FILE = File.join(TMP_DIR, 'dump')
|
18
18
|
|
19
|
-
def initialize(options:, dumper:, dumper_args:, **rest_args)
|
19
|
+
def initialize(watch_path, options:, dumper:, dumper_args:, **rest_args)
|
20
20
|
super(**rest_args)
|
21
|
+
|
22
|
+
@watch_path = watch_path
|
21
23
|
@options = options
|
22
24
|
@options[:interval] ||= 0.2
|
23
25
|
debug "options = #{options_string}"
|
@@ -69,7 +71,7 @@ class Filewatcher
|
|
69
71
|
def spawn_filewatcher
|
70
72
|
dumper_full_command = "#{__dir__}/dumpers/#{@dumper}_dumper.rb #{@dumper_args}"
|
71
73
|
spawn_command =
|
72
|
-
"#{EXECUTABLE} #{options_string} \"#{@
|
74
|
+
"#{EXECUTABLE} #{options_string} \"#{@watch_path}\" \"ruby #{dumper_full_command}\""
|
73
75
|
debug "spawn_command = #{spawn_command}"
|
74
76
|
@pid = spawn spawn_command, **SPAWN_OPTIONS
|
75
77
|
|
@@ -81,7 +83,7 @@ class Filewatcher
|
|
81
83
|
def make_changes
|
82
84
|
super
|
83
85
|
|
84
|
-
wait seconds: 3 do
|
86
|
+
wait seconds: 3, interval: 0.5 do
|
85
87
|
dump_file_exists = File.exist?(DUMP_FILE)
|
86
88
|
debug "#{__method__}: File.exist?(DUMP_FILE) = #{dump_file_exists}"
|
87
89
|
debug "#{__method__}: DUMP_FILE content = #{File.read(DUMP_FILE)}" if dump_file_exists
|
@@ -90,14 +92,12 @@ class Filewatcher
|
|
90
92
|
end
|
91
93
|
|
92
94
|
def kill_filewatcher
|
93
|
-
|
95
|
+
debug __method__
|
96
|
+
|
94
97
|
if Gem.win_platform?
|
95
98
|
Process.kill('KILL', @pid)
|
96
99
|
else
|
97
|
-
|
98
|
-
## Solution: https://stackoverflow.com/a/45032252/2630849
|
99
|
-
Process.kill('TERM', -Process.getpgid(@pid))
|
100
|
-
Process.waitall
|
100
|
+
unix_kill_filewatcher
|
101
101
|
end
|
102
102
|
rescue Errno::ESRCH
|
103
103
|
nil ## already killed
|
@@ -105,6 +105,15 @@ class Filewatcher
|
|
105
105
|
wait
|
106
106
|
end
|
107
107
|
|
108
|
+
def unix_kill_filewatcher
|
109
|
+
## Problems: https://github.com/thomasfl/filewatcher/pull/83
|
110
|
+
## Solution: https://stackoverflow.com/a/45032252/2630849
|
111
|
+
debug 'Process KILL'
|
112
|
+
Process.kill('KILL', -Process.getpgid(@pid))
|
113
|
+
debug 'Process waitall'
|
114
|
+
Process.waitall
|
115
|
+
end
|
116
|
+
|
108
117
|
def pid_state
|
109
118
|
if Gem.win_platform?
|
110
119
|
match = `tasklist /FI "PID eq #{@pid}" /FO "LIST" /V`.match(/Status:\s+(\w+)/)
|
@@ -128,8 +137,8 @@ class Filewatcher
|
|
128
137
|
ps == (Gem.win_platform? ? 'Running' : 'S')
|
129
138
|
end
|
130
139
|
|
131
|
-
def wait(seconds: 1)
|
132
|
-
super seconds: seconds, interval:
|
140
|
+
def wait(seconds: 1, interval: @options[:interval])
|
141
|
+
super seconds: seconds, interval: interval
|
133
142
|
end
|
134
143
|
end
|
135
144
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filewatcher-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Flemming
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '2.
|
34
|
+
version: '2.1'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '2.
|
41
|
+
version: '2.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: pry-byebug
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,14 +101,14 @@ dependencies:
|
|
101
101
|
requirements:
|
102
102
|
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.
|
104
|
+
version: 0.14.2
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - "~>"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.
|
111
|
+
version: 0.14.2
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
113
|
name: codecov
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,14 +157,14 @@ dependencies:
|
|
157
157
|
requirements:
|
158
158
|
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: 1.
|
160
|
+
version: 1.39.0
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: 1.
|
167
|
+
version: 1.39.0
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
169
|
name: rubocop-performance
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,14 +185,14 @@ dependencies:
|
|
185
185
|
requirements:
|
186
186
|
- - "~>"
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: 2.15.0
|
189
189
|
type: :development
|
190
190
|
prerelease: false
|
191
191
|
version_requirements: !ruby/object:Gem::Requirement
|
192
192
|
requirements:
|
193
193
|
- - "~>"
|
194
194
|
- !ruby/object:Gem::Version
|
195
|
-
version:
|
195
|
+
version: 2.15.0
|
196
196
|
description: 'CLI for Filewatcher.
|
197
197
|
|
198
198
|
'
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
246
|
- !ruby/object:Gem::Version
|
247
247
|
version: '0'
|
248
248
|
requirements: []
|
249
|
-
rubygems_version: 3.3.
|
249
|
+
rubygems_version: 3.3.26
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: CLI for Filewatcher
|