recls-ruby 2.12.0 → 2.12.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 +4 -4
  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 +76 -73
  11. data/lib/recls/combine_paths_1.rb +26 -23
  12. data/lib/recls/combine_paths_2plus.rb +32 -29
  13. data/lib/recls/entry.rb +277 -273
  14. data/lib/recls/file_search.rb +194 -193
  15. data/lib/recls/flags.rb +48 -45
  16. data/lib/recls/foreach.rb +105 -98
  17. data/lib/recls/obsolete.rb +85 -79
  18. data/lib/recls/recls.rb +19 -24
  19. data/lib/recls/stat.rb +137 -134
  20. data/lib/recls/util.rb +95 -92
  21. data/lib/recls/version.rb +22 -17
  22. data/lib/recls/ximpl/os.rb +49 -48
  23. data/lib/recls/ximpl/unix.rb +41 -38
  24. data/lib/recls/ximpl/util.rb +600 -599
  25. data/lib/recls/ximpl/windows.rb +142 -139
  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 +7 -7
@@ -1,15 +1,15 @@
1
- # ######################################################################### #
2
- # File: recls/ximpl/os.rb
1
+ # ######################################################################## #
2
+ # File: recls/ximpl/os.rb
3
3
  #
4
- # Purpose: Operating system internal implementation constructs for the
5
- # recls library.
4
+ # Purpose: Operating system internal implementation constructs for the
5
+ # recls library.
6
6
  #
7
- # Created: 16th February 2014
8
- # Updated: 6th April 2021
7
+ # Created: 16th February 2014
8
+ # Updated: 20th April 2024
9
9
  #
10
- # Author: Matthew Wilson
10
+ # Author: Matthew Wilson
11
11
  #
12
- # Copyright (c) 2019-2021, Matthew Wilson and Synesis Information Systems
12
+ # Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
13
13
  # Copyright (c) 2012-2019, Matthew Wilson and Synesis Software
14
14
  # All rights reserved.
15
15
  #
@@ -35,66 +35,67 @@
35
35
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
36
  # POSSIBILITY OF SUCH DAMAGE.
37
37
  #
38
- # ######################################################################### #
38
+ # ######################################################################## #
39
39
 
40
40
 
41
41
  =begin
42
42
  =end
43
43
 
44
- module Recls # :nodoc:
45
-
46
44
  # :stopdoc:
47
45
 
48
- module Ximpl # :nodoc: all
46
+ # @!visibility private
47
+ module Recls # :nodoc:
49
48
 
50
- module OS # :nodoc: all
49
+ # @!visibility private
50
+ module Ximpl # :nodoc: all
51
51
 
52
- # @!visibility private
53
- OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(bccwin|cygwin|mingw|mswin|wince)/i) ? true : false
52
+ module OS # :nodoc: all
54
53
 
55
- # @!visibility private
56
- PATH_NAME_SEPARATOR = OS_IS_WINDOWS ? '\\' : '/'
54
+ # @!visibility private
55
+ OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(bccwin|cygwin|mingw|mswin|wince)/i) ? true : false
57
56
 
58
- # @!visibility private
59
- PATH_SEPARATOR = OS_IS_WINDOWS ? ';' : ':'
57
+ # @!visibility private
58
+ PATH_NAME_SEPARATOR = OS_IS_WINDOWS ? '\\' : '/'
60
59
 
61
- # @!visibility private
62
- WILDCARDS_ALL = OS_IS_WINDOWS ? '*' : '*'
60
+ # @!visibility private
61
+ PATH_SEPARATOR = OS_IS_WINDOWS ? ';' : ':'
63
62
 
64
- # @!visibility private
65
- def OS.get_number_of_dots_dir_(p) # :nodoc:
63
+ # @!visibility private
64
+ WILDCARDS_ALL = OS_IS_WINDOWS ? '*' : '*'
66
65
 
67
- if p
68
- if ?. == p[0]
69
- return 1 if 1 == p.size
70
- return 1 if ?/ == p[1]
71
- return 1 if OS_IS_WINDOWS and ?\\ == p[1]
72
- if ?. == p[1]
73
- return 2 if 2 == p.size
74
- return 2 if ?/ == p[2]
75
- return 2 if OS_IS_WINDOWS and ?\\ == p[2]
76
- end
77
- end
78
- end
66
+ # @!visibility private
67
+ def OS.get_number_of_dots_dir_(p) # :nodoc:
79
68
 
