recls-ruby 2.10.0 → 2.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 606018fcccb7395be01a33399eb15feb0e4b5a6cbda0845469c5f7088347ee1b
4
- data.tar.gz: f33b673b8bf6d01ecee1a9ae626bd5e959a9da422541cc5b5deff1741c4f5cd7
3
+ metadata.gz: 785232a003d05a8f1ee53424529140c7a82f625d1d703abd7b1e786fbfabf5ed
4
+ data.tar.gz: 6139a8d63001ce68ce089aa096f6556c990d3f07314505907e6b12de6bfc9291
5
5
  SHA512:
6
- metadata.gz: 2601f4ce4f5b55a21b0d90b4c11d5a9eea22624d826821b82061f015b34ad05b2950d3a77534ee98ca9512c5d541936a759348010327bac57eeb7ca2a7d0f601
7
- data.tar.gz: bc608e22ab8de3cc2aa7048e55a283402061262053603d229b9c5b3256ac6a09cffff08a06024ad1d1b794995811ca69730c3761f6ab855372abcfdbcfd65e61
6
+ metadata.gz: 445f4717838f796f7f77502933fe864889b12b142c96c33dabf2326b5957e27b062679823cac8d483ae20436e5be93f6009f2e1a1f90f04ef6c70fb00da076fe
7
+ data.tar.gz: 794ec502431b8fd6c65d43a07a114225648b91abd4e17d941ecf8a071d2d7e3440d1ac5ace64be205da82baa2ce3dfb13fccf19f1a26560649290aa6211375a9
data/README.md CHANGED
@@ -54,6 +54,7 @@ None
54
54
  ### Related projects
55
55
 
