recls-ruby 2.13.1 → 2.13.4

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.
@@ -13,115 +13,6 @@ end
13
13
  require 'test/unit'
14
14
 
15
15
 
16
- class Test_combine_paths < Test::Unit::TestCase
17
-
18
- def test_nil_nil
19
-
20
- if RUBY_VERSION >= '2'
21
-
22
- assert_raise_with_message(::ArgumentError, /must specify one or more path elements/) { Recls.combine_paths(nil, nil) }
23
- else
24
-
25
- assert_raise(::ArgumentError) { Recls.combine_paths(nil, nil) }
26
- end
27
- end
28
-
29
- def test_origin_nil
30
-
31
- strings = [
32
-
33
- 'abc',
34
- 'abc/def',
35
- 'abc/def/ghi.ext',
36
- ]
37
-
38
- strings.each do |s|
39
-
40
- assert_equal s, Recls.combine_paths(nil, s)
41
- end
42
- end
43
-
44
- def test_path_nil
45
-
46
- strings = [
47
-
48
- 'abc',
49
- 'abc/def',
50
- 'abc/def/ghi.ext',
51
- ]
52
-
53
- strings.each do |s|
54
-
55
- assert_equal s, Recls.combine_paths(s, nil)
56
- end
57
- end
58
-
59
- def test_both_relative
60
-
61
- assert_equal 'abc/def', Recls.combine_paths('abc', 'def')
62
- assert_equal 'abc/def', Recls.combine_paths('abc/', 'def')
63
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def', 'ghi')
64
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def/', 'ghi')
65
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc', 'def/ghi')
66
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/', 'def/ghi')
67
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi')
68
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi')
69
-
70
- if RUBY_VERSION >= '2'
71
-
72
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: false)
73
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: false)
74
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: true)
75
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: true)
76
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./.', 'def/ghi', clean_path: true)
77
- assert_equal 'abc/../def/ghi', Recls.combine_paths('abc/..', 'def/ghi')
78
- assert_equal 'def/ghi', Recls.combine_paths('abc/..', 'def/ghi', clean_path: true)
79
- end
80
- end
81
-
82
- def test_multiple_relative
83
-
84
- if RUBY_VERSION >= '2'
85
-
86
- assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: false)
87
- assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: true)
88
-
89
- assert_equal 'a/b/c/../d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g', clean: false)
90
- assert_equal 'a/b/d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', clean: true)
91
- assert_equal 'a/b/d/e/f/g/', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', canonicalise: true)
92
- end
93
- end
94
-
95
- def test_various_absolute_placings
96
-
97
- assert_equal '/a/b/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', 'f/g')
98
-
99
- assert_equal '/b/c/d/e/f/g', Recls.combine_paths('/', 'a', '/b', 'c', 'd/e', 'f/g')
100
-
101
- assert_equal '/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', '/c', 'd/e', 'f/g')
102
-
103
- assert_equal '/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', '/d/e', 'f/g')
104
-
105
- assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g')
106
- assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/')
107
-
108
- if RUBY_VERSION >= '2'
109
-
110
- assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', clean: true)
111
- assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', canonicalise: true)
112
- end
113
- end
114
-
115
- def test_combining_with_entries
116
-
117
- f_g = Recls.stat('/f/g', Recls::DETAILS_LATER)
118
- b = Recls.stat('b', Recls::DETAILS_LATER)
119
-
120
- assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', f_g)
121
- assert_equal '/f/g', Recls.combine_paths('/', 'a', b, 'c', 'd/e', f_g)
122
- end
123
- end
124
-
125
16
  class Test_canonicalise_path < Test::Unit::TestCase
126
17
 
127
18
  def test_nil
