recls-ruby 2.7.2 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -0
- data/lib/recls/entry.rb +36 -2
- data/lib/recls/stat.rb +5 -2
- data/lib/recls/version.rb +3 -3
- data/lib/recls/ximpl/util.rb +34 -6
- data/test/scratch/test_display_parts.rb +0 -0
- data/test/unit/tc_recls_entries.rb +1 -1
- data/test/unit/tc_recls_entry.rb +1 -1
- data/test/unit/tc_recls_file_search.rb +1 -1
- data/test/unit/tc_recls_module.rb +1 -2
- data/test/unit/tc_recls_util.rb +1 -2
- data/test/unit/tc_recls_ximpl_util.rb +3 -9
- data/test/unit/ts_all.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95854b93012f09220089014356ec0360436865eb
|
4
|
+
data.tar.gz: 9059a6ec0fe372902124c497b8155edd67608b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309026753993dd26ef59312bb5a92c1e3a27b41e237a2dc10b66c9756b82ad037f4fbab60e912321bbd0faba6a4702562506bad3ee0578dd1e30c09f1626b3c7
|
7
|
+
data.tar.gz: f859efe6be5cd292f455796451026c9ec17afb21fd31b45a933669536ab2810f28941d451a838b08ff5f80cfba8f5a54c5b4e97b4992222b83b0ea4b418cf01b
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Rakefile for recls
|
data/lib/recls/entry.rb
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
# Purpose: Defines the Recls::Entry class for the recls.Ruby library.
|
5
5
|
#
|
6
6
|
# Created: 24th July 2012
|
7
|
-
# Updated:
|
7
|
+
# Updated: 11th July 2016
|
8
8
|
#
|
9
9
|
# Author: Matthew Wilson
|
10
10
|
#
|
11
|
-
# Copyright (c) 2012-
|
11
|
+
# Copyright (c) 2012-2016, Matthew Wilson and Synesis Software
|
12
12
|
# All rights reserved.
|
13
13
|
#
|
14
14
|
# Redistribution and use in source and binary forms, with or without
|
@@ -131,18 +131,24 @@ module Recls
|
|
131
131
|
# instance was created
|
132
132
|
def exist?
|
133
133
|
|
134
|
+
return false if @file_stat.nil?
|
135
|
+
|
134
136
|
not @file_stat.nil?
|
135
137
|
end
|
136
138
|
|
137
139
|
# indicates whether the given entry is hidden
|
138
140
|
def hidden?
|
139
141
|
|
142
|
+
return false if @file_stat.nil?
|
143
|
+
|
140
144
|
@file_stat.hidden?
|
141
145
|
end
|
142
146
|
|
143
147
|
# indicates whether the given entry is readonly
|
144
148
|
def readonly?
|
145
149
|
|
150
|
+
return false if @file_stat.nil?
|
151
|
+
|
146
152
|
not @file_stat.writable?
|
147
153
|
end
|
148
154
|
|
@@ -153,36 +159,50 @@ module Recls
|
|
153
159
|
|
154
160
|
def system?
|
155
161
|
|
162
|
+
return false if @file_stat.nil?
|
163
|
+
|
156
164
|
@file_stat.system?
|
157
165
|
end
|
158
166
|
|
159
167
|
def archive?
|
160
168
|
|
169
|
+
return false if @file_stat.nil?
|
170
|
+
|
161
171
|
@file_stat.archive?
|
162
172
|
end
|
163
173
|
|
164
174
|
def device?
|
165
175
|
|
176
|
+
return false if @file_stat.nil?
|
177
|
+
|
166
178
|
@file_stat.device?
|
167
179
|
end
|
168
180
|
|
169
181
|
def normal?
|
170
182
|
|
183
|
+
return false if @file_stat.nil?
|
184
|
+
|
171
185
|
@file_stat.normal?
|
172
186
|
end
|
173
187
|
|
174
188
|
def temporary?
|
175
189
|
|
190
|
+
return false if @file_stat.nil?
|
191
|
+
|
176
192
|
@file_stat.temporary?
|
177
193
|
end
|
178
194
|
|
179
195
|
def compressed?
|
180
196
|
|
197
|
+
return false if @file_stat.nil?
|
198
|
+
|
181
199
|
@file_stat.compressed?
|
182
200
|
end
|
183
201
|
|
184
202
|
def encrypted?
|
185
203
|
|
204
|
+
return false if @file_stat.nil?
|
205
|
+
|
186
206
|
@file_stat.encrypted?
|
187
207
|
end
|
188
208
|
end
|
@@ -190,24 +210,32 @@ module Recls
|
|
190
210
|
# indicates whether the given entry represents a directory
|
191
211
|
def directory?
|
192
212
|
|
213
|
+
return false if @file_stat.nil?
|
214
|
+
|
193
215
|
@file_stat.directory?
|
194
216
|
end
|
195
217
|
|
196
218
|
# indicates whether the given entry represents a file
|
197
219
|
def file?
|
198
220
|
|
221
|
+
return false if @file_stat.nil?
|
222
|
+
|
199
223
|
@file_stat.file?
|
200
224
|
end
|
201
225
|
|
202
226
|
# indicates whether the given entry represents a link
|
203
227
|
def link?
|
204
228
|
|
229
|
+
return false if @file_stat.nil?
|
230
|
+
|
205
231
|
@file_stat.link?
|
206
232
|
end
|
207
233
|
|
208
234
|
# indicates whether the given entry represents a socket
|
209
235
|
def socket?
|
210
236
|
|
237
|
+
return false if @file_stat.nil?
|
238
|
+
|
211
239
|
@file_stat.socket?
|
212
240
|
end
|
213
241
|
|
@@ -217,6 +245,8 @@ module Recls
|
|
217
245
|
# indicates the size of the given entry
|
218
246
|
def size
|
219
247
|
|
248
|
+
return 0 if @file_stat.nil?
|
249
|
+
|
220
250
|
@file_stat.size
|
221
251
|
end
|
222
252
|
|
@@ -256,12 +286,16 @@ module Recls
|
|
256
286
|
# indicates the last access time of the entry
|
257
287
|
def last_access_time
|
258
288
|
|
289
|
+
return nil if @file_stat.nil?
|
290
|
+
|
259
291
|
@file_stat.atime
|
260
292
|
end
|
261
293
|
|
262
294
|
# indicates the modification time of the entry
|
263
295
|
def modification_time
|
264
296
|
|
297
|
+
return nil if @file_stat.nil?
|
298
|
+
|
265
299
|
@file_stat.mtime
|
266
300
|
end
|
267
301
|
|
data/lib/recls/stat.rb
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
# Purpose: Defines the Recls.stat() method for the recls.Ruby library.
|
5
5
|
#
|
6
6
|
# Created: 24th July 2012
|
7
|
-
# Updated:
|
7
|
+
# Updated: 22nd June 2017
|
8
8
|
#
|
9
9
|
# Author: Matthew Wilson
|
10
10
|
#
|
11
|
-
# Copyright (c) 2012-
|
11
|
+
# Copyright (c) 2012-2017, Matthew Wilson and Synesis Software
|
12
12
|
# All rights reserved.
|
13
13
|
#
|
14
14
|
# Redistribution and use in source and binary forms, with or without
|
@@ -86,9 +86,12 @@ module Recls
|
|
86
86
|
raise ArgumentError, "#{message}: Recls.stat() takes one (path), two (path+flags or path+search_root), or three (path+search_root+flags) arguments" if message
|
87
87
|
|
88
88
|
begin
|
89
|
+
|
89
90
|
Recls::Entry.new(path, Recls::Ximpl::FileStat.stat(path), search_root, flags)
|
90
91
|
rescue Errno::ENOENT => x
|
91
92
|
|
93
|
+
x = x # suppress warning
|
94
|
+
|
92
95
|
if 0 != (flags & Recls::DETAILS_LATER)
|
93
96
|
|
94
97
|
Recls::Entry.new(path, nil, search_root, flags)
|
data/lib/recls/version.rb
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
# Purpose: Version for recls library
|
5
5
|
#
|
6
6
|
# Created: 14th February 2014
|
7
|
-
# Updated:
|
7
|
+
# Updated: 22nd June 2017
|
8
8
|
#
|
9
9
|
# Author: Matthew Wilson
|
10
10
|
#
|
11
|
-
# Copyright (c) 2012-
|
11
|
+
# Copyright (c) 2012-2017, Matthew Wilson and Synesis Software
|
12
12
|
# All rights reserved.
|
13
13
|
#
|
14
14
|
# Redistribution and use in source and binary forms, with or without
|
@@ -39,7 +39,7 @@
|
|
39
39
|
module Recls
|
40
40
|
|
41
41
|
# Current version of the recls.Ruby library
|
42
|
-
VERSION = '2.7.
|
42
|
+
VERSION = '2.7.5'
|
43
43
|
|
44
44
|
private
|
45
45
|
VERSION_PARTS_ = VERSION.split(/[.]/).collect { |n| n.to_i } # :nodoc:
|
data/lib/recls/ximpl/util.rb
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
# Purpose: Internal implementation constructs for the recls library.
|
5
5
|
#
|
6
6
|
# Created: 24th July 2012
|
7
|
-
# Updated:
|
7
|
+
# Updated: 22nd June 2017
|
8
8
|
#
|
9
9
|
# Author: Matthew Wilson
|
10
10
|
#
|
11
|
-
# Copyright (c) 2012-
|
11
|
+
# Copyright (c) 2012-2017, Matthew Wilson and Synesis Software
|
12
12
|
# All rights reserved.
|
13
13
|
#
|
14
14
|
# Redistribution and use in source and binary forms, with or without
|
@@ -253,7 +253,9 @@ module Recls
|
|
253
253
|
|
254
254
|
newParts = []
|
255
255
|
|
256
|
+
=begin
|
256
257
|
trailing_slash = parts.empty? ? nil : self.get_trailing_slash(parts[-1])
|
258
|
+
=end
|
257
259
|
|
258
260
|
lastSingleDots = nil
|
259
261
|
|
@@ -387,6 +389,11 @@ module Recls
|
|
387
389
|
|
388
390
|
f1_windows_root, f2_directory, f3_basename, dummy1, dummy2, directory_parts, dummy3 = Util.split_path(path)
|
389
391
|
|
392
|
+
# suppress unused warnings
|
393
|
+
dummy1 = dummy1
|
394
|
+
dummy2 = dummy2
|
395
|
+
dummy3 = dummy3
|
396
|
+
|
390
397
|
if not f2_directory
|
391
398
|
canonicalised_directory = nil
|
392
399
|
else
|
@@ -412,7 +419,15 @@ module Recls
|
|
412
419
|
|
413
420
|
return '' if path.empty?
|
414
421
|
|
415
|
-
|
422
|
+
dummy1, f2_directory, dummy2, dummy3, dummy4, dummy5, dummy6 = Util.split_path(path)
|
423
|
+
|
424
|
+
# suppress unused warnings
|
425
|
+
dummy1 = dummy1
|
426
|
+
dummy2 = dummy2
|
427
|
+
dummy3 = dummy3
|
428
|
+
dummy4 = dummy4
|
429
|
+
dummy5 = dummy5
|
430
|
+
dummy6 = dummy6
|
416
431
|
|
417
432
|
if f2_directory =~ /^[\\\/]/
|
418
433
|
return path
|
@@ -462,6 +477,9 @@ module Recls
|
|
462
477
|
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
463
478
|
wr, rem = Util.get_windows_root(path)
|
464
479
|
|
480
|
+
# suppress unused warning
|
481
|
+
wr = wr
|
482
|
+
|
465
483
|
if not rem
|
466
484
|
return ''
|
467
485
|
else
|
@@ -520,6 +538,9 @@ module Recls
|
|
520
538
|
|
521
539
|
wr, rem = Util.get_windows_root(directory_path)
|
522
540
|
|
541
|
+
# suppress unused warning
|
542
|
+
wr = wr
|
543
|
+
|
523
544
|
rem
|
524
545
|
end
|
525
546
|
|
@@ -601,9 +622,16 @@ module Recls
|
|
601
622
|
|
602
623
|
def self.combine_paths(origin, path, options)
|
603
624
|
|
604
|
-
|
625
|
+
dummy1, f2_directory, dummy2, dummy3, dummy4, dummy5, dummy6 = Util.split_path(path)
|
626
|
+
|
627
|
+
# suppress unused warnings
|
628
|
+
dummy1 = dummy1
|
629
|
+
dummy2 = dummy2
|
630
|
+
dummy3 = dummy3
|
631
|
+
dummy4 = dummy4
|
632
|
+
dummy5 = dummy5
|
633
|
+
dummy6 = dummy6
|
605
634
|
|
606
|
-
# return path if f1_windows_root
|
607
635
|
return path if f2_directory && Util.is_path_name_separator(f2_directory[0])
|
608
636
|
|
609
637
|
r = File.join origin, path
|
@@ -634,7 +662,7 @@ module Recls
|
|
634
662
|
|
635
663
|
rescue SystemCallError => x
|
636
664
|
|
637
|
-
|
665
|
+
$stderr.puts "exception (#{x.class}): #{x}" if $DEBUG
|
638
666
|
|
639
667
|
if(0 != (STOP_ON_ACCESS_FAILURE & flags))
|
640
668
|
raise
|
File without changes
|
data/test/unit/tc_recls_entry.rb
CHANGED
data/test/unit/tc_recls_util.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#! /usr/bin/ruby
|
1
|
+
#! /usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# test Recls::Ximpl::Util namespace
|
4
4
|
|
@@ -635,9 +635,7 @@ end
|
|
635
635
|
|
636
636
|
class Test_Recls_Ximpl_absolute_path < Test::Unit::TestCase
|
637
637
|
|
638
|
-
|
639
|
-
attr_reader :cwd
|
640
|
-
public
|
638
|
+
attr_reader :cwd
|
641
639
|
|
642
640
|
def setup
|
643
641
|
|
@@ -702,9 +700,7 @@ end
|
|
702
700
|
|
703
701
|
class Test_Recls_Ximpl_derive_relative_path < Test::Unit::TestCase
|
704
702
|
|
705
|
-
|
706
|
-
attr_reader :cwd
|
707
|
-
public
|
703
|
+
attr_reader :cwd
|
708
704
|
|
709
705
|
def setup
|
710
706
|
|
@@ -902,7 +898,5 @@ class Test_Recls_Ximpl_derive_relative_path < Test::Unit::TestCase
|
|
902
898
|
assert_equal('./', Recls::Ximpl::derive_relative_path('./dir1/././././dir2/./', './dir1/././dir2/'))
|
903
899
|
|
904
900
|
end
|
905
|
-
|
906
901
|
end
|
907
902
|
|
908
|
-
|
data/test/unit/ts_all.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recls-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
RECursive LS for Ruby
|
@@ -19,6 +19,7 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- LICENSE
|
21
21
|
- README.md
|
22
|
+
- Rakefile
|
22
23
|
- examples/show_hidden_files.rb
|
23
24
|
- examples/show_readonly_files.rb
|
24
25
|
- lib/recls.rb
|