file-find 0.3.1-universal-java-1.5 → 0.3.2-universal-java-1.5
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.
- data/CHANGES +4 -0
- data/README +3 -6
- data/lib/file/find.rb +15 -2
- data/test/test_file_find.rb +7 -1
- metadata +3 -3
data/CHANGES
CHANGED
data/README
CHANGED
@@ -35,6 +35,7 @@ few options, hasn't been updated in over six years and isn't packaged properly.
|
|
35
35
|
* group (name or id)
|
36
36
|
* maxdepth
|
37
37
|
* mindepth
|
38
|
+
* mount
|
38
39
|
* mtime
|
39
40
|
* name (or 'pattern')
|
40
41
|
* path
|
@@ -73,11 +74,6 @@ supported. These include the following options:
|
|
73
74
|
|
74
75
|
* ok - This is not interactive software.
|
75
76
|
|
76
|
-
= Options I may or may not support
|
77
|
-
|
78
|
-
* local/mount/xdev - This will probably not be added until I'm satisfied with
|
79
|
-
the sys-filesystem library. As of sys-filesystem 0.1.x, I'm not.
|
80
|
-
|
81
77
|
= Known Issues
|
82
78
|
The 'perm' option does not work on MS Windows, even for its limited subset of
|
83
79
|
permissions, i.e. 664 and 666. This is arguably a bug in Ruby's
|
@@ -100,12 +96,13 @@ http://www.rubyforge.org/projects/shards.
|
|
100
96
|
* Richard Clamp's File::Find::Rule Perl module for additional ideas and
|
101
97
|
inspiration.
|
102
98
|
* Bill Kleb for ideas regarding name, group and perm enhancements.
|
99
|
+
* Hal Fulton for his implementation of symbolic permissions.
|
103
100
|
|
104
101
|
= License
|
105
102
|
Ruby's
|
106
103
|
|
107
104
|
= Copyright
|
108
|
-
(C) 2007-
|
105
|
+
(C) 2007-2009, Daniel J. Berger, All Rights Reserved
|
109
106
|
|
110
107
|
= Author
|
111
108
|
Daniel J. Berger
|
data/lib/file/find.rb
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
class File::Find
|
13
13
|
# The version of this library
|
14
|
-
VERSION = '0.3.
|
14
|
+
VERSION = '0.3.2'
|
15
15
|
|
16
16
|
# :stopdoc:
|
17
17
|
VALID_OPTIONS = %w/
|
@@ -23,6 +23,7 @@ class File::Find
|
|
23
23
|
group
|
24
24
|
maxdepth
|
25
25
|
mindepth
|
26
|
+
mount
|
26
27
|
mtime
|
27
28
|
name
|
28
29
|
pattern
|
@@ -89,11 +90,16 @@ class File::Find
|
|
89
90
|
#
|
90
91
|
attr_accessor :maxdepth
|
91
92
|
|
92
|
-
# Limits
|
93
|
+
# Limits searches to a minimum depth into the tree relative to the starting
|
93
94
|
# search directory.
|
94
95
|
#
|
95
96
|
attr_accessor :mindepth
|
96
97
|
|
98
|
+
# Limits searches to the same filesystem as the specified directory. For
|
99
|
+
# Windows users, this refers to the volume.
|
100
|
+
#
|
101
|
+
attr_accessor :mount
|
102
|
+
|
97
103
|
# Limits searches by file modification time, where the value you supply is
|
98
104
|
# the number of days back from the time that the File::Find#find method was
|
99
105
|
# called.
|
@@ -166,6 +172,7 @@ class File::Find
|
|
166
172
|
@group = nil
|
167
173
|
@follow = true
|
168
174
|
@inum = nil
|
175
|
+
@mount = nil
|
169
176
|
@mtime = nil
|
170
177
|
@perm = nil
|
171
178
|
@prune = nil
|
@@ -179,6 +186,8 @@ class File::Find
|
|
179
186
|
|
180
187
|
validate_and_set_options(options) unless options.empty?
|
181
188
|
|
189
|
+
@filesystem = File.stat(@mount).dev if @mount
|
190
|
+
|
182
191
|
@path ||= Dir.pwd
|
183
192
|
@name ||= '*'
|
184
193
|
end
|
@@ -242,6 +251,10 @@ class File::Find
|
|
242
251
|
glob.tr!(File::ALT_SEPARATOR, File::SEPARATOR)
|
243
252
|
end
|
244
253
|
|
254
|
+
if @mount
|
255
|
+
next unless stat_info.dev == @filesystem
|
256
|
+
end
|
257
|
+
|
245
258
|
if @maxdepth || @mindepth
|
246
259
|
file_depth = file.split(File::SEPARATOR).length
|
247
260
|
path_depth = @path.split(File::SEPARATOR).length
|
data/test/test_file_find.rb
CHANGED
@@ -68,7 +68,7 @@ class TC_File_Find < Test::Unit::TestCase
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_version
|
71
|
-
assert_equal('0.3.
|
71
|
+
assert_equal('0.3.2', File::Find::VERSION)
|
72
72
|
end
|
73
73
|
|
74
74
|
def test_path
|
@@ -306,6 +306,12 @@ class TC_File_Find < Test::Unit::TestCase
|
|
306
306
|
assert_equal([], @rule2.find)
|
307
307
|
end
|
308
308
|
|
309
|
+
def test_mount_basic
|
310
|
+
assert_respond_to(@rule1, :mount)
|
311
|
+
assert_respond_to(@rule1, :mount=)
|
312
|
+
assert_nil(@rule1.mount)
|
313
|
+
end
|
314
|
+
|
309
315
|
def test_name_basic
|
310
316
|
assert_respond_to(@rule1, :name)
|
311
317
|
assert_respond_to(@rule1, :name=)
|
metadata
CHANGED
@@ -5,9 +5,9 @@ homepage: http://www.rubyforge.org/projects/shards
|
|
5
5
|
executables: []
|
6
6
|
|
7
7
|
version: !ruby/object:Gem::Version
|
8
|
-
version: 0.3.
|
8
|
+
version: 0.3.2
|
9
9
|
post_install_message:
|
10
|
-
date: 2009-
|
10
|
+
date: 2009-02-20 07:00:00 +00:00
|
11
11
|
files:
|
12
12
|
- lib/file
|
13
13
|
- lib/file/find.rb
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
- - '>='
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 2.0.2
|
58
|
-
description: A better way to find files
|
58
|
+
description: A better, object oriented way to find files
|
59
59
|
email: djberg96@gmail.com
|
60
60
|
authors:
|
61
61
|
- Daniel Berger
|