@@ -0,0 +1,157 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../../..', 'lib')
4
+
5
+ require 'recls'
6
+
7
+ require 'xqsr3/extensions/test/unit'
8
+ require 'test/unit'
9
+
10
+ require 'fileutils'
11
+
12
+
13
+ class Test_combine_paths < Test::Unit::TestCase
14
+
15
+ def test_nil_nil
16
+
17
+ if RUBY_VERSION >= '2'
18
+
19
+ assert_raise_with_message(::ArgumentError, /must specify one or more path elements/) { Recls.combine_paths(nil, nil) }
20
+ else
21
+
22
+ assert_raise(::ArgumentError) { Recls.combine_paths(nil, nil) }
23
+ end
24
+ end
25
+
26
+ def test_origin_nil
27
+
28
+ strings = [
29
+
30
+ 'abc',
31
+ 'abc/def',
32
+ 'abc/def/ghi.ext',
33
+ ]
34
+
35
+ strings.each do |s|
36
+
37
+ assert_equal s, Recls.combine_paths(nil, s)
38
+ end
39
+ end
40
+
41
+ def test_path_nil
42
+
43
+ strings = [
44
+
45
+ 'abc',
46
+ 'abc/def',
47
+ 'abc/def/ghi.ext',
48
+ ]
49
+
50
+ strings.each do |s|
51
+
52
+ assert_equal s, Recls.combine_paths(s, nil)
53
+ end
54
+ end
55
+
56
+ def test_both_relative
57
+
58
+ assert_equal 'abc/def', Recls.combine_paths('abc', 'def')
59
+ assert_equal 'abc/def', Recls.combine_paths('abc/', 'def')
60
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def', 'ghi')
61
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def/', 'ghi')
62
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc', 'def/ghi')
63
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/', 'def/ghi')
64
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi')
65
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi')
66
+
67
+ if RUBY_VERSION >= '2'
68
+
69
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: false)
70
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: false)
71
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: true)
72
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: true)
73
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./.', 'def/ghi', clean_path: true)
74
+ assert_equal 'abc/../def/ghi', Recls.combine_paths('abc/..', 'def/ghi')
75
+ assert_equal 'def/ghi', Recls.combine_paths('abc/..', 'def/ghi', clean_path: true)
76
+ end
77
+ end
78
+
79
+ def test_multiple_relative
80
+
81
+ if RUBY_VERSION >= '2'
82
+
83
+ assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: false)
84
+ assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: true)
85
+
86
+ assert_equal 'a/b/c/../d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g', clean: false)
87
+ assert_equal 'a/b/d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', clean: true)
88
+ assert_equal 'a/b/d/e/f/g/', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', canonicalise: true)
89
+ end
90
+ end
91
+
92
+ def test_various_absolute_placings
93
+
94
+ assert_equal '/a/b/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', 'f/g')
95
+
96
+ assert_equal '/b/c/d/e/f/g', Recls.combine_paths('/', 'a', '/b', 'c', 'd/e', 'f/g')
97
+
98
+ assert_equal '/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', '/c', 'd/e', 'f/g')
99
+
100
+ assert_equal '/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', '/d/e', 'f/g')
101
+
102
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g')
103
+ assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/')
104
+
105
+ if RUBY_VERSION >= '2'
106
+
107
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', clean: true)
108
+ assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', canonicalise: true)
109
+ end
110
+ end
111
+
112
+ def test_combining_with_entries
113
+
114
+ f_g = Recls.stat('/f/g', Recls::DETAILS_LATER | Recls::DIRECTORIES)
115
+ b = Recls.stat('b', Recls::DETAILS_LATER | Recls::DIRECTORIES)
116
+
117
+ assert_equal '/a/b/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', 'f/g')
118
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g')
119
+
120
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', f_g)
121
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', b, 'c', 'd/e', f_g)
122
+ end
123
+
124
+ def test_combining_with_entries_that_exist
125
+
126
+ fe_this_file = Recls.stat(__FILE__)
127
+ fe_this_dir = Recls.stat(File.dirname(__FILE__))
128
+
129
+ assert_true fe_this_file.file?
130
+ assert_false fe_this_file.directory?
131
+
132
+ assert_true fe_this_dir.directory?
133
+ assert_false fe_this_dir.file?
134
+
135
+ assert_equal fe_this_file.to_s, Recls.combine_paths(fe_this_file)
136
+ assert_equal fe_this_file.to_s, Recls.combine_paths(nil, fe_this_file)
137
+ assert_equal fe_this_file.to_s, Recls.combine_paths('abc', fe_this_file)
138
+ assert_equal fe_this_file.to_s, Recls.combine_paths(fe_this_file)
139
+ assert_equal fe_this_file.to_s, Recls.combine_paths(fe_this_file, nil)
140
+ assert_equal fe_this_file.to_s, Recls.combine_paths(fe_this_file, '')
141
+ assert_equal fe_this_file.to_s, Recls.combine_paths(fe_this_file, 'abc')
142
+ assert_equal fe_this_file.to_s, Recls.combine_paths('abc', fe_this_file, 'abc')
143
+
144
+ assert_equal fe_this_dir.to_s, Recls.combine_paths(fe_this_dir)
145
+ assert_equal fe_this_dir.to_s, Recls.combine_paths(nil, fe_this_dir)
146
+ assert_equal fe_this_dir.to_s, Recls.combine_paths('abc', fe_this_dir)
147
+ assert_equal fe_this_dir.to_s, Recls.combine_paths(fe_this_dir)
148
+ assert_equal fe_this_dir.to_s, Recls.combine_paths(fe_this_dir, nil)
149
+ assert_equal "#{fe_this_dir.to_s}/", Recls.combine_paths(fe_this_dir, '')
150
+ assert_equal "#{fe_this_dir.to_s}/abc", Recls.combine_paths(fe_this_dir, 'abc')
151
+ assert_equal "#{fe_this_dir.to_s}/abc", Recls.combine_paths('abc', fe_this_dir, 'abc')
152
+ end
153
+ end
154
+
155
+
156
+ # ############################## end of file ############################# #
157
+
@@ -0,0 +1,22 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # executes all other tests
4
+
5
+ this_dir = File.expand_path(File.dirname(__FILE__))
6
+
7
+ # all tc_*rb in current directory
8
+ Dir[File.join(this_dir, 'tc_*rb')].each do |file|
9
+
10
+ $stderr.puts "requiring file '#{file}'" if $DEBUG
11
+
12
+ require file
13
+ end
14
+
15
+ # all ts_*rb in immediate sub-directories
16
+ Dir[File.join(this_dir, '*', 'ts_*rb')].each do |file|
17
+
18
+ $stderr.puts "requiring file '#{file}'" if $DEBUG
19
+
20
+ require file
21
+ end
22
+
metadata CHANGED
@@ -1,40 +1,62 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recls-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.1
4
+ version: 2.13.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-02 00:00:00.000000000 Z
11
+ date: 2026-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xqsr3
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.31'
19
+ version: 0.39.5
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '1.0'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.39.5
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '0.31'
27
- description: 'RECursive LS for Ruby
28
-
29
- '
30
- email: matthew@synesis.com.au
32
+ version: '1.0'
33
+ description: |
34
+ recls.Ruby is a platform-independent recursive file-system search library
35
+ for Ruby. It enumerates files and directories (recursively or not),
36
+ optionally filtered by wildcards and type flags, and returns each hit as a
37
+ rich entry object with path components, type, size, and timestamps
38
+ (including Windows-specific attributes where they exist). Path-combination
39
+ and existence helpers are included so client code can stay on one API.
40
+ The name stands for rec-ursive ls; this gem is the Ruby implementation of
41
+ the recls family (also available for C/C++, Go, .NET, Python, and Rust).
42
+ email:
43
+ - matthew@synesis.com.au
31
44
  executables: []
