build-files 1.5.0 → 1.6.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: bac2cd858df21c3b358f48693991fd36df73c9de282fd8a90db7c251439ca71f
4
- data.tar.gz: 4565f56f66245d4789006cca0754eaeff449c982d8d150ec2fd347a15eb8e7c6
3
+ metadata.gz: b77938366786dd5d7f79073be6f1315a32c0660a5e3d7979614c4f0f79a67ebc
4
+ data.tar.gz: 0f475f88831d52d006e77fc9a9edb291cfee7e6692450d4d450e5fba2b58057b
5
5
  SHA512:
6
- metadata.gz: c8af23bc2f29a5cfa0404c61e854ae5b321e9a27394b9bfdeddba3cfa1402251c32d3c315c31fb6101bbc2d324a8cdb33d6775526675598b8101cbd207cf53f3
7
- data.tar.gz: 757a7f5a4277dcdde6107e2216b1fcfe73728722cc2711ff52f805c91572aa2aa661b40ff9459774c8a97b57d25c0773d47726e208644fa5e82b5f43f9c412c4
6
+ metadata.gz: 57e65db4d252786a52573129c305e82a98833ed89adcb06e50c88c36cf8f504d66de8cae63d0f656fb6e770742f87e344805c701d734bba305a68a4380f84590
7
+ data.tar.gz: dd50577d7386bd2ce60158e1321bc25dd5fea5d3e80fc26b5ede43f0c2e1faceac4b55ec98eb40b9791a6d1037726bc6c2bd44b63441368011ca10a154283241
@@ -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
+
@@ -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 "rake"
27
+ spec.add_development_dependency "bake-bundler"
28
28
  end
@@ -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(:each) unless block_given?
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
@@ -55,13 +55,13 @@ module Build
55
55
  other.any?{|path| include?(path)}
56
56
  end
57
57
 
58
- def with(**args)
59
- return to_enum(:with, **args) unless block_given?
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(args)
63
+ self.each do |path|
64
+ updated_path = path.with(**options)
65
65
 
66
66
  yield path, updated_path
67
67
 
@@ -173,12 +173,12 @@ module Build
173
173
  self.new(File.join(root, relative_path), root)
174
174
  end
175
175
 
176
- # Expand a subpath within a given root, similar to `File.expand_path`
177
- def self.expand(subpath, root = Dir.getwd)
178
- if subpath.start_with? File::SEPARATOR
179
- self.new(subpath)
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, subpath)
181
+ self.join(root, path)
182
182
  end
183
183
  end
184
184
 
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Build
22
22
  module Files
23
- VERSION = "1.5.0"
23
+ VERSION = "1.6.0"
24
24
  end
25
25
  end
@@ -20,30 +20,34 @@
20
20
 
21
21
  require 'build/files/glob'
22
22
 
23
- module Build::Files::GlobSpec
24
- include Build::Files
23
+ RSpec.describe Build::Files::Glob do
24
+ let(:path) {Build::Files::Path.new(__dir__)}
25
25
 
26
- describe Build::Files::Glob do
27
- let(:path) {Path.new(__dir__)}
26
+ it "can glob paths" do
27
+ paths = path.glob("*.rb")
28
28
 
29
- it "can glob paths" do
30
- paths = path.glob("*.rb")
31
-
32
- expect(paths.count).to be >= 1
33
- end
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
- it "can be used as key in hash" do
36
- cache = {}
37
-
38
- cache[path.glob("*.rb")] = true
39
-
40
- expect(cache).to be_include(path.glob("*.rb"))
41
- end
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
- it "should print nice string represenation" do
44
- glob = Build::Files::Glob.new(".", "*.rb")
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("#{glob}").to be == '<Glob "."/"*.rb">'
50
+ expect(paths.count).to be == 1
47
51
  end
48
52
  end
49
53
  end
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.5.0
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: 2019-09-25 00:00:00.000000000 Z
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: rake
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.0.4
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
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec