Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'jruby', 'truffleruby']
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'jruby', 'truffleruby']
platform: ['ubuntu-latest', 'windows-latest', 'macos-latest']
exclude:
- ruby-version: truffleruby
Expand Down
6 changes: 6 additions & 0 deletions file-find.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ Gem::Specification.new do |spec|
}

spec.add_dependency('sys-admin', '~> 1.7')

if Gem.win_platform?
spec.add_dependency('win32ole')
spec.add_dependency('win32-registry') # Until sys-admin gets updated properly
end

spec.add_development_dependency('rspec', '~> 3.9')
spec.add_development_dependency('fakefs', '~> 3.0')
spec.add_development_dependency('rake')
Expand Down
5 changes: 1 addition & 4 deletions lib/file/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,7 @@ def find
until queue.empty?
path = queue.shift
begin
Dir.foreach(path) do |file|
next if file == '.'
next if file == '..'

Dir.children(path).each do |file|
if prune_regex && prune_regex.match(file)
next
end
Expand Down
10 changes: 0 additions & 10 deletions spec/file_find_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,16 @@
end

example 'find with maxdepth 2 returns expected results' do
pending if windows
rule.maxdepth = 2
expect(rule.find.map{ |e| File.basename(e) }).to eq(['a.foo'])
end

example 'find with maxdepth 3 returns expected results' do
pending if windows
rule.maxdepth = 3
expect(rule.find.map{ |e| File.basename(e) }).to contain_exactly('a.foo', 'b.foo', 'c.foo')
end

example 'find with nil maxdepth option returns everything' do
pending if windows
rule.maxdepth = nil
results = ['a.foo', 'b.foo', 'c.foo', 'd.foo', 'e.foo', 'f.foo']
expect(rule.find.map{ |e| File.basename(e) }).to match_array(results)
Expand All @@ -367,7 +364,6 @@
end

example 'find with maxdepth 3 returns expected results for directories' do
pending if windows
rule.pattern = 'a3'
rule.maxdepth = 3
expect(rule.find.map{ |e| File.basename(e) }).to eq(['a3'])
Expand Down Expand Up @@ -399,35 +395,30 @@
end

example 'find with mindepth option returns expected results at depth 0' do
pending if windows
rule.mindepth = 0
array = ['a.min', 'b.min', 'c.min', 'd.min', 'e.min', 'f.min', 'z.min']
expect(rule.find.map{ |e| File.basename(e) }).to match_array(array)
end

example 'find with mindepth option returns expected results at depth 1' do
pending if windows
rule.mindepth = 1
array = ['a.min', 'b.min', 'c.min', 'd.min', 'e.min', 'f.min', 'z.min']
expect(rule.find.map{ |e| File.basename(e) }).to match_array(array)
end

example 'find with mindepth option returns expected results at depth 2' do
pending if windows
rule.mindepth = 2
array = ['a.min', 'b.min', 'c.min', 'd.min', 'e.min', 'f.min']
expect(rule.find.map{ |e| File.basename(e) }).to match_array(array)
end

example 'find with mindepth option returns expected results at depth 3' do
pending if windows
rule.mindepth = 3
array = ['b.min', 'c.min', 'd.min', 'e.min', 'f.min']
expect(rule.find.map{ |e| File.basename(e) }).to match_array(array)
end

example 'find with mindepth option returns expected results at depth 4' do
pending if windows
rule.mindepth = 4
array = ['d.min', 'e.min', 'f.min']
expect(rule.find.map{ |e| File.basename(e) }).to match_array(array)
Expand Down Expand Up @@ -583,7 +574,6 @@
end

example 'user method works with string as expected' do
pending if windows # TODO: Get this working on Windows
skip 'user example skipped on Mac in CI' if macos && ENV['CI']

skip if windows && elevated
Expand Down