32
45
  extensions: []
33
46
  extra_rdoc_files: []
34
47
  files:
48
+ - AUTHORS.md
49
+ - CHANGES.md
50
+ - CONTRIBUTING.md
51
+ - EXAMPLES.md
52
+ - FAQ.md
53
+ - INSTALL.md
35
54
  - LICENSE
55
+ - NEWS.md
36
56
  - README.md
37
57
  - Rakefile
58
+ - SECURITY.md
59
+ - TODO.md
38
60
  - examples/find_files_and_directories.md
39
61
  - examples/find_files_and_directories.rb
40
62
  - examples/find_files_and_directories.recursive.md
@@ -79,11 +101,17 @@ files:
79
101
  - test/unit/test_all_separately.cmd
80
102
  - test/unit/test_all_separately.sh
81
103
  - test/unit/ts_all.rb
82
- homepage: http://github.com/synesissoftware/recls.Ruby
104
+ - test/unit/util/tc_combine_paths.rb
105
+ - test/unit/util/ts_all.rb
106
+ homepage: https://github.com/synesissoftware/recls.Ruby
83
107
  licenses:
84
108
  - BSD-3-Clause
85
- metadata: {}
86
- post_install_message:
109
+ metadata:
110
+ bug_tracker_uri: https://github.com/synesissoftware/recls.Ruby/issues
111
+ changelog_uri: https://github.com/synesissoftware/recls.Ruby/blob/master/CHANGES.md
112
+ homepage_uri: https://github.com/synesissoftware/recls.Ruby
113
+ source_code_uri: https://github.com/synesissoftware/recls.Ruby
114
+ post_install_message:
87
115
  rdoc_options: []
88
116
  require_paths:
89
117
  - lib
@@ -98,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
126
  - !ruby/object:Gem::Version
99
127
  version: '0'
100
128
  requirements: []
101
- rubygems_version: 3.3.7
102
- signing_key:
129
+ rubygems_version: 3.1.6
130
+ signing_key:
103
131
  specification_version: 4
104
- summary: recls.Ruby
132
+ summary: The platform-independent recursive file-system search library, for Ruby
105
133
  test_files: []