recls-ruby 2.11.0 → 2.11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +27 -24
  3. data/README.md +242 -1
  4. data/examples/find_files_and_directories.md +33 -30
  5. data/examples/find_files_and_directories.recursive.md +255 -254
  6. data/examples/show_hidden_files.md +4 -1
  7. data/examples/show_hidden_files.rb +1 -1
  8. data/examples/show_readonly_files.md +4 -1
  9. data/examples/show_readonly_files.rb +1 -1
  10. data/lib/recls/api.rb +75 -73
  11. data/lib/recls/combine_paths_1.rb +25 -23
  12. data/lib/recls/combine_paths_2plus.rb +31 -29
  13. data/lib/recls/entry.rb +276 -273
  14. data/lib/recls/file_search.rb +195 -193
  15. data/lib/recls/flags.rb +46 -45
  16. data/lib/recls/foreach.rb +103 -98
  17. data/lib/recls/obsolete.rb +80 -79
  18. data/lib/recls/recls.rb +16 -15
  19. data/lib/recls/stat.rb +136 -134
  20. data/lib/recls/util.rb +94 -92
  21. data/lib/recls/version.rb +17 -17
  22. data/lib/recls/ximpl/os.rb +45 -43
  23. data/lib/recls/ximpl/unix.rb +38 -35
  24. data/lib/recls/ximpl/util.rb +597 -596
  25. data/lib/recls/ximpl/windows.rb +139 -136
  26. data/lib/recls.rb +10 -9
  27. data/test/scratch/test_display_parts.rb +33 -33
  28. data/test/scratch/test_entry.rb +6 -6
  29. data/test/scratch/test_files_and_directories.rb +8 -8
  30. data/test/scratch/test_foreach.rb +10 -10
  31. data/test/scratch/test_module_function.rb +33 -33
  32. data/test/scratch/test_pattern_arrays.rb +5 -5
  33. data/test/scratch/test_show_dev_and_ino.rb +1 -1
  34. data/test/scratch/test_show_hidden.rb +3 -3
  35. data/test/unit/tc_recls_entries.rb +31 -31
  36. data/test/unit/tc_recls_entry.rb +19 -19
  37. data/test/unit/tc_recls_file_search.rb +32 -32
  38. data/test/unit/tc_recls_module.rb +25 -25
  39. data/test/unit/tc_recls_util.rb +161 -161
  40. data/test/unit/tc_recls_ximpl_util.rb +676 -676
  41. data/test/unit/test_all_separately.sh +1 -1
  42. data/test/unit/ts_all.rb +4 -4
  43. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a1b0ed5f508ef5e3a29ac1f5de51d5d6cee84ba1
4
- data.tar.gz: 0deb1a1f4551f35cc8c25acba091e30eaa630109
2
+ SHA256:
3
+ metadata.gz: 90f7c6438297fa98748b7667ba1076e5dcde179335b787292fbeaea7f6bd6230
4
+ data.tar.gz: 94e38bcc8b65a233fddd5343907d53c6c529c28757a74c5060d4b7368ebb11ef
5
5
  SHA512:
6
- metadata.gz: 6852f4c312ef0dc49c6d8027df2655217cfe1587ea2cf95b8030f5986b2e1ecfbc84c6a325c565718fffc8161231d3415a3a1c292dfae2744fd986a89fe546e5
7
- data.tar.gz: 9cba60e7075ffb6d3da1ceefc597c54953e23f8fe41d4d5cea4a20840dd9b037c60471d3ddbbf188d9045018cfede80a7d88fd56ba758814814abfae0e26cc1e
6
+ metadata.gz: 2045617c1731af3391ae762f49874bbae4c700c5ce29b8e80e1f819c68f073d52a4848dd9175a306fa79529e2197beab8af700cd09e5bc581b62776c620de276
7
+ data.tar.gz: 96fee22ef3cd615e1d0af3c06902188a727951d1f8bcf18d2072cac341ad97941104721558690fec489bdcc9b18f3efdc8e1818252f7e4dc53966d9599447673
data/LICENSE CHANGED
@@ -1,31 +1,34 @@
1
- recls.Ruby
1
+ recls.Ruby - BSD 3-Clause License
2
+
3
+ Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
4
+ Copyright (c) 2003-2019, Matthew Wilson and Synesis Software
2
5
 
