build-files-monitor 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c927ec94d7e43c768d9b72cc2bd22aff95dc233a6c6969731093c110d4ba575f
4
- data.tar.gz: 35416ba5b3908a3c68739071c24abb5bcb6f5ed25ae0c7b2bc18ce8eca697e41
3
+ metadata.gz: 54bfa1b7e3b1033875b99357a95a12c58d829dc3147176195fdc5c5ea1799e37
4
+ data.tar.gz: 5985bde4b932f0e011dee0fedea75cb16f2e10b6d43c157c21a0c13a8c10b53d
5
5
  SHA512:
6
- metadata.gz: 551f9e5d4a55888fb8f12424fa810e9989dc775a825b279b909d4a0e37179dcf345e1ed4113d7fa15730f31b9d018b47cf2cee4cbdf3b01f47f9d8e137b6646d
7
- data.tar.gz: b684c90665fa6e3d97f5aba086215b48941c4443734848a844f97ea809b8696a293454ee698efccb12f0e936fe0f9d41bee58b6418bcb1ed329cb687f10dd708
6
+ metadata.gz: da190122cf2308844c3e44826fb9c3bbe46570d40e6b74b79818e9757746192282f8aa91b55a96ea90c7b794802e4439907225928b68adf14ab23ee53f23f8e2
7
+ data.tar.gz: 5b3d239285cbb89e0464493ea1ce5fa3543573c11e4060a46441c129aebbd5cf0e817e00ddb7dd82b9d37d62b37bdba380e87d0e46808f91797ece10a6ecab67
checksums.yaml.gz.sig ADDED
Binary file
@@ -18,7 +18,7 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require_relative 'state'
21
+ require 'build/files/state'
22
22
 
23
23
  module Build
24
24
  module Files
@@ -23,7 +23,7 @@
23
23
  module Build
24
24
  module Files
25
25
  module Monitor
26
- VERSION = "0.1.0"
26
+ VERSION = "0.2.0"
27
27
  end
28
28
  end
29
29
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,31 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-files-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2021-05-22 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
14
+ ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
15
+ MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
16
+ aWFtcy9EQz1vcmlvbnRyYW5zZmVyL0RDPWNvL0RDPW56MIIBojANBgkqhkiG9w0B
17
+ AQEFAAOCAY8AMIIBigKCAYEAyXLSS/cw+fXJ5e7hi+U/TeChPWeYdwJojDsFY1xr
18
+ xvtqbTTL8gbLHz5LW3QD2nfwCv3qTlw0qI3Ie7a9VMJMbSvgVEGEfQirqIgJXWMj
19
+ eNMDgKsMJtC7u/43abRKx7TCURW3iWyR19NRngsJJmaR51yGGGm2Kfsr+JtKKLtL
20
+ L188Wm3f13KAx7QJU8qyuBnj1/gWem076hzdA7xi1DbrZrch9GCRz62xymJlrJHn
21
+ 9iZEZ7AxrS7vokhMlzSr/XMUihx/8aFKtk+tMLClqxZSmBWIErWdicCGTULXCBNb
22
+ E/mljo4zEVKhlTWpJklMIhr55ZRrSarKFuW7en0+tpJrfsYiAmXMJNi4XAYJH7uL
23
+ rgJuJwSaa/dMz+VmUoo7VKtSfCoOI+6v5/z0sK3oT6sG6ZwyI47DBq2XqNC6tnAj
24
+ w+XmCywiTQrFzMMAvcA7rPI4F0nU1rZId51rOvvfxaONp+wgTi4P8owZLw0/j0m4
25
+ 8C20DYi6EYx4AHDXiLpElWh3AgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8E
26
+ BAMCBLAwHQYDVR0OBBYEFB6ZaeWKxQjGTI+pmz7cKRmMIywwMC4GA1UdEQQnMCWB
27
+ I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWB
28
+ I3NhbXVlbC53aWxsaWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEB
29
+ CwUAA4IBgQBVoM+pu3dpdUhZM1w051iw5GfiqclAr1Psypf16Tiod/ho//4oAu6T
30
+ 9fj3DPX/acWV9P/FScvqo4Qgv6g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
31
+ vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
32
+ x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
33
+ bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
34
+ Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
35
+ y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
36
+ RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
37
+ HiLJ8VOFx6w=
38
+ -----END CERTIFICATE-----
39
+ date: 2022-05-22 00:00:00.000000000 Z
12
40
  dependencies:
13
41
  - !ruby/object:Gem::Dependency
14
- name: rb-fsevent
42
+ name: build-files
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - ">="
45
+ - - "~>"
18
46
  - !ruby/object:Gem::Version
19
- version: '0'
47
+ version: '1.8'
20
48
  type: :runtime
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - ">="
52
+ - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '0'
54
+ version: '1.8'
27
55
  - !ruby/object:Gem::Dependency
28
- name: rb-inotify
56
+ name: rb-fsevent
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - ">="
@@ -39,19 +67,19 @@ dependencies:
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
- name: build-files
70
+ name: rb-inotify
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - "~>"
73
+ - - ">="
46
74
  - !ruby/object:Gem::Version