80
- return 0
81
- end
69
+ if p
70
+ if ?. == p[0]
71
+ return 1 if 1 == p.size
72
+ return 1 if ?/ == p[1]
73
+ return 1 if OS_IS_WINDOWS and ?\\ == p[1]
74
+ if ?. == p[1]
75
+ return 2 if 2 == p.size
76
+ return 2 if ?/ == p[2]
77
+ return 2 if OS_IS_WINDOWS and ?\\ == p[2]
78
+ end
79
+ end
80
+ end
82
81
 
83
- # @!visibility private
84
- def OS.is_root_dir_(p) # :nodoc:
82
+ return 0
83
+ end
85
84
 
86
- return nil if not p
87
- return true if '/' == p
88
- return true if OS_IS_WINDOWS and '\\' == p
85
+ # @!visibility private
86
+ def OS.is_root_dir_(p) # :nodoc:
89
87
 
90
- return false
91
- end
92
- end # module OS
93
- end # module Ximpl
94
-
95
- # :startdoc:
88
+ return nil if not p
89
+ return true if '/' == p
90
+ return true if OS_IS_WINDOWS and '\\' == p
96
91
 
92
+ return false
93
+ end
94
+ end # module OS
95
+ end # module Ximpl
97
96
  end # module Recls
98
97
 
98
+ # :startdoc:
99
+
99
100
  # ############################## end of file ############################# #
100
101
 
@@ -1,13 +1,14 @@
1
- # ######################################################################### #
2
- # File: recls/ximpl/unix.rb
1
+ # ######################################################################## #
2
+ # File: recls/ximpl/unix.rb
3
3
  #
4
- # Purpose: UNIX-specific constructs for the recls library.
4
+ # Purpose: UNIX-specific constructs for the recls library.
5
5
  #
6
- # Created: 19th February 2014
7
- # Updated: 14th April 2019
6
+ # Created: 19th February 2014
7
+ # Updated: 20th April 2024
8
8
  #
9
- # Author: Matthew Wilson
9
+ # Author: Matthew Wilson
10
10
  #
11
+ # Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
11
12
  # Copyright (c) 2012-2019, Matthew Wilson and Synesis Software
12
13
  # All rights reserved.
13
14
  #
@@ -33,62 +34,64 @@
33
34
  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
35
  # POSSIBILITY OF SUCH DAMAGE.
35
36
  #
36
- # ######################################################################### #
37
+ # ######################################################################## #
37
38
 
38
39
 
39
40
  require 'recls/ximpl/util'
40
41
 
42
+
41
43
  =begin
42
44
  =end
43
45
 
44
- module Recls # :nodoc:
45
-
46
46
  # :stopdoc:
47
47
 
48
- module Ximpl # :nodoc: all
48
+ module Recls # :nodoc:
49
49
 
50
- # @!visibility private
51
- class FileStat < File::Stat # :nodoc:
50
+ # @!visibility private
51
+ module Ximpl # :nodoc: all
52
52
 
53
- private
54
- # @!visibility private
55
- def initialize(path) # :nodoc:
53
+ # @!visibility private
54
+ class FileStat < File::Stat # :nodoc:
56
55
 
57
- @path = path
56
+ private
57
+ # @!visibility private
58
+ def initialize(path) # :nodoc:
58
59
 
59
- super(path)
60
- end
60
+ @path = path
61
61
 
62
- public
63
- # @!visibility private
64
- attr_reader :path # :nodoc:
62
+ super(path)
63
+ end
65
64
 
66
- # @!visibility private
67
- def hidden? # :nodoc:
65
+ public
66
+ # @!visibility private
67
+ attr_reader :path # :nodoc:
68
68
 
69
- basename = File.basename @path
69
+ # @!visibility private
70
+ def hidden? # :nodoc:
70
71
 
71
- return false if basename.empty?
72
- return false if '.' == basename
73
- return false if '..' == basename
74
- return false if ?. != basename[0]
72
+ basename = File.basename @path
75
73
 
76
- return true
77
- end
74
+ return false if basename.empty?
75
+ return false if '.' == basename
76
+ return false if '..' == basename
77
+ return false if ?. != basename[0]
78
78
 
79
- public
80
- # @!visibility private
81
- def FileStat.stat(path) # :nodoc:
79
+ return true
80
+ end
82
81
 
83
- Recls::Ximpl::FileStat.new(path)
82
+ public
83
+ # @!visibility private
84
+ def FileStat.stat(path) # :nodoc:
84
85
 
85
- end
86
- end # class FileStat
87
- end # module Ximpl
86
+ Recls::Ximpl::FileStat.new(path)
87
+
88
+ end
89
+ end # class FileStat
90
+ end # module Ximpl
91
+ end # module Recls
88
92
 
89
93
  # :startdoc:
90
94
 
91
- end # module Recls
92
95
 
93
96
  # ############################## end of file ############################# #
94
97