3
- Copyright (c) 2003-2016, Matthew Wilson and Synesis Software
4
6
  All rights reserved.
5
7
 
6
8
  Redistribution and use in source and binary forms, with or without
7
9
  modification, are permitted provided that the following conditions are met:
8
10
 
9
- * Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- * Neither the names of recls or recls.Ruby nor the names of the copyright
17
- holder nor the names of its contributors may be used to endorse or promote
18
- products derived from this software without specific prior written
19
- permission.
20
-
21
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
+ 1. Redistributions of source code must retain the above copyright notice,
12
+ this list of conditions and the following disclaimer.
13
+
14
+ 2. Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+
18
+ 3. Neither the names of recls, recls-Ruby,
19
+ recls.Ruby, nor the name of the copyright holder nor the names of
20
+ its contributors may be used to endorse or promote products derived from
21
+ this software without specific prior written permission.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
+ POSSIBILITY OF SUCH DAMAGE.
31
34
 
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # recls.Ruby
2
+
2
3
  **rec**ursive **ls**, for Ruby
3
4
 
4
5
  [![Gem Version](https://badge.fury.io/rb/recls-ruby.svg)](https://badge.fury.io/rb/recls-ruby)
5
6
 
7
+
6
8
  ## Introduction
7
9
 
8
10
  **recls** stands for **rec**ursive **ls**. The first recls library was a C
9
11
  library with a C++ wrapper. There have been several implementations in other
10
12
  languages. **recls.Ruby** is the Ruby version.
11
13
 
14
+
12
15
  ## Table of Contents
13
16
 
14
17
  1. [Introduction](#introduction)
@@ -17,14 +20,17 @@ languages. **recls.Ruby** is the Ruby version.
17
20
  4. [Examples](#examples)
18
21
  5. [Project Information](#project-information)
19
22
 
23
+
20
24
  ## Introduction
21
25
 
22
26
  T.B.C.
23
27
 
28
+
24
29
  ## Installation & usage
25
30
 
26
31
  Install using `gem install recls-ruby` or add it to your `Gemfile`.
27
32
 
33
+
28
34
  ## Components
29
35
 
30
36
  The main components of **recls.Ruby** are:
@@ -32,36 +38,267 @@ The main components of **recls.Ruby** are:
32
38
  * the ``Recls`` module; and
33
39
  * the ``Recls::Entry`` class
34
40
 
41
+
35
42
  ### The ``Recls`` module
36
43
 
37
44
  T.B.C.
38
45
 
46
+
39
47
  ### The ``Recls::Entry`` class
40
48
 
41
- T.B.C.
49
+ This class represents a file-system entry, and is created either by the `Recls.stat()` method, or is returned from the searches (see above). It has the following (simplified) interface:
50
+
51
+ ```Ruby
52
+ module Recls
53
+
54
+ # A file-system entry
55
+ class Entry
56
+
57
+ # ##########################
58
+ # Name-related attributes
59
+
60
+ # (String) A normalised form of #path that can be used in comparisons
61
+ attr_reader :compare_path
62
+
63
+ # (String) The full-path of the instance
64
+ attr_reader :path
65
+ # (String) The (Windows) short-form of #path, or +nil+ if not on Windows
66
+ attr_reader :short_path
67
+ # (String) The (Windows) drive. +nil+ if does not exist
68
+ attr_reader :drive
69
+ # (String) The full path of the entry's directory (taking into account the
70
+ # #drive if on Windows)
71
+ attr_reader :directory_path
72
+ alias_method :dirname, :directory_path
73
+ # (String) The entry's directory (excluding the #drive if on Windows)
74
+ attr_reader :directory
75
+ # ([String]) An array of directory parts, where each part ends in Recls::PATH_NAME_SEPARATOR
76
+ attr_reader :directory_parts
77
+ # (String) The entry's file name (combination of #stem + #extension)
78
+ attr_reader :file_full_name
79
+ # (String) The (Windows) short-form of #basename, or +nil+ if not on Windows
80
+ attr_reader :file_short_name
81
+ alias_method :basename, :file_full_name
82
+ # (String) The entry's file stem
83
+ attr_reader :file_name_only
84
+ alias_method :stem, :file_name_only
85
+ # (String) The entry's file extension
86
+ attr_reader :file_extension
87
+ alias_method :extension, :file_extension
88
+ # (String) The search directory if specified; +nil+ otherwise
89
+ attr_reader :search_directory
90
+ # (String) The #path relative to #search_directory; +nil+ if no search directory specified
91
+ attr_reader :search_relative_path
92
+ # (String) The #directory relative to #search_directory; +nil+ if no search directory specified
93
+ attr_reader :search_relative_directory
94
+ # (String) The #directory_path relative to #search_directory; +nil+ if no search directory specified
95
+ attr_reader :search_relative_directory_path
96
+ # ([String]) The #directory_parts relative to #search_directory; +nil+ if no search directory specified
97
+ attr_reader :search_relative_directory_parts
98
+
99
+ # ##########################
100
+ # Nature attributes
101
+
102
+ # indicates whether the given entry existed at the time the entry
103
+ # instance was created
104
+ def exist?
105
+ . . .
106
+ end
107
+
108
+ # indicates whether the given entry is hidden
109
+ def hidden?
110
+ . . .
111
+ end
112
+
113
+ # indicates whether the given entry is readonly
114
+ def readonly?
115
+ . . .
116
+ end
117
+
118
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
119
+
120
+ # [WINDOWS-ONLY] Indicates whether the entry has the *system* bit
121
+ def system?
122
+ . . .
123
+ end
124
+
125
+ # [WINDOWS-ONLY] Indicates whether the entry has the *archive* bit
126
+ def archive?
127
+ . . .
128
+ end
129
+
130
+ # [WINDOWS-ONLY] Indicates whether the entry is a device
131
+ def device?
132
+ . . .
133
+ end
134
+
135
+ # [WINDOWS-ONLY] Indicates whether the entry is *normal*
136
+ def normal?
137
+ . . .
138
+ end
139
+
140
+ # [WINDOWS-ONLY] Indicates whether the entry has the *temporary* bit
141
+ def temporary?
142
+ . . .
143
+ end
144
+
145
+ # [WINDOWS-ONLY] Indicates whether the entry has the *compressed* bit
146
+ def compressed?
147
+ . . .
148
+ end
149
+
150
+ # [WINDOWS-ONLY] Indicates whether the entry has the *encrypted* bit
151
+ def encrypted?
152
+ . . .
153
+ end
154
+ end
155
+
156
+ # indicates whether the given entry represents a directory
157
+ def directory?
158
+ . . .
159
+ end
160
+
161
+ alias_method :dir?, :directory?
162
+
163
+ # indicates whether the given entry represents a file
164
+ def file?
165
+ . . .
166
+ end
167
+
168
+ # indicates whether the given entry represents a link
169
+ def link?
170
+ . . .
171
+ end
172
+
173
+ # indicates whether the given entry represents a socket
174
+ def socket?
175
+ . . .
176
+ end
177
+
178
+ # ##########################
179
+ # Size attributes
180
+
181
+ # indicates the size of the given entry
182
+ def size
183
+ . . .
184
+ end
185
+
186
+ # ##########################
187
+ # File-system entry attributes
188
+
189
+ # indicates the device of the given entry
190
+ #
191
+ # On Windows, this will be 0 if the entry cannot be
192
+ # opened
193
+ def dev
194
+ . . .
195
+ end
196
+
197
+ # indicates the ino of the given entry
198
+ #
199
+ # On Windows, this will be 0 if the entry cannot be
200
+ # opened
201
+ def ino
202
+ . . .
203
+ end
204
+
205
+ # number of links to the given entry
206
+ #
207
+ # On Windows, this will be 0 if the entry cannot be
208
+ # opened
209
+ def nlink
210
+ . . .
211
+ end
212
+
213
+ # ##########################
214
+ # Time attributes
215
+
216
+ # indicates the last access time of the entry
217
+ def last_access_time
218
+ . . .
219
+ end
220
+
221
+ # indicates the modification time of the entry
222
+ def modification_time
223
+ . . .
224
+ end
225
+
226
+ # ##########################
227
+ # Comparison
228
+
229
+ # determines whether rhs is an instance of Entry and
230
+ # refers to the same path
231
+ def eql?(rhs)
232
+ . . .
233
+ end
234
+
235
+ # determines whether rhs refers to the same path
236
+ def ==(rhs)
237
+ . . .
238
+ end
239
+
240
+ # compares this instance with rhs
241
+ def <=>(rhs)
242
+ . . .
243
+ end
244
+
245
+ # the hash
246
+ def hash
247
+ . . .
248
+ end
249
+
250
+ # ##########################
251
+ # Conversion
252
+
253
+ # represents the entry as a string (in the form of
254
+ # the full path)
255
+ def to_s
256
+ . . .
257
+ end
258
+
259
+ # represents the entry as a string (in the form of
260
+ # the full path)
261
+ def to_str
262
+ . . .
263
+ end
264
+ end # class Entry
265
+ end # module Recls
266
+
267
+
268
+ # ############################## end of file ############################# #
269
+
270
+
271
+ ```
272
+
42
273
 
43
274
  ## Examples
44
275
 
45
276
  Examples are provided in the ```examples``` directory, along with a markdown description for each. A detailed list TOC of them is provided in [EXAMPLES.md](./EXAMPLES.md).
46
277
 
278
+
47
279
  ## Project Information
48
280
 
281
+
49
282
  ### Where to get help
50
283
 
51
284
  [GitHub Page](https://github.com/synesissoftware/recls.Ruby "GitHub Page")
52
285
 
286
+
53
287
  ### Contribution guidelines
54
288
 
55
289
  Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/recls.Ruby.
56
290
 
291
+
57
292
  ### Dependencies
58
293
 
59
294
  None
60
295
 
296
+
61
297
  ### Dependents
62
298
 
63
299
  **recls.Ruby** is used in the **[libCLImate.Ruby](https://github.com/synesissoftware/libCLImate.Ruby)** library.
64
300
 
301
+
65
302
  ### Related projects
66
303
 
67
304
  * [**recls**](https://github.com/synesissoftware/recls/)
@@ -69,13 +306,17 @@ None
69
306
  * [**recls.NET**](https://github.com/synesissoftware/recls.NET/)
70
307
  * [**recls.Python**](https://github.com/synesissoftware/recls.Python/)
71
308
 
309
+
72
310
  ### License
73
311
 
74
312
  **recls.Ruby** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details.
75
313
 
314
+
76
315
  ### Compatibility
77
316
 
78
317
  For v2.8.x onwards, recls.Ruby is compatible only with Ruby 2.0+; all other
79
318
  past and current versions work with Ruby 1.9.3+.
80
319
 
81
320
 
321
+ <!-- ########################### end of file ########################### -->
322
+
@@ -39,39 +39,42 @@ attribute is used to display the relative path.
39
39
 
40
40
  ```
41
41
  files in current directory:
42
- build_gem.cmd
43
- build_gem.sh
44
- CHANGES.md
45
- EXAMPLES.md
46
- generate_rdoc.sh
47
- LICENSE
48
- Rakefile
49
- README.md
50
- recls.gemspec
51
- run_all_unit_tests.sh
42
+ build_gem.cmd
43
+ build_gem.sh
44
+ CHANGES.md
45
+ EXAMPLES.md
46
+ generate_rdoc.sh
47
+ LICENSE
48
+ Rakefile
49
+ README.md
50
+ recls.gemspec
51
+ run_all_unit_tests.sh
52
52
 
53
53
  directories in current directory:
54
- doc
55
- examples
56
- lib
57
- old-gems
58
- test
54
+ doc
55
+ examples
56
+ lib
57
+ old-gems
58
+ test
59
59
 
60
60
  files and directories in current directory:
61
- build_gem.cmd
62
- build_gem.sh
63
- CHANGES.md
64
- doc
65
- examples
66
- EXAMPLES.md
67
- generate_rdoc.sh
68
- lib
69
- LICENSE
70
- old-gems
71
- Rakefile
72
- README.md
73
- recls.gemspec
74
- run_all_unit_tests.sh
75
- test
61
+ build_gem.cmd
62
+ build_gem.sh
63
+ CHANGES.md
64
+ doc
65
+ examples
66
+ EXAMPLES.md
67
+ generate_rdoc.sh
68
+ lib
69
+ LICENSE
70
+ old-gems
71
+ Rakefile
72
+ README.md
73
+ recls.gemspec
74
+ run_all_unit_tests.sh
75
+ test
76
76
  ```
77
77
 
78
+
79
+ <!-- ########################### end of file ########################### -->
80
+