build-files 1.5.0 → 1.6.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/.gitignore +24 -0
- data/build-files.gemspec +1 -1
- data/lib/build/files/glob.rb +9 -6
- data/lib/build/files/list.rb +4 -4
- data/lib/build/files/path.rb +5 -5
- data/lib/build/files/version.rb +1 -1
- data/spec/build/files/glob_spec.rb +23 -19
- data/spec/build/files/glob_spec/dotfiles/.file +0 -0
- metadata +7 -5
- data/Rakefile +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b77938366786dd5d7f79073be6f1315a32c0660a5e3d7979614c4f0f79a67ebc
|
4
|
+
data.tar.gz: 0f475f88831d52d006e77fc9a9edb291cfee7e6692450d4d450e5fba2b58057b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57e65db4d252786a52573129c305e82a98833ed89adcb06e50c88c36cf8f504d66de8cae63d0f656fb6e770742f87e344805c701d734bba305a68a4380f84590
|
7
|
+
data.tar.gz: dd50577d7386bd2ce60158e1321bc25dd5fea5d3e80fc26b5ede43f0c2e1faceac4b55ec98eb40b9791a6d1037726bc6c2bd44b63441368011ca10a154283241
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
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/build-files.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "covered"
|
25
25
|
spec.add_development_dependency "bundler"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.4"
|
27
|
-
spec.add_development_dependency "
|
27
|
+
spec.add_development_dependency "bake-bundler"
|
28
28
|
end
|
data/lib/build/files/glob.rb
CHANGED
@@ -44,12 +44,15 @@ module Build
|
|
44
44
|
def full_pattern
|
45
45
|
Path.join(@root, @pattern)
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
# Enumerate all paths matching the pattern.
|
49
49
|
def each(&block)
|
50
|
-
return to_enum
|
50
|
+
return to_enum unless block_given?
|
51
51
|
|
52
|
-
Dir.glob(full_pattern) do |path|
|
52
|
+
::Dir.glob(full_pattern, ::File::FNM_DOTMATCH) do |path|
|
53
|
+
# Ignore `.` and `..` entries.
|
54
|
+
next if path =~ /\/..?$/
|
55
|
+
|
53
56
|
yield Path.new(path, @root)
|
54
57
|
end
|
55
58
|
end
|
@@ -57,15 +60,15 @@ module Build
|
|
57
60
|
def eql?(other)
|
58
61
|
self.class.eql?(other.class) and @root.eql?(other.root) and @pattern.eql?(other.pattern)
|
59
62
|
end
|
60
|
-
|
63
|
+
|
61
64
|
def hash
|
62
65
|
[@root, @pattern].hash
|
63
66
|
end
|
64
|
-
|
67
|
+
|
65
68
|
def include?(path)
|
66
69
|
File.fnmatch(full_pattern, path)
|
67
70
|
end
|
68
|
-
|
71
|
+
|
69
72
|
def rebase(root)
|
70
73
|
self.class.new(root, @pattern)
|
71
74
|
end
|
data/lib/build/files/list.rb
CHANGED
@@ -55,13 +55,13 @@ module Build
|
|
55
55
|
other.any?{|path| include?(path)}
|
56
56
|
end
|
57
57
|
|
58
|
-
def with(**
|
59
|
-
return to_enum(:with, **
|
58
|
+
def with(**options)
|
59
|
+
return to_enum(:with, **options) unless block_given?
|
60
60
|
|
61
61
|
paths = []
|
62
62
|
|
63
|
-
each do |path|
|
64
|
-
updated_path = path.with(
|
63
|
+
self.each do |path|
|
64
|
+
updated_path = path.with(**options)
|
65
65
|
|
66
66
|
yield path, updated_path
|
67
67
|
|
data/lib/build/files/path.rb
CHANGED
@@ -173,12 +173,12 @@ module Build
|
|
173
173
|
self.new(File.join(root, relative_path), root)
|
174
174
|
end
|
175
175
|
|
176
|
-
# Expand a
|
177
|
-
def self.expand(
|
178
|
-
if
|
179
|
-
self.new(
|
176
|
+
# Expand a path within a given root.
|
177
|
+
def self.expand(path, root = Dir.getwd)
|
178
|
+
if path.start_with?(File::SEPARATOR)
|
179
|
+
self.new(path)
|
180
180
|
else
|
181
|
-
self.join(root,
|
181
|
+
self.join(root, path)
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
data/lib/build/files/version.rb
CHANGED
@@ -20,30 +20,34 @@
|
|
20
20
|
|
21
21
|
require 'build/files/glob'
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
RSpec.describe Build::Files::Glob do
|
24
|
+
let(:path) {Build::Files::Path.new(__dir__)}
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
it "can glob paths" do
|
27
|
+
paths = path.glob("*.rb")
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
expect(paths.count).to be >= 1
|
30
|
+
end
|
31
|
+
|
32
|
+
it "can be used as key in hash" do
|
33
|
+
cache = {}
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
cache[path.glob("*.rb")] = true
|
36
|
+
|
37
|
+
expect(cache).to be_include(path.glob("*.rb"))
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should print nice string represenation" do
|
41
|
+
glob = Build::Files::Glob.new(".", "*.rb")
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
expect("#{glob}").to be == '<Glob "."/"*.rb">'
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with dotfiles' do
|
47
|
+
it "should list files starting with dot" do
|
48
|
+
paths = path.glob("glob_spec/dotfiles/**/*")
|
45
49
|
|
46
|
-
expect(
|
50
|
+
expect(paths.count).to be == 1
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rb-inotify
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: bake-bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -101,11 +101,11 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".gitignore"
|
104
105
|
- ".rspec"
|
105
106
|
- ".travis.yml"
|
106
107
|
- Gemfile
|
107
108
|
- README.md
|
108
|
-
- Rakefile
|
109
109
|
- build-files.gemspec
|
110
110
|
- lib/build/files.rb
|
111
111
|
- lib/build/files/composite.rb
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- spec/build/files/directory_spec/.dot_file.yaml
|
128
128
|
- spec/build/files/directory_spec/normal_file.txt
|
129
129
|
- spec/build/files/glob_spec.rb
|
130
|
+
- spec/build/files/glob_spec/dotfiles/.file
|
130
131
|
- spec/build/files/list_spec.rb
|
131
132
|
- spec/build/files/monitor_spec.rb
|
132
133
|
- spec/build/files/path_spec.rb
|
@@ -152,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
153
|
- !ruby/object:Gem::Version
|
153
154
|
version: '0'
|
154
155
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.1.2
|
156
157
|
signing_key:
|
157
158
|
specification_version: 4
|
158
159
|
summary: Build::Files is a set of idiomatic classes for dealing with paths and monitoring
|
@@ -162,6 +163,7 @@ test_files:
|
|
162
163
|
- spec/build/files/directory_spec/.dot_file.yaml
|
163
164
|
- spec/build/files/directory_spec/normal_file.txt
|
164
165
|
- spec/build/files/glob_spec.rb
|
166
|
+
- spec/build/files/glob_spec/dotfiles/.file
|
165
167
|
- spec/build/files/list_spec.rb
|
166
168
|
- spec/build/files/monitor_spec.rb
|
167
169
|
- spec/build/files/path_spec.rb
|