build-files-monitor 0.2.1 → 0.4.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/lib/build/files/monitor/handle.rb +26 -24
- data/lib/build/files/monitor/native.rb +54 -0
- data/lib/build/files/monitor/polling.rb +38 -26
- data/lib/build/files/monitor/version.rb +3 -20
- data/lib/build/files/monitor.rb +16 -35
- data/license.md +21 -0
- data/readme.md +55 -0
- data/releases.md +23 -0
- data.tar.gz.sig +0 -0
- metadata +40 -96
- metadata.gz.sig +0 -0
- data/lib/build/files/monitor/fsevent.rb +0 -55
- data/lib/build/files/monitor/inotify.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 435b84b61738b4e31fed992817a7580797c30f2099e1d3e4188e3ce535f92cf0
|
4
|
+
data.tar.gz: ea1f935718b7982f5469a2609603527758b5287f0869058f98d6ba6451fff82b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5efe0b08fd6565f8a9e4b8a6f63839f226b76412854e24b5b65361ce1dc40ae06c63a4da9cdb4fe3fa3bdfdd9378a2de37e78730ff4b20eb095fdddfa5b0343
|
7
|
+
data.tar.gz: 9f628a544ac79fad1d0d908e8f9253c4180ec3cfd54d539fb319f53c297d0d5a626978cde1373df708b96f71fa8ce42e539413f9f4e11c0f12579fe01c7ff201
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,45 +1,46 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
20
2
|
|
21
|
-
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
|
+
|
6
|
+
require "build/files/state"
|
22
7
|
|
23
8
|
module Build
|
24
9
|
module Files
|
25
10
|
module Monitor
|
11
|
+
# Represents a tracked set of files with an associated callback.
|
12
|
+
#
|
13
|
+
# A handle is created when you call {Polling#track_changes} and connects a set of files to a callback block that fires when changes are detected. The handle maintains the state of monitored files and can be removed from the monitor when no longer needed.
|
26
14
|
class Handle
|
15
|
+
# Initialize a new handle.
|
16
|
+
#
|
17
|
+
# @parameter monitor [Polling] The monitor that owns this handle.
|
18
|
+
# @parameter files [List] The list of files to track.
|
19
|
+
# @parameter block [Proc] The callback to invoke when changes are detected.
|
27
20
|
def initialize(monitor, files, &block)
|
28
21
|
@monitor = monitor
|
29
22
|
@state = State.new(files)
|
30
23
|
@block = block
|
31
24
|
end
|
32
|
-
|
25
|
+
|
26
|
+
# @attribute [Polling] The monitor that owns this handle.
|
33
27
|
attr :monitor
|
34
|
-
|
28
|
+
|
29
|
+
# Update the internal state of tracked files.
|
30
|
+
#
|
31
|
+
# This method forces an update of the file state without invoking the callback.
|
35
32
|
def commit!
|
36
33
|
@state.update!
|
37
34
|
end
|
38
|
-
|
35
|
+
|
36
|
+
# @returns [Array(Path)] The root directories being monitored by this handle.
|
39
37
|
def directories
|
40
38
|
@state.files.roots
|
41
39
|
end
|
42
|
-
|
40
|
+
|
41
|
+
# Remove this handle from the monitor.
|
42
|
+
#
|
43
|
+
# After calling this method, the callback will no longer be invoked when changes are detected.
|
43
44
|
def remove!
|
44
45
|
@monitor.delete(self)
|
45
46
|
end
|
@@ -52,6 +53,7 @@ module Build
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
56
|
+
# @returns [String] A string representation of the handle.
|
55
57
|
def to_s
|
56
58
|
"\#<#{self.class} @state=#{@state} @block=#{@block}>"
|
57
59
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "polling"
|
7
|
+
require "io/watch"
|
8
|
+
|
9
|
+
module Build
|
10
|
+
module Files
|
11
|
+
module Monitor
|
12
|
+
# A platform-specific filesystem monitor using native OS APIs.
|
13
|
+
#
|
14
|
+
# This implementation uses platform-specific APIs (FSEvent on macOS, INotify on Linux) for efficient, event-driven file monitoring. It extends {Polling} but replaces the polling mechanism with native filesystem events.
|
15
|
+
class Native < Polling
|
16
|
+
# Run the monitor using native filesystem events.
|
17
|
+
#
|
18
|
+
# This method blocks until interrupted via `throw :interrupt`. Unlike {Polling#run}, this uses native OS events rather than polling.
|
19
|
+
#
|
20
|
+
# @yields After each filesystem event.
|
21
|
+
def run(**options, &block)
|
22
|
+
catch(:interrupt) do
|
23
|
+
while true
|
24
|
+
run_roots(self.roots, **options, &block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Monitor the specified roots for changes using native events.
|
30
|
+
#
|
31
|
+
# @parameter roots [Array(String)] The root directories to monitor.
|
32
|
+
# @yields {...} After each filesystem event.
|
33
|
+
# @returns [Boolean] True if the set of monitored directories was updated.
|
34
|
+
def run_roots(roots, **options, &block)
|
35
|
+
monitor = IO::Watch::Monitor.new(self.roots, **options)
|
36
|
+
|
37
|
+
monitor.run do |event|
|
38
|
+
if root = event[:root]
|
39
|
+
self.update([root])
|
40
|
+
|
41
|
+
yield if block_given?
|
42
|
+
|
43
|
+
if self.updated
|
44
|
+
return true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
return false
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,32 +1,23 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
20
2
|
|
21
|
-
|
22
|
-
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
23
5
|
|
24
|
-
|
6
|
+
require "set"
|
7
|
+
require "logger"
|
8
|
+
|
9
|
+
require_relative "handle"
|
25
10
|
|
26
11
|
module Build
|
27
12
|
module Files
|
28
13
|
module Monitor
|
14
|
+
# A cross-platform filesystem monitor that uses polling to detect changes.
|
15
|
+
#
|
16
|
+
# This implementation works on all platforms by periodically checking file modification times. While less efficient than platform-specific native implementations, it provides a reliable fallback for platforms without native filesystem event support.
|
29
17
|
class Polling
|
18
|
+
# Initialize a new polling monitor.
|
19
|
+
#
|
20
|
+
# @parameter logger [Logger] Optional logger for debugging monitor activity.
|
30
21
|
def initialize(logger: nil)
|
31
22
|
@directories = Hash.new do |hash, key|
|
32
23
|
hash[key] = Set.new
|
@@ -39,6 +30,7 @@ module Build
|
|
39
30
|
@logger = logger || Logger.new(nil)
|
40
31
|
end
|
41
32
|
|
33
|
+
# @attribute [Boolean] Whether the set of monitored directories has been updated.
|
42
34
|
attr :updated
|
43
35
|
|
44
36
|
# Notify the monitor that files in these directories have changed.
|
@@ -59,10 +51,14 @@ module Build
|
|
59
51
|
end
|
60
52
|
end
|
61
53
|
|
54
|
+
# @returns [Array(String)] The root directories currently being monitored.
|
62
55
|
def roots
|
63
56
|
@directories.keys
|
64
57
|
end
|
65
58
|
|
59
|
+
# Delete a handle from the monitor.
|
60
|
+
#
|
61
|
+
# @parameter handle [Handle] The handle to remove.
|
66
62
|
def delete(handle)
|
67
63
|
if @deletions
|
68
64
|
@logger.debug{"Delayed delete handle: #{handle}"}
|
@@ -72,12 +68,22 @@ module Build
|
|
72
68
|
end
|
73
69
|
end
|
74
70
|
|
71
|
+
# Track changes to a set of files.
|
72
|
+
#
|
73
|
+
# @parameter files [List] The list of files to monitor.
|
74
|
+
# @yields {|state| ...} When changes are detected.
|
75
|
+
# @parameter state [State] The current state with information about added, changed, and removed files.
|
76
|
+
# @returns [Handle] A handle that can be used to stop tracking these files.
|
75
77
|
def track_changes(files, &block)
|
76
78
|
handle = Handle.new(self, files, &block)
|
77
79
|
|
78
80
|
add(handle)
|
79
81
|
end
|
80
82
|
|
83
|
+
# Add a handle to the monitor.
|
84
|
+
#
|
85
|
+
# @parameter handle [Handle] The handle to add.
|
86
|
+
# @returns [Handle] The added handle.
|
81
87
|
def add(handle)
|
82
88
|
@logger.debug{"Adding handle: #{handle}"}
|
83
89
|
|
@@ -97,14 +103,20 @@ module Build
|
|
97
103
|
handle
|
98
104
|
end
|
99
105
|
|
100
|
-
|
106
|
+
# Run the monitor loop, checking for changes at regular intervals.
|
107
|
+
#
|
108
|
+
# This method blocks until interrupted via `throw :interrupt`. It continuously polls the filesystem for changes and invokes registered callbacks.
|
109
|
+
#
|
110
|
+
# @parameter latency [Numeric] The time in seconds to wait between checks (default: 0.1).
|
111
|
+
# @yields After each check cycle.
|
112
|
+
def run(latency: 0.1, **options, &block)
|
101
113
|
catch(:interrupt) do
|
102
114
|
while true
|
103
|
-
|
115
|
+
self.update(self.roots)
|
104
116
|
|
105
|
-
yield
|
117
|
+
yield if block_given?
|
106
118
|
|
107
|
-
sleep(
|
119
|
+
sleep(latency)
|
108
120
|
end
|
109
121
|
end
|
110
122
|
end
|
@@ -1,29 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2024, by Samuel Williams.
|
22
5
|
|
23
6
|
module Build
|
24
7
|
module Files
|
25
8
|
module Monitor
|
26
|
-
VERSION = "0.
|
9
|
+
VERSION = "0.4.0"
|
27
10
|
end
|
28
11
|
end
|
29
12
|
end
|
data/lib/build/files/monitor.rb
CHANGED
@@ -1,43 +1,24 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
20
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "monitor/native"
|
7
|
+
|
8
|
+
# @namespace
|
21
9
|
module Build
|
10
|
+
# @namespace
|
22
11
|
module Files
|
12
|
+
# @namespace
|
23
13
|
module Monitor
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
when /darwin/i
|
30
|
-
require_relative 'monitor/fsevent'
|
31
|
-
Native = FSEvent
|
32
|
-
Default = Native
|
33
|
-
else
|
34
|
-
require_relative 'monitor/polling'
|
35
|
-
Default = Polling
|
36
|
-
end
|
37
|
-
|
14
|
+
# Create a new monitor instance.
|
15
|
+
#
|
16
|
+
# This factory method creates a monitor that uses platform-specific native filesystem event APIs (FSEvent on macOS, INotify on Linux, etc.) via the `io-watch` gem for efficient, event-driven file monitoring.
|
17
|
+
#
|
18
|
+
# @returns [Native] A new native monitor instance.
|
38
19
|
def self.new(*arguments, **options)
|
39
|
-
|
20
|
+
Native.new(*arguments, **options)
|
40
21
|
end
|
41
22
|
end
|
42
23
|
end
|
43
|
-
end
|
24
|
+
end
|
data/license.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2021-2025, by Samuel Williams.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Build::Files::Monitor
|
2
|
+
|
3
|
+
Efficiently monitor the filesystem for changes.
|
4
|
+
|
5
|
+
[](https://github.com/ioquatix/build-files-monitor/actions?workflow=Test)
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
Please see the [project documentation](https://ioquatix.github.io/build-files-monitor/) for more details.
|
10
|
+
|
11
|
+
- [Getting Started](https://ioquatix.github.io/build-files-monitor/guides/getting-started/index) - This guide explains how to use `build-files-monitor` to efficiently monitor the filesystem for changes.
|
12
|
+
|
13
|
+
## Releases
|
14
|
+
|
15
|
+
Please see the [project releases](https://ioquatix.github.io/build-files-monitor/releases/index) for all releases.
|
16
|
+
|
17
|
+
### v0.4.0
|
18
|
+
|
19
|
+
- Use `io-watch` for filesystem monitoring.
|
20
|
+
|
21
|
+
### v0.3.0
|
22
|
+
|
23
|
+
- Internal refactoring.
|
24
|
+
|
25
|
+
### v0.2.1
|
26
|
+
|
27
|
+
- Fixed compatibility of keyword arguments in `Monitor.new` to properly forward both positional and keyword arguments.
|
28
|
+
|
29
|
+
### v0.2.0
|
30
|
+
|
31
|
+
- Moved `State` class to `build-files` gem. Users should now `require 'build/files/state'` instead of `require 'build/files/monitor/state'`.
|
32
|
+
|
33
|
+
### v0.1.0
|
34
|
+
|
35
|
+
- Initial release.
|
36
|
+
- Support for filesystem monitoring with platform-specific implementations (`Build::Files::Monitor::Native` using FSEvent/INotify).
|
37
|
+
- Fallback polling implementation (`Build::Files::Monitor::Polling`).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
We welcome contributions to this project.
|
42
|
+
|
43
|
+
1. Fork it.
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
47
|
+
5. Create new Pull Request.
|
48
|
+
|
49
|
+
### Developer Certificate of Origin
|
50
|
+
|
51
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
52
|
+
|
53
|
+
### Community Guidelines
|
54
|
+
|
55
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data/releases.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Releases
|
2
|
+
|
3
|
+
## v0.4.0
|
4
|
+
|
5
|
+
- Use `io-watch` for filesystem monitoring.
|
6
|
+
|
7
|
+
## v0.3.0
|
8
|
+
|
9
|
+
- Internal refactoring.
|
10
|
+
|
11
|
+
## v0.2.1
|
12
|
+
|
13
|
+
- Fixed compatibility of keyword arguments in `Monitor.new` to properly forward both positional and keyword arguments.
|
14
|
+
|
15
|
+
## v0.2.0
|
16
|
+
|
17
|
+
- Moved `State` class to `build-files` gem. Users should now `require 'build/files/state'` instead of `require 'build/files/monitor/state'`.
|
18
|
+
|
19
|
+
## v0.1.0
|
20
|
+
|
21
|
+
- Initial release.
|
22
|
+
- Support for filesystem monitoring with platform-specific implementations (`Build::Files::Monitor::Native` using FSEvent/INotify).
|
23
|
+
- Fallback polling implementation (`Build::Files::Monitor::Polling`).
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-files-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain:
|
11
10
|
- |
|
12
11
|
-----BEGIN CERTIFICATE-----
|
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
|
-
|
12
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
13
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
14
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
15
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
16
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
17
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
18
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
19
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
20
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
21
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
22
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
23
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
24
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
25
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
26
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
27
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
28
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
29
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
30
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
31
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
32
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
33
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
34
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
35
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
36
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
37
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: build-files
|
@@ -53,93 +53,38 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rb-inotify
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: bundler
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: covered
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec
|
56
|
+
name: io-watch
|
113
57
|
requirement: !ruby/object:Gem::Requirement
|
114
58
|
requirements:
|
115
59
|
- - "~>"
|
116
60
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
118
|
-
type: :
|
61
|
+
version: '0.2'
|
62
|
+
type: :runtime
|
119
63
|
prerelease: false
|
120
64
|
version_requirements: !ruby/object:Gem::Requirement
|
121
65
|
requirements:
|
122
66
|
- - "~>"
|
123
67
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
125
|
-
description:
|
126
|
-
email:
|
68
|
+
version: '0.2'
|
127
69
|
executables: []
|
128
70
|
extensions: []
|
129
71
|
extra_rdoc_files: []
|
130
72
|
files:
|
131
73
|
- lib/build/files/monitor.rb
|
132
|
-
- lib/build/files/monitor/fsevent.rb
|
133
74
|
- lib/build/files/monitor/handle.rb
|
134
|
-
- lib/build/files/monitor/
|
75
|
+
- lib/build/files/monitor/native.rb
|
135
76
|
- lib/build/files/monitor/polling.rb
|
136
77
|
- lib/build/files/monitor/version.rb
|
78
|
+
- license.md
|
79
|
+
- readme.md
|
80
|
+
- releases.md
|
137
81
|
homepage: https://github.com/ioquatix/build-files-monitor
|
138
82
|
licenses:
|
139
83
|
- MIT
|
140
84
|
metadata:
|
85
|
+
documentation_uri: https://ioquatix.github.io/build-files-monitor/
|
141
86
|
funding_uri: https://github.com/sponsors/ioquatix/
|
142
|
-
|
87
|
+
source_code_uri: https://github.com/ioquatix/build-files-monitor.git
|
143
88
|
rdoc_options: []
|
144
89
|
require_paths:
|
145
90
|
- lib
|
@@ -147,15 +92,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
92
|
requirements:
|
148
93
|
- - ">="
|
149
94
|
- !ruby/object:Gem::Version
|
150
|
-
version: 2
|
95
|
+
version: '3.2'
|
151
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
97
|
requirements:
|
153
98
|
- - ">="
|
154
99
|
- !ruby/object:Gem::Version
|
155
100
|
version: '0'
|
156
101
|
requirements: []
|
157
|
-
rubygems_version: 3.
|
158
|
-
signing_key:
|
102
|
+
rubygems_version: 3.6.9
|
159
103
|
specification_version: 4
|
160
104
|
summary: Efficiently monitor changes to the file system.
|
161
105
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# Copyright, 2014, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
20
|
-
|
21
|
-
require_relative 'polling'
|
22
|
-
|
23
|
-
require 'rb-fsevent'
|
24
|
-
|
25
|
-
module Build
|
26
|
-
module Files
|
27
|
-
module Monitor
|
28
|
-
class FSEvent < Polling
|
29
|
-
def run(**options, &block)
|
30
|
-
notifier = ::FSEvent.new
|
31
|
-
|
32
|
-
catch(:interrupt) do
|
33
|
-
while true
|
34
|
-
notifier.watch self.roots do |directories|
|
35
|
-
directories.collect! do |directory|
|
36
|
-
File.expand_path(directory)
|
37
|
-
end
|
38
|
-
|
39
|
-
self.update(directories)
|
40
|
-
|
41
|
-
yield
|
42
|
-
|
43
|
-
if self.updated
|
44
|
-
notifier.stop
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
notifier.run
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# Copyright, 2014, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
20
|
-
|
21
|
-
require_relative 'polling'
|
22
|
-
|
23
|
-
require 'rb-inotify'
|
24
|
-
|
25
|
-
module Build
|
26
|
-
module Files
|
27
|
-
module Monitor
|
28
|
-
class INotify < Polling
|
29
|
-
def run(**options, &block)
|
30
|
-
notifier = ::INotify::Notifier.new
|
31
|
-
|
32
|
-
catch(:interrupt) do
|
33
|
-
while true
|
34
|
-
self.roots.each do |root|
|
35
|
-
notifier.watch root, :create, :modify, :attrib, :delete do |event|
|
36
|
-
self.update([root])
|
37
|
-
|
38
|
-
yield
|
39
|
-
|
40
|
-
if self.updated
|
41
|
-
notifier.stop
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
notifier.run
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|