56
56
  * [**recls**](https://github.com/synesissoftware/recls/)
57
+ * [**recls.Go**](https://github.com/synesissoftware/recls.Go/)
57
58
  * [**recls.NET**](https://github.com/synesissoftware/recls.NET/)
58
59
  * [**recls.Python**](https://github.com/synesissoftware/recls.Python/)
59
60
 
@@ -0,0 +1,77 @@
1
+ # recls.Ruby Example - **find_files_and_directories**
2
+
3
+ ## Summary
4
+
5
+ Illustrates finding of FILES, then DIRECTORIES, then both
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'recls'
15
+
16
+ puts "files in current directory:"
17
+ Recls.file_search(nil, nil, Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
18
+ puts
19
+
20
+ puts "directories in current directory:"
21
+ Recls.file_search(nil, nil, Recls::DIRECTORIES).each { |fe| puts "\t#{fe.search_relative_path}" }
22
+ puts
23
+
24
+ puts "files and directories in current directory:"
25
+ Recls.file_search(nil, nil, Recls::DIRECTORIES | Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
26
+ puts
27
+ ```
28
+
29
+ ## Discussion
30
+
31
+ The code is pretty self-explanatory, in that there are three searches using
32
+ the ```Recls.file_search()``` module method, passing FILES, DIRECTORIES, and
33
+ FILES|DIRECTORIES, respectively. For each search, a simple block is
34
+ presented, which takes a single-parameter of the file-entry (of type
35
+ ``Recls::Entry``) from which the ``#search_relative_path`` instance
36
+ attribute is used to display the relative path.
37
+
38
+ ## Example results
39
+
40
+ ```
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
52
+
53
+ directories in current directory:
54
+ doc
55
+ examples
56
+ lib
57
+ old-gems
58
+ test
59
+
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
76
+ ```
77
+
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'recls'
6
+
7
+ puts "files in current directory:"
8
+ Recls.file_search(nil, nil, Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
9
+ puts
10
+
11
+ puts "directories in current directory:"
12
+ Recls.file_search(nil, nil, Recls::DIRECTORIES).each { |fe| puts "\t#{fe.search_relative_path}" }
13
+ puts
14
+
15
+ puts "files and directories in current directory:"
16
+ Recls.file_search(nil, nil, Recls::DIRECTORIES | Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
17
+ puts
18
+
19
+
@@ -0,0 +1,292 @@
1
+ # recls.Ruby Example - **find_files_and_directories.recursive**
2
+
3
+ ## Summary
4
+
5
+ Illustrates recursive finding of FILES, then DIRECTORIES, then both
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'recls'
15
+
16
+ puts "files under current directory:"
17
+ Recls.file_rsearch(nil, nil, Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
18
+ puts
19
+
20
+ puts "directories under current directory:"
21
+ Recls.file_rsearch(nil, nil, Recls::DIRECTORIES).each { |fe| puts "\t#{fe.search_relative_path}" }
22
+ puts
23
+
24
+ puts "files and directories under current directory:"
25
+ Recls.file_rsearch(nil, nil, Recls::DIRECTORIES | Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
26
+ puts
27
+ ```
28
+
29
+ ## Discussion
30
+
31
+ The code is pretty self-explanatory, in that there are three searches using
32
+ the ```Recls.file_rsearch()``` module method, passing FILES, DIRECTORIES, and
33
+ FILES|DIRECTORIES, respectively. For each search, a simple block is
34
+ presented, which takes a single-parameter of the file-entry (of type
35
+ ``Recls::Entry``) from which the ``#search_relative_path`` instance
36
+ attribute is used to display the relative path.
37
+
38
+ ## Example results
39
+
40
+ ```
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
52
+ doc/CHANGES_md.html
53
+ doc/created.rid
54
+ doc/EXAMPLES_md.html
55
+ doc/index.html
56
+ doc/LICENSE.html
57
+ doc/README_md.html
58
+ doc/Recls.html
59
+ doc/table_of_contents.html
60
+ doc/css/fonts.css
61
+ doc/css/rdoc.css
62
+ doc/examples/show_hidden_files_md.html
63
+ doc/examples/show_readonly_files_md.html
64
+ doc/fonts/Lato-Light.ttf
65
+ doc/fonts/Lato-LightItalic.ttf
66
+ doc/fonts/Lato-Regular.ttf
67
+ doc/fonts/Lato-RegularItalic.ttf
68
+ doc/fonts/SourceCodePro-Bold.ttf
69
+ doc/fonts/SourceCodePro-Regular.ttf
70
+ doc/images/add.png
71
+ doc/images/arrow_up.png
72
+ doc/images/brick.png
73
+ doc/images/brick_link.png
74
+ doc/images/bug.png
75
+ doc/images/bullet_black.png
76
+ doc/images/bullet_toggle_minus.png
77
+ doc/images/bullet_toggle_plus.png
78
+ doc/images/date.png
79
+ doc/images/delete.png
80
+ doc/images/find.png
81
+ doc/images/loadingAnimation.gif
82
+ doc/images/macFFBgHack.png
83
+ doc/images/package.png
84
+ doc/images/page_green.png
85
+ doc/images/page_white_text.png
86
+ doc/images/page_white_width.png
87
+ doc/images/plugin.png
88
+ doc/images/ruby.png
89
+ doc/images/tag_blue.png
90
+ doc/images/tag_green.png
91
+ doc/images/transparent.png
92
+ doc/images/wrench.png
93
+ doc/images/wrench_orange.png
94
+ doc/images/zoom.png
95
+ doc/js/darkfish.js
96
+ doc/js/jquery.js
97
+ doc/js/navigation.js
98
+ doc/js/navigation.js.gz
99
+ doc/js/search.js
100
+ doc/js/search_index.js
101
+ doc/js/search_index.js.gz
102
+ doc/js/searcher.js
103
+ doc/js/searcher.js.gz
104
+ doc/Recls/Entry.html
105
+ examples/find_files_and_directories.md
106
+ examples/find_files_and_directories.rb
107
+ examples/find_files_and_directories.recursive.
108
+ examples/find_files_and_directories.recursive.md
109
+ examples/find_files_and_directories.recursive.rb
110
+ examples/show_hidden_files.md
111
+ examples/show_hidden_files.rb
112
+ examples/show_readonly_files.md
113
+ examples/show_readonly_files.rb
114
+ lib/recls.rb
115
+ lib/recls/api.rb
116
+ lib/recls/combine_paths_1.rb
117
+ lib/recls/combine_paths_2plus.rb
118
+ lib/recls/entry.rb
119
+ lib/recls/file_search.rb
120
+ lib/recls/flags.rb
121
+ lib/recls/foreach.rb
122
+ lib/recls/obsolete.rb
123
+ lib/recls/recls.rb
124
+ lib/recls/stat.rb
125
+ lib/recls/util.rb
126
+ lib/recls/version.rb
127
+ lib/recls/ximpl/os.rb
128
+ lib/recls/ximpl/unix.rb
129
+ lib/recls/ximpl/util.rb
130
+ lib/recls/ximpl/windows.rb
131
+ old-gems/recls-2.6.3.gem
132
+ old-gems/recls-ruby-2.10.0.gem
133
+ test/scratch/test_display_parts.rb
134
+ test/scratch/test_entry.rb
135
+ test/scratch/test_files_and_directories.rb
136
+ test/scratch/test_foreach.rb
137
+ test/scratch/test_module_function.rb
138
+ test/scratch/test_show_dev_and_ino.rb
139
+ test/scratch/test_show_hidden.rb
140
+ test/unit/tc_recls_entries.rb
141
+ test/unit/tc_recls_entry.rb
142
+ test/unit/tc_recls_file_search.rb
143
+ test/unit/tc_recls_module.rb
144
+ test/unit/tc_recls_util.rb
145
+ test/unit/tc_recls_ximpl_util.rb
146
+ test/unit/test_all_separately.cmd
147
+ test/unit/test_all_separately.sh
148
+ test/unit/ts_all.rb
149
+
150
+ directories in current directory:
151
+ doc
152
+ examples
153
+ lib
154
+ old-gems
155
+ test
156
+ doc/css
157
+ doc/examples
158
+ doc/fonts
159
+ doc/images
160
+ doc/js
161
+ doc/Recls
162
+ lib/recls
163
+ lib/recls/ximpl
164
+ test/scratch
165
+ test/unit
166
+
167
+ files and directories in current directory:
168
+ build_gem.cmd
169
+ build_gem.sh
170
+ CHANGES.md
171
+ doc
172
+ examples
173
+ EXAMPLES.md
174
+ generate_rdoc.sh
175
+ lib
176
+ LICENSE
177
+ old-gems
178
+ Rakefile
179
+ README.md
180
+ recls.gemspec
181
+ run_all_unit_tests.sh
182
+ test
183
+ doc/CHANGES_md.html
184
+ doc/created.rid
185
+ doc/css
186
+ doc/examples
187
+ doc/EXAMPLES_md.html
188
+ doc/fonts
189
+ doc/images
190
+ doc/index.html
191
+ doc/js
192
+ doc/LICENSE.html
193
+ doc/README_md.html
194
+ doc/Recls
195
+ doc/Recls.html
196
+ doc/table_of_contents.html
197
+ doc/css/fonts.css
198
+ doc/css/rdoc.css
199
+ doc/examples/show_hidden_files_md.html
200
+ doc/examples/show_readonly_files_md.html
201
+ doc/fonts/Lato-Light.ttf
202
+ doc/fonts/Lato-LightItalic.ttf
203
+ doc/fonts/Lato-Regular.ttf
204
+ doc/fonts/Lato-RegularItalic.ttf
205
+ doc/fonts/SourceCodePro-Bold.ttf
206
+ doc/fonts/SourceCodePro-Regular.ttf
207
+ doc/images/add.png
208
+ doc/images/arrow_up.png
209
+ doc/images/brick.png
210
+ doc/images/brick_link.png
211
+ doc/images/bug.png
212
+ doc/images/bullet_black.png
213
+ doc/images/bullet_toggle_minus.png
214
+ doc/images/bullet_toggle_plus.png
215
+ doc/images/date.png
216
+ doc/images/delete.png
217
+ doc/images/find.png
218
+ doc/images/loadingAnimation.gif
219
+ doc/images/macFFBgHack.png
220
+ doc/images/package.png
221
+ doc/images/page_green.png
222
+ doc/images/page_white_text.png
223
+ doc/images/page_white_width.png
224
+ doc/images/plugin.png
225
+ doc/images/ruby.png
226
+ doc/images/tag_blue.png
227
+ doc/images/tag_green.png
228
+ doc/images/transparent.png
229
+ doc/images/wrench.png
230
+ doc/images/wrench_orange.png
231
+ doc/images/zoom.png
232
+ doc/js/darkfish.js
233
+ doc/js/jquery.js
234
+ doc/js/navigation.js
235
+ doc/js/navigation.js.gz
236
+ doc/js/search.js
237
+ doc/js/search_index.js
238
+ doc/js/search_index.js.gz
239
+ doc/js/searcher.js
240
+ doc/js/searcher.js.gz
241
+ doc/Recls/Entry.html
242
+ examples/find_files_and_directories.md
243
+ examples/find_files_and_directories.rb
244
+ examples/find_files_and_directories.recursive.
245
+ examples/find_files_and_directories.recursive.md
246
+ examples/find_files_and_directories.recursive.rb
247
+ examples/show_hidden_files.md
248
+ examples/show_hidden_files.rb
249
+ examples/show_readonly_files.md
250
+ examples/show_readonly_files.rb
251
+ lib/recls
252
+ lib/recls.rb
253
+ lib/recls/api.rb
254
+ lib/recls/combine_paths_1.rb
255
+ lib/recls/combine_paths_2plus.rb
256
+ lib/recls/entry.rb
257
+ lib/recls/file_search.rb
258
+ lib/recls/flags.rb
259
+ lib/recls/foreach.rb
260
+ lib/recls/obsolete.rb
261
+ lib/recls/recls.rb
262
+ lib/recls/stat.rb
263
+ lib/recls/util.rb
264
+ lib/recls/version.rb
265
+ lib/recls/ximpl
266
+ lib/recls/ximpl/os.rb
267
+ lib/recls/ximpl/unix.rb
268
+ lib/recls/ximpl/util.rb
269
+ lib/recls/ximpl/windows.rb
270
+ old-gems/recls-2.6.3.gem
271
+ old-gems/recls-ruby-2.10.0.gem
272
+ test/scratch
273
+ test/unit
274
+ test/scratch/test_display_parts.rb
275
+ test/scratch/test_entry.rb
276
+ test/scratch/test_files_and_directories.rb
277
+ test/scratch/test_foreach.rb
278
+ test/scratch/test_module_function.rb
279
+ test/scratch/test_show_dev_and_ino.rb
280
+ test/scratch/test_show_hidden.rb
281
+ test/unit/tc_recls_entries.rb
282
+ test/unit/tc_recls_entry.rb
283
+ test/unit/tc_recls_file_search.rb
284
+ test/unit/tc_recls_module.rb
285
+ test/unit/tc_recls_util.rb
286
+ test/unit/tc_recls_ximpl_util.rb
287
+ test/unit/test_all_separately.cmd
288
+ test/unit/test_all_separately.sh
289
+ test/unit/ts_all.rb
290
+ ```
291
+
292
+
@@ -0,0 +1,19 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'recls'
6
+
7
+ puts "files under current directory:"
8
+ Recls.file_rsearch(nil, nil, Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
9
+ puts
10
+
11
+ puts "directories under current directory:"
12
+ Recls.file_rsearch(nil, nil, Recls::DIRECTORIES).each { |fe| puts "\t#{fe.search_relative_path}" }
13
+ puts
14
+
15
+ puts "files and directories under current directory:"
16
+ Recls.file_rsearch(nil, nil, Recls::DIRECTORIES | Recls::FILES).each { |fe| puts "\t#{fe.search_relative_path}" }
17
+ puts
18
+
19
+
@@ -0,0 +1,39 @@
1
+ # recls.Ruby Example - **show_hidden_files**
2
+
3
+ ## Summary
4
+
5
+ TBC
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'recls'
15
+
16
+ # To find only hidden files, need to:
17
+ #
18
+ # 1. Ensure that they are returned in search, by including Recls::SHOW_HIDDEN
19
+ # 2. Filter returned entries by hidden? attribute
20
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::SHOW_HIDDEN).each do |fe|
21
+
22
+ puts fe.path if fe.hidden?
23
+ end
24
+ ```
25
+
26
+ ## Discussion
27
+
28
+ TBC
29
+
30
+ ## Example results
31
+
32
+ ```
33
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/.gitignore
34
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/.ruby-version
35
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/.ruby-version-exclusions
36
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/hidden/.file-1
37
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/hidden/.file-2
38
+ ```
39
+
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
 
2
3
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
4
 
@@ -7,9 +8,8 @@ require 'recls'
7
8
  #
8
9
  # 1. Ensure that they are returned in search, by including Recls::SHOW_HIDDEN
9
10
  # 2. Filter returned entries by hidden? attribute
10
- Recls::FileSearch.new('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::RECURSIVE | Recls::SHOW_HIDDEN).each do |fe|
11
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::SHOW_HIDDEN).each do |fe|
11
12
 
12
13
  puts fe.path if fe.hidden?
13
-
14
14
  end
15
15
 
@@ -0,0 +1,35 @@
1
+ # recls.Ruby Example - **show_hidden_files**
2
+
3
+ ## Summary
4
+
5
+ TBC
6
+
7
+ ## Source
8
+
9
+ ```ruby
10
+ #! /usr/bin/env ruby
11
+
12
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
13
+
14
+ require 'recls'
15
+
16
+ # To find only readonly files, need to:
17
+ #
18
+ # 1. Filter returned entries by readonly? attribute
19
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES).each do |fe|
20
+
21
+ puts fe.path if fe.readonly?
22
+ end
23
+ ```
24
+
25
+ ## Discussion
26
+
27
+ TBC
28
+
29
+ ## Example results
30
+
31
+ ```
32
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/readonly/file-1
33
+ /Users/matthewwilson/dev/freelibs/recls/100/recls.Ruby/trunk/test/fixtures/readonly/file-2
34
+ ```
35
+
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
 
2
3
  $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
4
 
@@ -6,9 +7,8 @@ require 'recls'
6
7
  # To find only readonly files, need to:
7
8
  #
8
9
  # 1. Filter returned entries by readonly? attribute
9
- Recls::FileSearch.new('.', Recls::WILDCARDS_ALL, Recls::FILES | Recls::RECURSIVE).each do |fe|
10
+ Recls.file_rsearch('.', Recls::WILDCARDS_ALL, Recls::FILES).each do |fe|
10
11
 
11
12
  puts fe.path if fe.readonly?
12
-
13
13
  end
14
14
 
@@ -52,6 +52,7 @@ module Recls
52
52
  class Entry
53
53
 
54
54
  private
55
+ # @!visibility private
55
56
  def self.get_compare_path_(path)
56
57
  return path.upcase if Recls::Ximpl::OS::OS_IS_WINDOWS
57
58
  path
@@ -137,6 +137,10 @@ module Recls
137
137
  # (Integer) The search flags
138
138
  attr_reader :flags
139
139
 
140
+ # Calls the block once for each found file, passing a single
141
+ # parameter that is a Recls::Entry instance
142
+ #
143
+ # @!visibility private
140
144
  def each(&blk) # :nodoc:
141
145
 
142
146
  search_root = @search_root
@@ -179,6 +183,7 @@ module Recls
179
183
  end
180
184
 
181
185
  private
186
+ # @!visibility private
182
187
  def FileSearch.is_dots(name) # :nodoc:
183
188
 
184
189
  case name
@@ -189,6 +194,7 @@ module Recls
189
194
  end
190
195
  end
191
196
 
197
+ # @!visibility private
192
198
  def FileSearch.stat_or_nil_(path, flags) # :nodoc:
193
199
 
194
200
  begin
@@ -217,6 +223,7 @@ module Recls
217
223
  # order to allow calculation of search_relative_path in the
218
224
  # entry.
219
225
 
226
+ # @!visibility private
220
227
  def FileSearch.search_directory_(search_root, dir, patterns, flags, &blk) # :nodoc:
221
228
 
222
229
  # array of FileStat instances
@@ -276,6 +283,8 @@ module Recls
276
283
 
277
284
  match = false
278
285
 
286
+ match ||= (0 == (Recls::TYPEMASK & flags))
287
+
279
288
  match ||= (0 != (Recls::FILES & flags) && fs.file?)
280
289
  match ||= (0 != (Recls::DIRECTORIES & flags) && fs.directory?)
281
290
  match ||= (0 != (Recls::DEVICES & flags) && fs.blockdev?)
@@ -46,15 +46,18 @@ class Object; end # :nodoc:
46
46
  module Recls
47
47
 
48
48
  private
49
+ # @!visibility private
49
50
  class FileSearchLineEnumerator # :nodoc: all
50
51
 
51
52
  include Enumerable
52
53
 
54
+ # @!visibility private
53
55
  def initialize(fs)
54
56
 
55
57
  @fs = fs
56
58
  end
57
59
 
60
+ # @!visibility private
58
61
  def each(&block)
59
62
 
60
63
  @fs.each do |fe|
@@ -44,16 +44,19 @@ if not defined? RECLS_NO_OBSOLETE
44
44
 
45
45
  module Recls # :nodoc: all
46
46
 
47
+ # @!visibility private
47
48
  def self.pathNameSeparator
48
49
 
49
50
  PATH_NAME_SEPARATOR
50
51
  end
51
52
 
53
+ # @!visibility private
52
54
  def self.pathSeparator
53
55
 
54
56
  PATH_SEPARATOR
55
57
  end
56
58
 
59
+ # @!visibility private
57
60
  def self.wildcardsAll
58
61
 
59
62
  WILDCARDS_ALL
@@ -61,27 +64,43 @@ if not defined? RECLS_NO_OBSOLETE
61
64
 
62
65
  class FileSearch # :nodoc:
63
66
 
67
+ # @!visibility private
64
68
  alias_method :searchRoot, :search_root
69
+ # @!visibility private
65
70
  alias_method :pattern, :patterns
66
71
  end
67
72
 
68
73
  class Entry # :nodoc:
69
74
 
75
+ # @!visibility private
70
76
  alias_method :uncDrive, :drive
77
+ # @!visibility private
71
78
  alias_method :directoryPath, :directory_path
79
+ # @!visibility private
72
80
  alias_method :directoryParts, :directory_parts
81
+ # @!visibility private
73
82
  alias_method :file, :file_full_name
83
+ # @!visibility private
74
84
  alias_method :shortFile, :file_short_name
85
+ # @!visibility private
75
86
  alias_method :fileBaseName, :file_name_only
87
+ # @!visibility private
76
88
  alias_method :fileName, :file_name_only
89
+ # @!visibility private
77
90
  alias_method :fileExt, :file_extension
91
+ # @!visibility private
78
92
  alias_method :searchDirectory, :search_directory
93
+ # @!visibility private
79
94
  alias_method :searchRelativePath, :search_relative_path
80
95
 
96
+ # @!visibility private
81
97
  alias_method :isDirectory, :directory?
98
+ # @!visibility private
82
99
  alias_method :isFile, :file?
83
100
  #alias_method :isLink, :link?
101
+ # @!visibility private
84
102
  alias_method :isReadOnly, :readonly?
103
+ # @!visibility private
85
104
  def isUNC
86
105
 
87
106
  d = drive
@@ -89,6 +108,7 @@ if not defined? RECLS_NO_OBSOLETE
89
108
  d and d.size > 2
90
109
  end
91
110
 
111
+ # @!visibility private
92
112
  alias_method :creationTime, :modification_time
93
113
  end
94
114
  end # module Recls
@@ -46,7 +46,6 @@ require 'recls/stat'
46
46
  require 'recls/util'
47
47
  require 'recls/ximpl/os'
48
48
 
49
-
50
49
  # The *recls* module
51
50
  #
52
51
  # == Significant Components
@@ -137,6 +137,8 @@ module Recls
137
137
 
138
138
  return nil if path.nil?
139
139
 
140
+ return true if 'Recls::Entry' === path.class.to_s
141
+
140
142
  Recls::Ximpl.absolute_path? path
141
143
  end
142
144
  end # module Recls
@@ -44,7 +44,7 @@ class Object; end # :nodoc:
44
44
  module Recls
45
45
 
46
46
  # Current version of the recls.Ruby library
47
- VERSION = '2.10.0'
47
+ VERSION = '2.10.1'
48
48
 
49
49
  private
50
50
  VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
@@ -42,19 +42,26 @@
42
42
 
43
43
  module Recls # :nodoc:
44
44
 
45
+ # :stopdoc:
46
+
45
47
  module Ximpl # :nodoc: all
46
48
 
47
49
  module OS # :nodoc: all
48
50
 
51
+ # @!visibility private
49
52
  OS_IS_WINDOWS = (RUBY_PLATFORM =~ /(mswin|mingw|bccwin|wince)/i) ? true : false
50
53
 
54
+ # @!visibility private
51
55
  PATH_NAME_SEPARATOR = OS_IS_WINDOWS ? '\\' : '/'
52
56
 
57
+ # @!visibility private
53
58
  PATH_SEPARATOR = OS_IS_WINDOWS ? ';' : ':'
54
59
 
60
+ # @!visibility private
55
61
  WILDCARDS_ALL = OS_IS_WINDOWS ? '*' : '*'
56
62
 
57
- def OS.get_number_of_dots_dir_(p)
63
+ # @!visibility private
64
+ def OS.get_number_of_dots_dir_(p) # :nodoc:
58
65
 
59
66
  if p
60
67
  if ?. == p[0]
@@ -72,7 +79,8 @@ module Recls # :nodoc:
72
79
  return 0
73
80
  end
74
81
 
75
- def OS.is_root_dir_(p)
82
+ # @!visibility private
83
+ def OS.is_root_dir_(p) # :nodoc:
76
84
 
77
85
  return nil if not p
78
86
  return true if '/' == p
@@ -82,6 +90,9 @@ module Recls # :nodoc:
82
90
  end
83
91
  end # module OS
84
92
  end # module Ximpl
93
+
94
+ # :startdoc:
95
+
85
96
  end # module Recls
86
97
 
87
98
  # ############################## end of file ############################# #
@@ -43,12 +43,16 @@ require 'recls/ximpl/util'
43
43
 
44
44
  module Recls # :nodoc:
45
45
 
46
+ # :stopdoc:
47
+
46
48
  module Ximpl # :nodoc: all
47
49
 
50
+ # @!visibility private
48
51
  class FileStat < File::Stat # :nodoc:
49
52
 
50
53
  private
51
- def initialize(path)
54
+ # @!visibility private
55
+ def initialize(path) # :nodoc:
52
56
 
53
57
  @path = path
54
58
 
@@ -56,9 +60,11 @@ module Recls # :nodoc:
56
60
  end
57
61
 
58
62
  public
59
- attr_reader :path
63
+ # @!visibility private
64
+ attr_reader :path # :nodoc:
60
65
 
61
- def hidden?
66
+ # @!visibility private
67
+ def hidden? # :nodoc:
62
68
 
63
69
  basename = File.basename @path
64
70
 
@@ -71,13 +77,17 @@ module Recls # :nodoc:
71
77
  end
72
78
 
73
79
  public
74
- def FileStat.stat(path)
80
+ # @!visibility private
81
+ def FileStat.stat(path) # :nodoc:
75
82
 
76
83
  Recls::Ximpl::FileStat.new(path)
77
84
 
78
85
  end
79
86
  end # class FileStat
80
87
  end # module Ximpl
88
+
89
+ # :startdoc:
90
+
81
91
  end # module Recls
82
92
 
83
93
  # ############################## end of file ############################# #
@@ -46,11 +46,14 @@ require 'pathname'
46
46
 
47
47
  module Recls # :nodoc:
48
48
 
49
+ # :stopdoc:
50
+
49
51
  module Ximpl # :nodoc: all
50
52
 
51
53
  module Util # :nodoc: all
52
54
 
53
- def self.is_path_name_separator(c)
55
+ # @!visibility private
56
+ def self.is_path_name_separator(c) # :nodoc:
54
57
 
55
58
  return true if ?/ == c
56
59
 
@@ -65,7 +68,9 @@ module Recls # :nodoc:
65
68
  # Indicates whether a trailing slash is on the given path
66
69
  #
67
70
  # dependencies: none
68
- def self.has_trailing_slash(p)
71
+ #
72
+ # @!visibility private
73
+ def self.has_trailing_slash(p) # :nodoc:
69
74
 
70
75
  return p if p.nil? or p.empty?
71
76
 
@@ -75,7 +80,9 @@ module Recls # :nodoc:
75
80
  # returns the trailing slash, or nil if none present
76
81
  #
77
82
  # dependencies: none
78
- def self.get_trailing_slash(p, args = {})
83
+ #
84
+ # @!visibility private
85
+ def self.get_trailing_slash(p, args = {}) # :nodoc:
79
86
 
80
87
  return nil if p.nil?
81
88
  return nil if p.empty?
@@ -87,7 +94,9 @@ module Recls # :nodoc:
87
94
  # present
88
95
  #
89
96
  # dependencies: none
90
- def self.append_trailing_slash(p, slash = nil)
97
+ #
98
+ # @!visibility private
99
+ def self.append_trailing_slash(p, slash = nil) # :nodoc:
91
100
 
92
101
  return p if not p or p.empty?
93
102
 
@@ -102,7 +111,9 @@ module Recls # :nodoc:
102
111
  # root
103
112
  #
104
113
  # dependencies: none
105
- def self.trim_trailing_slash(p)
114
+ #
115
+ # @!visibility private
116
+ def self.trim_trailing_slash(p) # :nodoc:
106
117
 
107
118
  return p if not p or p.empty?
108
119
 
@@ -120,7 +131,9 @@ module Recls # :nodoc:
120
131
  # [ nil, nil ] if p is nil
121
132
  #
122
133
  # dependencies: none
123
- def self.get_windows_root(p)
134
+ #
135
+ # @!visibility private
136
+ def self.get_windows_root(p) # :nodoc:
124
137
 
125
138
  return [ nil, nil ] if not p
126
139
 
@@ -164,7 +177,9 @@ module Recls # :nodoc:
164
177
 
165
178
  # obtains the parts from a path, including any Windows root and
166
179
  # the file basename
167
- def self.path_parts(path)
180
+ #
181
+ # @!visibility private
182
+ def self.path_parts(path) # :nodoc:
168
183
 
169
184
  return nil if path.nil?
170
185
  return [] if path.empty?
@@ -204,7 +219,9 @@ module Recls # :nodoc:
204
219
  # f7. array of all path parts, which may be empty (not nil)
205
220
  #
206
221
  # dependencies: Util.path_parts, Util.get_windows_root
207
- def self.split_path(p)
222
+ #
223
+ # @!visibility private
224
+ def self.split_path(p) # :nodoc:
208
225
 
209
226
  f1_windows_root, remainder = self.get_windows_root p
210
227
  f1_windows_root = nil if not f1_windows_root or f1_windows_root.empty?
@@ -270,7 +287,9 @@ module Recls # :nodoc:
270
287
  # f2. A boolean indicating whether to 'consume' the basename
271
288
  #
272
289
  # dependencies: OS.is_root_dir_, OS.get_number_of_dots_dir_,
273
- def self.canonicalise_parts(parts, basename = nil)
290
+ #
291
+ # @!visibility private
292
+ def self.canonicalise_parts(parts, basename = nil) # :nodoc:
274
293
 
275
294
  newParts = []
276
295
 
@@ -429,7 +448,9 @@ module Recls # :nodoc:
429
448
  # Note: contains a trailing slash if, in the context of the given
430
449
  # path, the last element of the canonicalised path is a directory
431
450
  # unequivocally
432
- def self.canonicalise_path(path)
451
+ #
452
+ # @!visibility private
453
+ def self.canonicalise_path(path) # :nodoc:
433
454
 
434
455
  return nil if not path
435
456
  return '' if path.empty?
@@ -455,7 +476,8 @@ module Recls # :nodoc:
455
476
  return "#{f1_windows_root}#{canonicalised_directory}#{f3_basename}"
456
477
  end
457
478
 
458
- def self.absolute_path?(path)
479
+ # @!visibility private
480
+ def self.absolute_path?(path) # :nodoc:
459
481
 
460
482
  case path
461
483
  when nil
@@ -489,7 +511,9 @@ module Recls # :nodoc:
489
511
  end
490
512
 
491
513
  # determines the absolute path of a given path
492
- def self.absolute_path(path, refdir = nil)
514
+ #
515
+ # @!visibility private
516
+ def self.absolute_path(path, refdir = nil) # :nodoc:
493
517
 
494
518
  case path
495
519
  when ::NilClass
@@ -560,7 +584,8 @@ module Recls # :nodoc:
560
584
  # is
561
585
  # ghi.jkl
562
586
  #
563
- def self.basename(path)
587
+ # @!visibility private
588
+ def self.basename(path) # :nodoc:
564
589
 
565
590
  return nil if not path
566
591
 
@@ -603,7 +628,9 @@ module Recls # :nodoc:
603
628
  # ghi.jkl
604
629
  # is
605
630
  # .jkl
606
- def self.file_ext(path)
631
+ #
632
+ # @!visibility private
633
+ def self.file_ext(path) # :nodoc:
607
634
 
608
635
  return nil if not path
609
636
 
@@ -641,7 +668,8 @@ module Recls # :nodoc:
641
668
 
642
669
  # obtains the directory from the directory path
643
670
  #
644
- def self.directory_from_directory_path(directory_path)
671
+ # @!visibility private
672
+ def self.directory_from_directory_path(directory_path) # :nodoc:
645
673
 
646
674
  wr, rem = Util.get_windows_root(directory_path)
647
675
 
@@ -652,7 +680,9 @@ module Recls # :nodoc:
652
680
  end
653
681
 
654
682
  # obtains the directory parts from a directory
655
- def self.directory_parts_from_directory(directory)
683
+ #
684
+ # @!visibility private
685
+ def self.directory_parts_from_directory(directory) # :nodoc:
656
686
 
657
687
  return nil if not directory
658
688
 
@@ -676,7 +706,9 @@ module Recls # :nodoc:
676
706
 
677
707
  # obtains the relative path of a given path and
678
708
  # a reference directory
679
- def self.derive_relative_path(origin, path)
709
+ #
710
+ # @!visibility private
711
+ def self.derive_relative_path(origin, path) # :nodoc:
680
712
 
681
713
  return nil if path.nil?
682
714
  return nil if path.empty?
@@ -739,8 +771,8 @@ module Recls # :nodoc:
739
771
  return '../' * origin_parts.size + path_parts.join('')
740
772
  end
741
773
 
742
-
743
- def self.combine_paths(paths, options)
774
+ # @!visibility private
775
+ def self.combine_paths(paths, options) # :nodoc:
744
776
 
745
777
  paths = [ paths ] unless ::Array === paths
746
778
  abs_ix = 0
@@ -797,7 +829,8 @@ module Recls # :nodoc:
797
829
  # * (Mac OSX) /dev/fd/<N> - some of these stat() as directories but
798
830
  # Dir.new fails with ENOTDIR
799
831
  #
800
- def self.dir_entries_maybe(dir, flags)
832
+ # @!visibility private
833
+ def self.dir_entries_maybe(dir, flags) # :nodoc:
801
834
 
802
835
  begin
803
836
 
@@ -816,7 +849,8 @@ module Recls # :nodoc:
816
849
  end
817
850
  end
818
851
 
819
- def self.stat_prep(path, search_root, flags)
852
+ # @!visibility private
853
+ def self.stat_prep(path, search_root, flags) # :nodoc:
820
854
 
821
855
  begin
822
856
 
@@ -835,6 +869,9 @@ module Recls # :nodoc:
835
869
  end
836
870
  end
837
871
  end # module Ximpl
872
+
873
+ # :startdoc:
874
+
838
875
  end # module Recls
839
876
 
840
877
  # ############################## end of file ############################# #
@@ -43,8 +43,11 @@ require 'Win32API'
43
43
 
44
44
  module Recls # :nodoc:
45
45
 
46
+ # :stopdoc:
47
+
46
48
  module Ximpl # :nodoc: all
47
49
 
50
+ # @!visibility private
48
51
  class FileStat < File::Stat # :nodoc:
49
52
 
50
53
  private
@@ -73,9 +76,11 @@ module Recls # :nodoc:
73
76
 
74
77
  BHFI_pack_string = 'LQQQLLLLLL'
75
78
 
79
+ # @!visibility private
76
80
  class ByHandleInformation # :nodoc:
77
81
 
78
- def initialize(path)
82
+ # @!visibility private
83
+ def initialize(path) # :nodoc:
79
84
 
80
85
  @volume_id = 0
81
86
  @file_index = 0
@@ -104,19 +109,24 @@ module Recls # :nodoc:
104
109
  end
105
110
  end
106
111
 
112
+ # @!visibility private
107
113
  attr_reader :volume_id
114
+ # @!visibility private
108
115
  attr_reader :file_index
116
+ # @!visibility private
109
117
  attr_reader :num_links
110
118
  end
111
119
 
112
120
  private
113
- def has_attribute_? (attr)
121
+ # @!visibility private
122
+ def has_attribute_? (attr) # :nodoc:
114
123
 
115
124
  0 != (attr & @attributes)
116
125
  end
117
126
 
118
127
  private
119
- def initialize(path)
128
+ # @!visibility private
129
+ def initialize(path) # :nodoc:
120
130
 
121
131
  @path = path
122
132
 
@@ -142,61 +152,77 @@ module Recls # :nodoc:
142
152
  end
143
153
 
144
154
  public
155
+ # @!visibility private
145
156
  attr_reader :attributes
157
+ # @!visibility private
146
158
  attr_reader :path
159
+ # @!visibility private
147
160
  attr_reader :by_handle_information
161
+ # @!visibility private
148
162
  attr_reader :short_path
149
163
 
150
- def hidden?
164
+ # @!visibility private
165
+ def hidden? # :nodoc:
151
166
 
152
167
  0 != (FILE_ATTRIBUTE_HIDDEN & @attributes)
153
168
  end
154
169
 
155
170
  # Windows-specific attributes
156
171
 
157
- def system?
172
+ # @!visibility private
173
+ def system? # :nodoc:
158
174
 
159
175
  has_attribute_? FILE_ATTRIBUTE_SYSTEM
160
176
  end
161
177
 
162
- def archive?
178
+ # @!visibility private
179
+ def archive? # :nodoc:
163
180
 
164
181
  has_attribute_? FILE_ATTRIBUTE_ARCHIVE
165
182
  end
166
183
 
167
- def device?
184
+ # @!visibility private
185
+ def device? # :nodoc:
168
186
 
169
187
  has_attribute_? FILE_ATTRIBUTE_DEVICE
170
188
  end
171
189
 
172
- def normal?
190
+ # @!visibility private
191
+ def normal? # :nodoc:
173
192
 
174
193
  has_attribute_? FILE_ATTRIBUTE_NORMAL
175
194
  end
176
195
 
177
- def temporary?
196
+ # @!visibility private
197
+ def temporary? # :nodoc:
178
198
 
179
199
  has_attribute_? FILE_ATTRIBUTE_TEMPORARY
180
200
  end
181
201
 
182
- def compressed?
202
+ # @!visibility private
203
+ def compressed? # :nodoc:
183
204
 
184
205
  has_attribute_? FILE_ATTRIBUTE_COMPRESSED
185
206
  end
186
207
 
187
- def encrypted?
208
+ # @!visibility private
209
+ def encrypted? # :nodoc:
188
210
 
189
211
  has_attribute_? FILE_ATTRIBUTE_ENCRYPTED
190
212
  end
191
213
 
192
214
 
193
215
  public
194
- def FileStat.stat(path)
216
+ # @!visibility private
217
+ def FileStat.stat(path) # :nodoc:
195
218
 
196
219
  Recls::Ximpl::FileStat.new(path)
197
220
  end
198
221
  end # class FileStat
199
222
  end # module Ximpl
223
+
224
+ # :startdoc:
225
+
200
226
  end # module Recls
201
227
 
202
228
  # ############################## end of file ############################# #
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recls-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
@@ -35,7 +35,13 @@ files:
35
35
  - LICENSE
36
36
  - README.md
37
37
  - Rakefile
38
+ - examples/find_files_and_directories.md
39
+ - examples/find_files_and_directories.rb
40
+ - examples/find_files_and_directories.recursive.md
41
+ - examples/find_files_and_directories.recursive.rb
42
+ - examples/show_hidden_files.md
38
43
  - examples/show_hidden_files.rb
44
+ - examples/show_readonly_files.md
39
45
  - examples/show_readonly_files.rb
40
46
  - lib/recls.rb
41
47
  - lib/recls/api.rb
@@ -54,6 +60,8 @@ files:
54
60
  - lib/recls/ximpl/unix.rb
55
61
  - lib/recls/ximpl/util.rb
56
62
  - lib/recls/ximpl/windows.rb
63
+ - test/fixtures/readonly/file-1
64
+ - test/fixtures/readonly/file-2
57
65
  - test/scratch/test_display_parts.rb
58
66
  - test/scratch/test_entry.rb
59
67
  - test/scratch/test_files_and_directories.rb