build-files 1.7.1 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 777a262af38e7bd84dc924b8e140d8d4e00077fab74b35d6f6ee555063809981
4
- data.tar.gz: 981cbf1c9ff4234e9ef7e220de1362ecbcad2d61ae50d77ec072d19586471028
3
+ metadata.gz: 8757dffaa2ddfd7e5a42a77867a14cf5cb01f8e79e1e46e5b55734514ceb2254
4
+ data.tar.gz: 9fab471ba8d3cffcb82740cebc3a3d7f3ffacb7d5a1c907c437a9169462a99d6
5
5
  SHA512:
6
- metadata.gz: 85211d1effb626dd6d7664a3eaa15ab1f96b456ea49588dcd231c231fb47bbe545e4ea1aacfd7971c523b1674d418f47f4b1c86aa0b472dbb7c4f98c7e6e2587
7
- data.tar.gz: a3f499ce331105afe331dbc912a41a532d9478dae92be32da1362dc082133533f6e4b42305e22a7b5a32959093a74a753d30b47b6b3cf361cc8fb3438cef81fd
6
+ metadata.gz: 13e96cf884aa6304c39b3998731e417c376c6348064b4376dcbea2459dc6abd4d85fbe63d2f0b4a708af0b15320830c1e46c0a1a132b99a4df098a7adf10df5e
7
+ data.tar.gz: 57ca75187a0486d16b5b70b8a5441864f671d2ee4399726782237646fc3fde1a28f2e90e9ea62858c23d491f1282bf4fe579a8489d9d39d642d5c2924cdd761a
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,172 @@
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
+ # A stateful list of files captured at a specific time, which can then be checked for changes.
28
+ class State < List
29
+ extend Forwardable
30
+
31
+ # Represents a specific file on disk with a specific mtime.
32
+ class FileTime
33
+ include Comparable
34
+
35
+ def initialize(path, time)
36
+ @path = path
37
+ @time = time
38
+ end
39
+
40
+ attr :path
41
+ attr :time
42
+
43
+ def <=> other
44
+ @time <=> other.time
45
+ end
46
+
47
+ def inspect
48
+ "<FileTime #{@path.inspect} #{@time.inspect}>"
49
+ end
50
+ end
51
+
52
+ def initialize(files)
53
+ raise ArgumentError.new("Invalid files list: #{files}") unless Files::List === files
54
+
55
+ @files = files
56
+
57
+ @times = {}
58
+
59
+ update!
60
+ end
61
+
62
+ attr :files
63
+
64
+ attr :added
65
+ attr :removed
66
+ attr :changed
67
+ attr :missing
68
+
69
+ attr :times
70
+
71
+ def_delegators :@files, :each, :roots, :count
72
+
73
+ def update!
74
+ last_times = @times
75
+ @times = {}
76
+
77
+ @added = []
78
+ @removed = []
79
+ @changed = []
80
+ @missing = []
81
+
82
+ file_times = []
83
+
84
+ @files.each do |path|
85
+ # 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.
86
+ next if @times.include? path
87
+
88
+ if File.exist?(path)
89
+ modified_time = File.mtime(path)
90
+
91
+ if last_time = last_times.delete(path)
92
+ # Path was valid last update:
93
+ if modified_time != last_time
94
+ @changed << path
95
+
96
+ # puts "Changed: #{path}"
97
+ end
98
+ else
99
+ # Path didn't exist before:
100
+ @added << path
101
+
102
+ # puts "Added: #{path}"
103
+ end
104
+
105
+ @times[path] = modified_time
106
+
107
+ unless File.directory?(path)
108
+ file_times << FileTime.new(path, modified_time)
109
+ end
110
+ else
111
+ @missing << path
112
+
113
+ # puts "Missing: #{path}"
114
+ end
115
+ end
116
+
117
+ @removed = last_times.keys
118
+ # puts "Removed: #{@removed.inspect}" if @removed.size > 0
119
+
120
+ @oldest_time = file_times.min
121
+ @newest_time = file_times.max
122
+
123
+ return @added.size > 0 || @changed.size > 0 || @removed.size > 0 || @missing.size > 0
124
+ end
125
+
126
+ attr :oldest_time
127
+ attr :newest_time
128
+
129
+ def missing?
130
+ !@missing.empty?
131
+ end
132
+
133
+ def empty?
134
+ @times.empty?
135
+ end
136
+
137
+ def inspect
138
+ "<State Added:#{@added} Removed:#{@removed} Changed:#{@changed} Missing:#{@missing}>"
139
+ end
140
+
141
+ # Are these (output) files dirty with respect to the given inputs?
142
+ def dirty?(inputs)
143
+ if self.missing?
144
+ return true
145
+ end
146
+
147
+ # If there are no inputs or no outputs, we are always clean:
148
+ if inputs.empty? or self.empty?
149
+ return false
150
+ end
151
+
152
+ oldest_output_time = self.oldest_time
153
+ newest_input_time = inputs.newest_time
154
+
155
+ if newest_input_time and oldest_output_time
156
+ # We are dirty if any inputs are newer (bigger) than any outputs:
157
+ if newest_input_time > oldest_output_time
158
+ return true
159
+ else
160
+ return false
161
+ end
162
+ end
163
+
164
+ return true
165
+ end
166
+
167
+ def self.dirty?(inputs, outputs)
168
+ outputs.dirty?(inputs)
169
+ end
170
+ end
171
+ end
172
+ end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  module Files
23
- VERSION = "1.7.1"
23
+ VERSION = "1.8.0"
24
24
  end
25
25
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-files
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.8.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
42
  name: bundler
@@ -58,9 +86,7 @@ executables: []
58
86
  extensions: []
59
87
  extra_rdoc_files: []
60
88
  files:
61
- - lib/.DS_Store
62
89
  - lib/build/files.rb
63
- - lib/build/files/.DS_Store
64
90
  - lib/build/files/composite.rb
65
91
  - lib/build/files/difference.rb
66
92
  - lib/build/files/directory.rb
@@ -68,12 +94,14 @@ files:
68
94
  - lib/build/files/list.rb
69
95
  - lib/build/files/path.rb
70
96
  - lib/build/files/paths.rb
97
+ - lib/build/files/state.rb
71
98
  - lib/build/files/system.rb
72
99
  - lib/build/files/version.rb
73
- homepage:
100
+ homepage: https://github.com/ioquatix/build-files
74
101
  licenses:
75
102
  - MIT
76
- metadata: {}
103
+ metadata:
104
+ funding_uri: https://github.com/sponsors/ioquatix/
77
105
  post_install_message:
78
106
  rdoc_options: []
79
107
  require_paths:
@@ -89,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
117
  - !ruby/object:Gem::Version
90
118
  version: '0'
91
119
  requirements: []
92
- rubygems_version: 3.2.3
120
+ rubygems_version: 3.1.6
93
121
  signing_key:
94
122
  specification_version: 4
95
123
  summary: Abstractions for handling and mapping paths.
metadata.gz.sig ADDED
Binary file
data/lib/.DS_Store DELETED
Binary file
Binary file