build-files 1.6.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/build/files/path.rb +29 -0
- data/lib/build/files/state.rb +23 -23
- data/lib/build/files/version.rb +1 -1
- data/lib/build/files.rb +0 -3
- data.tar.gz.sig +0 -0
- metadata +43 -91
- metadata.gz.sig +0 -0
- data/.gitignore +0 -24
- data/.rspec +0 -4
- data/.travis.yml +0 -14
- data/Gemfile +0 -9
- data/README.md +0 -69
- data/build-files.gemspec +0 -28
- data/lib/build/files/handle.rb +0 -59
- data/lib/build/files/monitor/fsevent.rb +0 -55
- data/lib/build/files/monitor/inotify.rb +0 -53
- data/lib/build/files/monitor/polling.rb +0 -145
- data/lib/build/files/monitor.rb +0 -43
- data/spec/build/files/directory_spec/.dot_file.yaml +0 -0
- data/spec/build/files/directory_spec/normal_file.txt +0 -0
- data/spec/build/files/directory_spec.rb +0 -80
- data/spec/build/files/glob_spec/dotfiles/.file +0 -0
- data/spec/build/files/glob_spec.rb +0 -53
- data/spec/build/files/list_spec.rb +0 -182
- data/spec/build/files/monitor_spec.rb +0 -90
- data/spec/build/files/path_spec.rb +0 -211
- data/spec/build/files/state_spec.rb +0 -90
- data/spec/build/files/system_spec.rb +0 -56
- data/spec/spec_helper.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8757dffaa2ddfd7e5a42a77867a14cf5cb01f8e79e1e46e5b55734514ceb2254
|
4
|
+
data.tar.gz: 9fab471ba8d3cffcb82740cebc3a3d7f3ffacb7d5a1c907c437a9169462a99d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13e96cf884aa6304c39b3998731e417c376c6348064b4376dcbea2459dc6abd4d85fbe63d2f0b4a708af0b15320830c1e46c0a1a132b99a4df098a7adf10df5e
|
7
|
+
data.tar.gz: 57ca75187a0486d16b5b70b8a5441864f671d2ee4399726782237646fc3fde1a28f2e90e9ea62858c23d491f1282bf4fe579a8489d9d39d642d5c2924cdd761a
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/build/files/path.rb
CHANGED
@@ -22,6 +22,10 @@ module Build
|
|
22
22
|
module Files
|
23
23
|
# Represents a file path with an absolute root and a relative offset:
|
24
24
|
class Path
|
25
|
+
def self.current
|
26
|
+
self.new(::Dir.pwd)
|
27
|
+
end
|
28
|
+
|
25
29
|
def self.split(path)
|
26
30
|
# Effectively dirname and basename:
|
27
31
|
dirname, separator, filename = path.rpartition(File::SEPARATOR)
|
@@ -44,6 +48,14 @@ module Build
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
51
|
+
def self.root(path)
|
52
|
+
if Path === path
|
53
|
+
path.root
|
54
|
+
else
|
55
|
+
File.dirname(path)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
47
59
|
# Return the shortest relative path to get to path from root. Root should be a directory with which you are computing the relative path.
|
48
60
|
def self.shortest_path(path, root)
|
49
61
|
path_components = Path.components(path)
|
@@ -98,6 +110,8 @@ module Build
|
|
98
110
|
@full_path.length
|
99
111
|
end
|
100
112
|
|
113
|
+
alias size length
|
114
|
+
|
101
115
|
def components
|
102
116
|
@components ||= @full_path.split(File::SEPARATOR).freeze
|
103
117
|
end
|
@@ -106,6 +120,21 @@ module Build
|
|
106
120
|
self.parts.last
|
107
121
|
end
|
108
122
|
|
123
|
+
def parent
|
124
|
+
root = @root
|
125
|
+
full_path = File.dirname(@full_path)
|
126
|
+
|
127
|
+
while root.size > full_path.size
|
128
|
+
root = Path.root(root)
|
129
|
+
end
|
130
|
+
|
131
|
+
if root.size == full_path.size
|
132
|
+
root = Path.root(root)
|
133
|
+
end
|
134
|
+
|
135
|
+
self.class.new(full_path, root)
|
136
|
+
end
|
137
|
+
|
109
138
|
def start_with?(*args)
|
110
139
|
@full_path.start_with?(*args)
|
111
140
|
end
|
data/lib/build/files/state.rb
CHANGED
@@ -18,37 +18,37 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
-
|
21
|
+
require 'build/files/list'
|
22
22
|
|
23
23
|
require 'forwardable'
|
24
24
|
|
25
25
|
module Build
|
26
26
|
module Files
|
27
|
-
# Represents a specific file on disk with a specific mtime.
|
28
|
-
class FileTime
|
29
|
-
include Comparable
|
30
|
-
|
31
|
-
def initialize(path, time)
|
32
|
-
@path = path
|
33
|
-
@time = time
|
34
|
-
end
|
35
|
-
|
36
|
-
attr :path
|
37
|
-
attr :time
|
38
|
-
|
39
|
-
def <=> other
|
40
|
-
@time <=> other.time
|
41
|
-
end
|
42
|
-
|
43
|
-
def inspect
|
44
|
-
"<FileTime #{@path.inspect} #{@time.inspect}>"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
27
|
# A stateful list of files captured at a specific time, which can then be checked for changes.
|
49
|
-
class State <
|
28
|
+
class State < List
|
50
29
|
extend Forwardable
|
51
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
52
|
def initialize(files)
|
53
53
|
raise ArgumentError.new("Invalid files list: #{files}") unless Files::List === files
|
54
54
|
|
data/lib/build/files/version.rb
CHANGED
data/lib/build/files.rb
CHANGED
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
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:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rb-fsevent
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: covered
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: covered
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -80,65 +80,29 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.4'
|
83
|
-
|
84
|
-
name: bake-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
|
-
description:
|
83
|
+
description:
|
98
84
|
email:
|
99
|
-
- samuel.williams@oriontransfer.co.nz
|
100
85
|
executables: []
|
101
86
|
extensions: []
|
102
87
|
extra_rdoc_files: []
|
103
88
|
files:
|
104
|
-
- ".gitignore"
|
105
|
-
- ".rspec"
|
106
|
-
- ".travis.yml"
|
107
|
-
- Gemfile
|
108
|
-
- README.md
|
109
|
-
- build-files.gemspec
|
110
89
|
- lib/build/files.rb
|
111
90
|
- lib/build/files/composite.rb
|
112
91
|
- lib/build/files/difference.rb
|
113
92
|
- lib/build/files/directory.rb
|
114
93
|
- lib/build/files/glob.rb
|
115
|
-
- lib/build/files/handle.rb
|
116
94
|
- lib/build/files/list.rb
|
117
|
-
- lib/build/files/monitor.rb
|
118
|
-
- lib/build/files/monitor/fsevent.rb
|
119
|
-
- lib/build/files/monitor/inotify.rb
|
120
|
-
- lib/build/files/monitor/polling.rb
|
121
95
|
- lib/build/files/path.rb
|
122
96
|
- lib/build/files/paths.rb
|
123
97
|
- lib/build/files/state.rb
|
124
98
|
- lib/build/files/system.rb
|
125
99
|
- lib/build/files/version.rb
|
126
|
-
|
127
|
-
- spec/build/files/directory_spec/.dot_file.yaml
|
128
|
-
- spec/build/files/directory_spec/normal_file.txt
|
129
|
-
- spec/build/files/glob_spec.rb
|
130
|
-
- spec/build/files/glob_spec/dotfiles/.file
|
131
|
-
- spec/build/files/list_spec.rb
|
132
|
-
- spec/build/files/monitor_spec.rb
|
133
|
-
- spec/build/files/path_spec.rb
|
134
|
-
- spec/build/files/state_spec.rb
|
135
|
-
- spec/build/files/system_spec.rb
|
136
|
-
- spec/spec_helper.rb
|
137
|
-
homepage: ''
|
100
|
+
homepage: https://github.com/ioquatix/build-files
|
138
101
|
licenses:
|
139
102
|
- MIT
|
140
|
-
metadata:
|
141
|
-
|
103
|
+
metadata:
|
104
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
105
|
+
post_install_message:
|
142
106
|
rdoc_options: []
|
143
107
|
require_paths:
|
144
108
|
- lib
|
@@ -153,20 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
117
|
- !ruby/object:Gem::Version
|
154
118
|
version: '0'
|
155
119
|
requirements: []
|
156
|
-
rubygems_version: 3.1.
|
157
|
-
signing_key:
|
120
|
+
rubygems_version: 3.1.6
|
121
|
+
signing_key:
|
158
122
|
specification_version: 4
|
159
|
-
summary:
|
160
|
-
|
161
|
-
test_files:
|
162
|
-
- spec/build/files/directory_spec.rb
|
163
|
-
- spec/build/files/directory_spec/.dot_file.yaml
|
164
|
-
- spec/build/files/directory_spec/normal_file.txt
|
165
|
-
- spec/build/files/glob_spec.rb
|
166
|
-
- spec/build/files/glob_spec/dotfiles/.file
|
167
|
-
- spec/build/files/list_spec.rb
|
168
|
-
- spec/build/files/monitor_spec.rb
|
169
|
-
- spec/build/files/path_spec.rb
|
170
|
-
- spec/build/files/state_spec.rb
|
171
|
-
- spec/build/files/system_spec.rb
|
172
|
-
- spec/spec_helper.rb
|
123
|
+
summary: Abstractions for handling and mapping paths.
|
124
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|
data/.gitignore
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
*.bundle
|
19
|
-
*.so
|
20
|
-
*.o
|
21
|
-
*.a
|
22
|
-
mkmf.log
|
23
|
-
.rspec_status
|
24
|
-
|
data/.rspec
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
# Build::Files
|
2
|
-
|
3
|
-
Build::Files is a set of idiomatic classes for dealing with paths and monitoring directories. File paths are represented with both root and relative parts which makes copying directory structures intuitive.
|
4
|
-
|
5
|
-
[![Build Status](https://secure.travis-ci.org/ioquatix/build-files.svg)](http://travis-ci.org/ioquatix/build-files)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/ioquatix/build-files.svg)](https://codeclimate.com/github/ioquatix/build-files)
|
7
|
-
[![Coverage Status](https://coveralls.io/repos/ioquatix/build-files/badge.svg)](https://coveralls.io/r/ioquatix/build-files)
|
8
|
-
|
9
|
-
## Installation
|
10
|
-
|
11
|
-
Add this line to your application's Gemfile:
|
12
|
-
|
13
|
-
gem 'build-files'
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install build-files
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
The basic structure is the `Path`. Paths are stored with a root and relative part. By default, if no root is specified, it is the `dirname` part.
|
26
|
-
|
27
|
-
require 'build/files'
|
28
|
-
|
29
|
-
path = Build::Files::Path("/foo/bar/baz")
|
30
|
-
=> "/foo/bar"/"baz"
|
31
|
-
|
32
|
-
> path.root
|
33
|
-
=> "/foo/bar"
|
34
|
-
> path.relative_path
|
35
|
-
=> "baz"
|
36
|
-
|
37
|
-
Paths can be coerced to strings and thus are suitable arguments to `exec`/`system` functions.
|
38
|
-
|
39
|
-
## Contributing
|
40
|
-
|
41
|
-
1. Fork it
|
42
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
43
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
44
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
45
|
-
5. Create new Pull Request
|
46
|
-
|
47
|
-
## License
|
48
|
-
|
49
|
-
Released under the MIT license.
|
50
|
-
|
51
|
-
Copyright, 2014, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
52
|
-
|
53
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
54
|
-
of this software and associated documentation files (the "Software"), to deal
|
55
|
-
in the Software without restriction, including without limitation the rights
|
56
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
57
|
-
copies of the Software, and to permit persons to whom the Software is
|
58
|
-
furnished to do so, subject to the following conditions:
|
59
|
-
|
60
|
-
The above copyright notice and this permission notice shall be included in
|
61
|
-
all copies or substantial portions of the Software.
|
62
|
-
|
63
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
64
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
65
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
66
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
67
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
68
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
69
|
-
THE SOFTWARE.
|
data/build-files.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/build/files/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "build-files"
|
6
|
-
spec.version = Build::Files::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
# spec.description = %q{}
|
10
|
-
spec.summary = %q{Build::Files is a set of idiomatic classes for dealing with paths and monitoring directories.}
|
11
|
-
spec.homepage = ""
|
12
|
-
spec.license = "MIT"
|
13
|
-
|
14
|
-
spec.files = `git ls-files`.split($/)
|
15
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
|
-
spec.require_paths = ["lib"]
|
18
|
-
|
19
|
-
spec.required_ruby_version = '>= 2.0'
|
20
|
-
|
21
|
-
spec.add_dependency "rb-inotify"
|
22
|
-
spec.add_dependency "rb-fsevent"
|
23
|
-
|
24
|
-
spec.add_development_dependency "covered"
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "rspec", "~> 3.4"
|
27
|
-
spec.add_development_dependency "bake-bundler"
|
28
|
-
end
|
data/lib/build/files/handle.rb
DELETED
@@ -1,59 +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 'state'
|
22
|
-
|
23
|
-
module Build
|
24
|
-
module Files
|
25
|
-
class Handle
|
26
|
-
def initialize(monitor, files, &block)
|
27
|
-
@monitor = monitor
|
28
|
-
@state = State.new(files)
|
29
|
-
@block = block
|
30
|
-
end
|
31
|
-
|
32
|
-
attr :monitor
|
33
|
-
|
34
|
-
def commit!
|
35
|
-
@state.update!
|
36
|
-
end
|
37
|
-
|
38
|
-
def directories
|
39
|
-
@state.files.roots
|
40
|
-
end
|
41
|
-
|
42
|
-
def remove!
|
43
|
-
@monitor.delete(self)
|
44
|
-
end
|
45
|
-
|
46
|
-
# Inform the handle that it might have been modified.
|
47
|
-
def changed!
|
48
|
-
# If @state.update! did not find any changes, don't invoke the callback:
|
49
|
-
if @state.update!
|
50
|
-
@block.call(@state)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def to_s
|
55
|
-
"\#<#{self.class} @state=#{@state} @block=#{@block}>"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -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
|