47
- version: '1.7'
75
+ version: '0'
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - "~>"
80
+ - - ">="
53
81
  - !ruby/object:Gem::Version
54
- version: '1.7'
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: bundler
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -105,7 +133,6 @@ files:
105
133
  - lib/build/files/monitor/handle.rb
106
134
  - lib/build/files/monitor/inotify.rb
107
135
  - lib/build/files/monitor/polling.rb
108
- - lib/build/files/monitor/state.rb
109
136
  - lib/build/files/monitor/version.rb
110
137
  homepage: https://github.com/ioquatix/build-files-monitor
111
138
  licenses:
@@ -127,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
154
  - !ruby/object:Gem::Version
128
155
  version: '0'
129
156
  requirements: []
130
- rubygems_version: 3.2.3
157
+ rubygems_version: 3.1.6
131
158
  signing_key:
132
159
  specification_version: 4
133
160
  summary: Efficiently monitor changes to the file system.
metadata.gz.sig ADDED
Binary file
@@ -1,174 +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 'build/files/list'
22
-
23
- require 'forwardable'
24
-
25
- module Build
26
- module Files
27
- module Monitor
28
- # Represents a specific file on disk with a specific mtime.
29
- class FileTime
30
- include Comparable
31
-
32
- def initialize(path, time)
33
- @path = path
34
- @time = time
35
- end
36
-
37
- attr :path
38
- attr :time
39
-
40
- def <=> other
41
- @time <=> other.time
42
- end
43
-
44
- def inspect
45
- "<FileTime #{@path.inspect} #{@time.inspect}>"
46
- end
47
- end
48
-
49
- # A stateful list of files captured at a specific time, which can then be checked for changes.
50
- class State < List
51
- extend Forwardable
52
-
53
- def initialize(files)
54
- raise ArgumentError.new("Invalid files list: #{files}") unless Files::List === files
55
-
56
- @files = files
57
-
58
- @times = {}
59
-
60
- update!
61
- end
62
-
63
- attr :files
64
-
65
- attr :added
66
- attr :removed
67
- attr :changed
68
- attr :missing
69
-
70
- attr :times
71
-
72
- def_delegators :@files, :each, :roots, :count
73
-
74
- def update!
75
- last_times = @times
76
- @times = {}
77
-
78
- @added = []
79
- @removed = []
80
- @changed = []
81
- @missing = []
82
-
83
- file_times = []
84
-
85
- @files.each do |path|
86
- # When processing the same path twice (perhaps by accident), we should skip it otherwise it might cause issues when being deleted from last_times multuple times.
87
- next if @times.include? path
88
-
89
- if File.exist?(path)
90
- modified_time = File.mtime(path)
91
-
92
- if last_time = last_times.delete(path)
93
- # Path was valid last update:
94
- if modified_time != last_time
95
- @changed << path
96
-
97
- # puts "Changed: #{path}"
98
- end
99
- else
100
- # Path didn't exist before:
101
- @added << path
102
-
103
- # puts "Added: #{path}"
104
- end
105
-
106
- @times[path] = modified_time
107
-
108
- unless File.directory?(path)
109
- file_times << FileTime.new(path, modified_time)
110
- end
111
- else
112
- @missing << path
113
-
114
- # puts "Missing: #{path}"
115
- end
116
- end
117
-
118
- @removed = last_times.keys
119
- # puts "Removed: #{@removed.inspect}" if @removed.size > 0
120
-
121
- @oldest_time = file_times.min
122
- @newest_time = file_times.max
123
-
124
- return @added.size > 0 || @changed.size > 0 || @removed.size > 0 || @missing.size > 0
125
- end
126
-
127
- attr :oldest_time
128
- attr :newest_time
129
-
130
- def missing?
131
- !@missing.empty?
132
- end
133
-
134
- def empty?
135
- @times.empty?
136
- end
137
-
138
- def inspect
139
- "<State Added:#{@added} Removed:#{@removed} Changed:#{@changed} Missing:#{@missing}>"
140
- end
141
-
142
- # Are these (output) files dirty with respect to the given inputs?
143
- def dirty?(inputs)
144
- if self.missing?
145
- return true
146
- end
147
-
148
- # If there are no inputs or no outputs, we are always clean:
149
- if inputs.empty? or self.empty?
150
- return false
151
- end
152
-
153
- oldest_output_time = self.oldest_time
154
- newest_input_time = inputs.newest_time
155
-
156
- if newest_input_time and oldest_output_time
157
- # We are dirty if any inputs are newer (bigger) than any outputs:
158
- if newest_input_time > oldest_output_time
159
- return true
160
- else
161
- return false
162
- end
163
- end
164
-
165
- return true
166
- end
167
-
168
- def self.dirty?(inputs, outputs)
169
- outputs.dirty?(inputs)
170
- end
171
- end
172
- end
173
- end
174
- end