filewatcher-cli 1.0.0 → 2.0.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 +15 -0
- data/lib/filewatcher/cli/command.rb +4 -2
- 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 +22 -12
- data/lib/filewatcher/cli/spec_helper.rb +0 -2
- metadata +7 -164
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35d0c06bd0f80ce0a6ad8df173029d074fb4e6fff7c71e479c86ef4b9e27144a
|
|
4
|
+
data.tar.gz: a4484b0e762361f0dc4975c3511f366f5ab776c33b7180fefbd38c8e3d288acb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d69b7f69c4489a76a57a29b2f33d19a77b4b37df6ea832f0b36b1c4021f4583fc4592772d9b51205924269f61efc68af58d9fedc4e964086bbb1f0204e14ed0
|
|
7
|
+
data.tar.gz: 05a0a3f4a65a51233cb67cc80032615c8dce81d2fff35717108d547a8bc181f924b3e228a6514edb35a76bbebe44d28fc4cf5949642e804d518481bef6be7d83
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 2.0.0 (2026-02-05)
|
|
6
|
+
|
|
7
|
+
* Drop Ruby 2.6, 2.7, 3.0 and 3.1 support.
|
|
8
|
+
* Add Ruby 3.2, 3.3, 3.4 and 4.0 support.
|
|
9
|
+
* Update Filewatcher dependency.
|
|
10
|
+
* Update development dependencies.
|
|
11
|
+
* Resolve new RuboCop offenses.
|
|
12
|
+
* Improve CI config.
|
|
13
|
+
|
|
14
|
+
## 1.1.0 (2022-11-19)
|
|
15
|
+
|
|
16
|
+
* Return the ability to pass paths separated by spaces.
|
|
17
|
+
* Update development dependencies.
|
|
18
|
+
* Resolve new RuboCop offenses.
|
|
19
|
+
|
|
5
20
|
## 1.0.0 (2022-09-09)
|
|
6
21
|
|
|
7
22
|
* Initial release.
|
|
@@ -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
|
|
|
@@ -64,7 +66,7 @@ class Filewatcher
|
|
|
64
66
|
|
|
65
67
|
def watch
|
|
66
68
|
@filewatcher.watch do |changes|
|
|
67
|
-
changes =
|
|
69
|
+
changes = changes.first(1) unless every?
|
|
68
70
|
|
|
69
71
|
changes.each do |filename, event|
|
|
70
72
|
command = command_for_file filename
|
|
@@ -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
|
|
@@ -12,12 +12,14 @@ class Filewatcher
|
|
|
12
12
|
include CLI::SpecHelper
|
|
13
13
|
|
|
14
14
|
executable_path = File.realpath "#{__dir__}/../../../../#{CLI::BINDIR}/filewatcher"
|
|
15
|
-
EXECUTABLE = "#{'ruby ' if Gem.win_platform?}#{executable_path}"
|
|
15
|
+
EXECUTABLE = "#{'ruby ' if Gem.win_platform?}#{executable_path}".freeze
|
|
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}"
|
|
@@ -65,11 +67,12 @@ class Filewatcher
|
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
SPAWN_OPTIONS = Gem.win_platform? ? {} : { pgroup: true }
|
|
70
|
+
private_constant :SPAWN_OPTIONS
|
|
68
71
|
|
|
69
72
|
def spawn_filewatcher
|
|
70
73
|
dumper_full_command = "#{__dir__}/dumpers/#{@dumper}_dumper.rb #{@dumper_args}"
|
|
71
74
|
spawn_command =
|
|
72
|
-
"#{EXECUTABLE} #{options_string} \"#{@
|
|
75
|
+
"#{EXECUTABLE} #{options_string} \"#{@watch_path}\" \"ruby #{dumper_full_command}\""
|
|
73
76
|
debug "spawn_command = #{spawn_command}"
|
|
74
77
|
@pid = spawn spawn_command, **SPAWN_OPTIONS
|
|
75
78
|
|
|
@@ -81,7 +84,7 @@ class Filewatcher
|
|
|
81
84
|
def make_changes
|
|
82
85
|
super
|
|
83
86
|
|
|
84
|
-
wait seconds: 3 do
|
|
87
|
+
wait seconds: 3, interval: 0.5 do
|
|
85
88
|
dump_file_exists = File.exist?(DUMP_FILE)
|
|
86
89
|
debug "#{__method__}: File.exist?(DUMP_FILE) = #{dump_file_exists}"
|
|
87
90
|
debug "#{__method__}: DUMP_FILE content = #{File.read(DUMP_FILE)}" if dump_file_exists
|
|
@@ -90,14 +93,12 @@ class Filewatcher
|
|
|
90
93
|
end
|
|
91
94
|
|
|
92
95
|
def kill_filewatcher
|
|
93
|
-
|
|
96
|
+
debug __method__
|
|
97
|
+
|
|
94
98
|
if Gem.win_platform?
|
|
95
99
|
Process.kill('KILL', @pid)
|
|
96
100
|
else
|
|
97
|
-
|
|
98
|
-
## Solution: https://stackoverflow.com/a/45032252/2630849
|
|
99
|
-
Process.kill('TERM', -Process.getpgid(@pid))
|
|
100
|
-
Process.waitall
|
|
101
|
+
unix_kill_filewatcher
|
|
101
102
|
end
|
|
102
103
|
rescue Errno::ESRCH
|
|
103
104
|
nil ## already killed
|
|
@@ -105,6 +106,15 @@ class Filewatcher
|
|
|
105
106
|
wait
|
|
106
107
|
end
|
|
107
108
|
|
|
109
|
+
def unix_kill_filewatcher
|
|
110
|
+
## Problems: https://github.com/thomasfl/filewatcher/pull/83
|
|
111
|
+
## Solution: https://stackoverflow.com/a/45032252/2630849
|
|
112
|
+
debug 'Process KILL'
|
|
113
|
+
Process.kill('KILL', -Process.getpgid(@pid))
|
|
114
|
+
debug 'Process waitall'
|
|
115
|
+
Process.waitall
|
|
116
|
+
end
|
|
117
|
+
|
|
108
118
|
def pid_state
|
|
109
119
|
if Gem.win_platform?
|
|
110
120
|
match = `tasklist /FI "PID eq #{@pid}" /FO "LIST" /V`.match(/Status:\s+(\w+)/)
|
|
@@ -123,13 +133,13 @@ class Filewatcher
|
|
|
123
133
|
def pid_ready?
|
|
124
134
|
ps = pid_state
|
|
125
135
|
|
|
126
|
-
return if ps.nil?
|
|
136
|
+
return false if ps.nil?
|
|
127
137
|
|
|
128
138
|
ps == (Gem.win_platform? ? 'Running' : 'S')
|
|
129
139
|
end
|
|
130
140
|
|
|
131
|
-
def wait(seconds: 1)
|
|
132
|
-
super
|
|
141
|
+
def wait(seconds: 1, interval: @options[:interval])
|
|
142
|
+
super
|
|
133
143
|
end
|
|
134
144
|
end
|
|
135
145
|
end
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: filewatcher-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Flemming
|
|
8
8
|
- Alexander Popov
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: clamp
|
|
@@ -31,168 +30,14 @@ dependencies:
|
|
|
31
30
|
requirements:
|
|
32
31
|
- - "~>"
|
|
33
32
|
- !ruby/object:Gem::Version
|
|
34
|
-
version: '
|
|
33
|
+
version: '3.0'
|
|
35
34
|
type: :runtime
|
|
36
35
|
prerelease: false
|
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
37
|
requirements:
|
|
39
38
|
- - "~>"
|
|
40
39
|
- !ruby/object:Gem::Version
|
|
41
|
-
version: '
|
|
42
|
-
- !ruby/object:Gem::Dependency
|
|
43
|
-
name: pry-byebug
|
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - "~>"
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '3.9'
|
|
49
|
-
type: :development
|
|
50
|
-
prerelease: false
|
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
-
requirements:
|
|
53
|
-
- - "~>"
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: '3.9'
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
|
-
name: bundler
|
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
|
59
|
-
requirements:
|
|
60
|
-
- - "~>"
|
|
61
|
-
- !ruby/object:Gem::Version
|
|
62
|
-
version: '2.0'
|
|
63
|
-
type: :development
|
|
64
|
-
prerelease: false
|
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
66
|
-
requirements:
|
|
67
|
-
- - "~>"
|
|
68
|
-
- !ruby/object:Gem::Version
|
|
69
|
-
version: '2.0'
|
|
70
|
-
- !ruby/object:Gem::Dependency
|
|
71
|
-
name: bundler-audit
|
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
|
73
|
-
requirements:
|
|
74
|
-
- - "~>"
|
|
75
|
-
- !ruby/object:Gem::Version
|
|
76
|
-
version: 0.9.0
|
|
77
|
-
type: :development
|
|
78
|
-
prerelease: false
|
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
80
|
-
requirements:
|
|
81
|
-
- - "~>"
|
|
82
|
-
- !ruby/object:Gem::Version
|
|
83
|
-
version: 0.9.0
|
|
84
|
-
- !ruby/object:Gem::Dependency
|
|
85
|
-
name: gem_toys
|
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
|
87
|
-
requirements:
|
|
88
|
-
- - "~>"
|
|
89
|
-
- !ruby/object:Gem::Version
|
|
90
|
-
version: 0.12.1
|
|
91
|
-
type: :development
|
|
92
|
-
prerelease: false
|
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
94
|
-
requirements:
|
|
95
|
-
- - "~>"
|
|
96
|
-
- !ruby/object:Gem::Version
|
|
97
|
-
version: 0.12.1
|
|
98
|
-
- !ruby/object:Gem::Dependency
|
|
99
|
-
name: toys
|
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
|
101
|
-
requirements:
|
|
102
|
-
- - "~>"
|
|
103
|
-
- !ruby/object:Gem::Version
|
|
104
|
-
version: 0.13.1
|
|
105
|
-
type: :development
|
|
106
|
-
prerelease: false
|
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
108
|
-
requirements:
|
|
109
|
-
- - "~>"
|
|
110
|
-
- !ruby/object:Gem::Version
|
|
111
|
-
version: 0.13.1
|
|
112
|
-
- !ruby/object:Gem::Dependency
|
|
113
|
-
name: codecov
|
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
|
115
|
-
requirements:
|
|
116
|
-
- - "~>"
|
|
117
|
-
- !ruby/object:Gem::Version
|
|
118
|
-
version: 0.6.0
|
|
119
|
-
type: :development
|
|
120
|
-
prerelease: false
|
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
122
|
-
requirements:
|
|
123
|
-
- - "~>"
|
|
124
|
-
- !ruby/object:Gem::Version
|
|
125
|
-
version: 0.6.0
|
|
126
|
-
- !ruby/object:Gem::Dependency
|
|
127
|
-
name: rspec
|
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
|
129
|
-
requirements:
|
|
130
|
-
- - "~>"
|
|
131
|
-
- !ruby/object:Gem::Version
|
|
132
|
-
version: '3.9'
|
|
133
|
-
type: :development
|
|
134
|
-
prerelease: false
|
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
136
|
-
requirements:
|
|
137
|
-
- - "~>"
|
|
138
|
-
- !ruby/object:Gem::Version
|
|
139
|
-
version: '3.9'
|
|
140
|
-
- !ruby/object:Gem::Dependency
|
|
141
|
-
name: simplecov
|
|
142
|
-
requirement: !ruby/object:Gem::Requirement
|
|
143
|
-
requirements:
|
|
144
|
-
- - "~>"
|
|
145
|
-
- !ruby/object:Gem::Version
|
|
146
|
-
version: 0.21.2
|
|
147
|
-
type: :development
|
|
148
|
-
prerelease: false
|
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
150
|
-
requirements:
|
|
151
|
-
- - "~>"
|
|
152
|
-
- !ruby/object:Gem::Version
|
|
153
|
-
version: 0.21.2
|
|
154
|
-
- !ruby/object:Gem::Dependency
|
|
155
|
-
name: rubocop
|
|
156
|
-
requirement: !ruby/object:Gem::Requirement
|
|
157
|
-
requirements:
|
|
158
|
-
- - "~>"
|
|
159
|
-
- !ruby/object:Gem::Version
|
|
160
|
-
version: 1.36.0
|
|
161
|
-
type: :development
|
|
162
|
-
prerelease: false
|
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
164
|
-
requirements:
|
|
165
|
-
- - "~>"
|
|
166
|
-
- !ruby/object:Gem::Version
|
|
167
|
-
version: 1.36.0
|
|
168
|
-
- !ruby/object:Gem::Dependency
|
|
169
|
-
name: rubocop-performance
|
|
170
|
-
requirement: !ruby/object:Gem::Requirement
|
|
171
|
-
requirements:
|
|
172
|
-
- - "~>"
|
|
173
|
-
- !ruby/object:Gem::Version
|
|
174
|
-
version: '1.0'
|
|
175
|
-
type: :development
|
|
176
|
-
prerelease: false
|
|
177
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
178
|
-
requirements:
|
|
179
|
-
- - "~>"
|
|
180
|
-
- !ruby/object:Gem::Version
|
|
181
|
-
version: '1.0'
|
|
182
|
-
- !ruby/object:Gem::Dependency
|
|
183
|
-
name: rubocop-rspec
|
|
184
|
-
requirement: !ruby/object:Gem::Requirement
|
|
185
|
-
requirements:
|
|
186
|
-
- - "~>"
|
|
187
|
-
- !ruby/object:Gem::Version
|
|
188
|
-
version: '2.0'
|
|
189
|
-
type: :development
|
|
190
|
-
prerelease: false
|
|
191
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
192
|
-
requirements:
|
|
193
|
-
- - "~>"
|
|
194
|
-
- !ruby/object:Gem::Version
|
|
195
|
-
version: '2.0'
|
|
40
|
+
version: '3.0'
|
|
196
41
|
description: 'CLI for Filewatcher.
|
|
197
42
|
|
|
198
43
|
'
|
|
@@ -228,7 +73,6 @@ metadata:
|
|
|
228
73
|
homepage_uri: https://github.com/filewatcher/filewatcher-cli
|
|
229
74
|
changelog_uri: https://github.com/filewatcher/filewatcher-cli/blob/main/CHANGELOG.md
|
|
230
75
|
rubygems_mfa_required: 'true'
|
|
231
|
-
post_install_message:
|
|
232
76
|
rdoc_options: []
|
|
233
77
|
require_paths:
|
|
234
78
|
- lib
|
|
@@ -236,18 +80,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
236
80
|
requirements:
|
|
237
81
|
- - ">="
|
|
238
82
|
- !ruby/object:Gem::Version
|
|
239
|
-
version: '2
|
|
83
|
+
version: '3.2'
|
|
240
84
|
- - "<"
|
|
241
85
|
- !ruby/object:Gem::Version
|
|
242
|
-
version: '
|
|
86
|
+
version: '5'
|
|
243
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
88
|
requirements:
|
|
245
89
|
- - ">="
|
|
246
90
|
- !ruby/object:Gem::Version
|
|
247
91
|
version: '0'
|
|
248
92
|
requirements: []
|
|
249
|
-
rubygems_version:
|
|
250
|
-
signing_key:
|
|
93
|
+
rubygems_version: 4.0.3
|
|
251
94
|
specification_version: 4
|
|
252
95
|
summary: CLI for Filewatcher
|
|
253
96
|
test_files: []
|