recls-ruby 2.11.0.3 → 2.12.0

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