file-find 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.md} +39 -19
- data/Gemfile +3 -0
- data/LICENSE +177 -0
- data/{MANIFEST → MANIFEST.md} +4 -2
- data/README.md +109 -0
- data/Rakefile +4 -6
- data/file-find.gemspec +13 -5
- data/lib/file/find.rb +9 -6
- data/spec/file_find_spec.rb +613 -0
- metadata +48 -30
- metadata.gz.sig +0 -0
- data/README +0 -96
- data/test/test_file_find.rb +0 -568
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6a005f38ff57e7ecba774576e6d8d8c005a386b50ec65197c4047cdd156d876
|
4
|
+
data.tar.gz: 50c000e4e15dd13bdab23fc396d0062ccc5392efd808036cc3df0a512f6ced50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09d5c030c2312a89f03c21a69578ab08d437890151f943f37ebcf27cd62d51fb42694f833605207afbf8c2e6aeb2a7d852f9373a6bc251b5336d0933b6a0f082'
|
7
|
+
data.tar.gz: c2c7b029ba2fdf2ea2760e84ee5600ef5fa1670922d01924773688854edb9a7e2eee6b32581c25861ff5095c984c53ec86ffa54e7f4b71a3fda73d7dca732a26
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{CHANGES → CHANGES.md}
RENAMED
@@ -1,16 +1,36 @@
|
|
1
|
-
|
1
|
+
## 0.5.0 - 19-Jan-2021
|
2
|
+
* Switched from test-unit to rspec, with an added development
|
3
|
+
dependency on the fakefs gem.
|
4
|
+
* Switched from rdoc to markdown because github doesn't render rdoc
|
5
|
+
properly any more.
|
6
|
+
* Fixed a bug in the maxdepth option with root paths.
|
7
|
+
* Added a Gemfile.
|
8
|
+
|
9
|
+
## 0.4.4 - 6-Aug-2020
|
10
|
+
* Added .rdoc extensions to the CHANGES, README and MANIFEST files.
|
11
|
+
|
12
|
+
## 0.4.3 - 8-Jun-2020
|
13
|
+
* Fixed a bug with ELOOP handling. Thanks go to joast for the spot and fix.
|
14
|
+
|
15
|
+
## 0.4.2 - 6-May-2020
|
16
|
+
* Added LICENSE file as required by the Apache-2.0 license.
|
17
|
+
|
18
|
+
## 0.4.1 - 23-Jan-2019
|
19
|
+
* Added metadata to the gemspec.
|
20
|
+
|
21
|
+
## 0.4.0 - 26-Dec-2018
|
2
22
|
* License changed to Apache-2.0.
|
3
23
|
* Fixed a bug where mindepth and maxdepth would break if more than one
|
4
24
|
path was specified as part of the rule. Thanks go to flagos for the spot.
|
5
25
|
* The VERSION constant is now frozen.
|
6
26
|
* The cert has been updated.
|
7
27
|
|
8
|
-
|
28
|
+
## 0.3.9 - 16-Dec-2015
|
9
29
|
* This gem is now signed.
|
10
30
|
* Added a file-find.rb file for convenience.
|
11
31
|
* Updates to the Rakefile and gemspec.
|
12
32
|
|
13
|
-
|
33
|
+
## 0.3.8 - 12-Feb-2014
|
14
34
|
* Removed all references to the Etc module since the sys-admin library now uses
|
15
35
|
FFI and works with JRuby.
|
16
36
|
* The :user, :group, and :inum options will now work on MS Windows if you have
|
@@ -20,27 +40,27 @@
|
|
20
40
|
* Some tests that were previously omitted on Windows are now included.
|
21
41
|
* Updates to the test suite, readme, etc.
|
22
42
|
|
23
|
-
|
43
|
+
## 0.3.7 - 15-Jan-2014
|
24
44
|
* Fixed a bug with brackets in the path name. Thanks go to Jeremy Lawler
|
25
45
|
for the spot and the patch.
|
26
46
|
|
27
|
-
|
47
|
+
## 0.3.6 - 6-Sep-2013
|
28
48
|
* Removed rbconfig from library and test file. Just use File::ALT_SEPARATOR
|
29
49
|
to check for Windows instead.
|
30
50
|
* Removed unused variables.
|
31
51
|
* Updated dev dependencies.
|
32
52
|
|
33
|
-
|
53
|
+
## 0.3.5 - 15-Jul-2011
|
34
54
|
* Fixed a bug with the :follow option.
|
35
55
|
* Gemspec, Rakefile and test cleanup.
|
36
56
|
|
37
|
-
|
57
|
+
## 0.3.4 - 19-Sep-2009
|
38
58
|
* Fixed a packaging bug. Thanks go to Gabriel Horner for the spot.
|
39
59
|
* Added the 'gem' task to the Rakefile for building the gem. Removed the
|
40
60
|
gem builder code that was in the gemspec itself.
|
41
61
|
* Updated the dependency for sys-admin to 1.5.2.
|
42
62
|
|
43
|
-
|
63
|
+
## 0.3.3 - 3-Aug-2009
|
44
64
|
* Now compatible with Ruby 1.9.x.
|
45
65
|
* Added support for the :links option
|
46
66
|
* Updated the :mount accessor to work properly if the value is changed
|
@@ -49,35 +69,35 @@
|
|
49
69
|
* Added a fuller description to the gemspec.
|
50
70
|
* Minor test refactoring.
|
51
71
|
|
52
|
-
|
72
|
+
## 0.3.2 - 20-Feb-2009
|
53
73
|
* Added support for the :mount option.
|
54
74
|
* Added some basic tests for the :mount option.
|
55
75
|
|
56
|
-
|
76
|
+
## 0.3.1 - 9-Jan-2009
|
57
77
|
* Now defaults to using Etc instead of Sys::Admin for implementations
|
58
78
|
that don't support building C extensions, e.g. JRuby.
|
59
79
|
* Updated the test suite to work with JRuby.
|
60
80
|
* Minor optimizations for symbolic perms and atime/ctime/mtime checks.
|
61
81
|
Thanks go in part to Ryan Davis' flay library.
|
62
82
|
|
63
|
-
|
83
|
+
## 0.3.0 - 30-Dec-2008
|
64
84
|
* Added support for FileTest operations. All options passed to the constructor
|
65
85
|
that end with '?' are now validated and treated as FileTest operations.
|
66
86
|
|
67
|
-
|
87
|
+
## 0.2.5 - 29-Dec-2008
|
68
88
|
* Added maxdepth and mindepth support.
|
69
89
|
* Added a 'clean' rake task to cleanup any test-unit results files.
|
70
90
|
|
71
|
-
|
91
|
+
## 0.2.4 - 10-Dec-2008
|
72
92
|
* Added support for symbolic permissions. Thanks go to Bill Kleb for the
|
73
93
|
suggestion and to Hal Fulton for providing the solution.
|
74
94
|
|
75
|
-
|
95
|
+
## 0.2.3 - 25-Nov-2008
|
76
96
|
* Added mtime support. My previous concerns, which I believe stemmed from
|
77
97
|
the find(2) man page on Solaris 10 with regards to atime checks modifying
|
78
98
|
the mtime, appear have been unfounded.
|
79
99
|
|
80
|
-
|
100
|
+
## 0.2.2 - 19-Nov-2008
|
81
101
|
* The :user and :group options now accept a name or a numeric id. Thanks go
|
82
102
|
to Bill Kleb for the suggestion.
|
83
103
|
* Fixed yet another path bug for MS Windows.
|
@@ -86,23 +106,23 @@
|
|
86
106
|
* Added sys-admin and test-unit as prerequisites.
|
87
107
|
* Added tests for the :user and :group options.
|
88
108
|
|
89
|
-
|
109
|
+
## 0.2.1 - 4-Oct-2007
|
90
110
|
* Added the File::Find#previous method, which lets you see the previous
|
91
111
|
match, if any.
|
92
112
|
* Path name bug fix for MS Windows.
|
93
113
|
* Test suite bug fixes for MS Windows (perm test now skipped).
|
94
114
|
* Inaccessible directories are now skipped instead of raising an error.
|
95
115
|
|
96
|
-
|
116
|
+
## 0.2.0 - 26-Apr-2007
|
97
117
|
* Fixed a bug where it was not traversing subdirectories.
|
98
118
|
* Added support for the perm and prune options.
|
99
119
|
|
100
|
-
|
120
|
+
## 0.1.1 - 25-Apr-2007
|
101
121
|
* The default for name is now '*', i.e. everything.
|
102
122
|
* Fixed a bug where directories were not matched. Thanks go to Leslie Viljoen
|
103
123
|
for the spot.
|
104
124
|
* The size option now accepts strings with comparable operators. For example,
|
105
125
|
you can now look for files greater than 400 bytes with the string "> 400".
|
106
126
|
|
107
|
-
|
127
|
+
## 0.1.0 - 24-Apr-2007
|
108
128
|
* Initial release
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/{MANIFEST → MANIFEST.md}
RENAMED
data/README.md
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
## Description
|
2
|
+
|
3
|
+
This is a drop-in replacement for the find module currently in the standard
|
4
|
+
library. It is modeled on a typical 'find' command found on most Unix systems.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
`gem install file-find`
|
9
|
+
|
10
|
+
## Synopsis
|
11
|
+
```ruby
|
12
|
+
require 'file/find' # 'file-find' also works
|
13
|
+
|
14
|
+
rule = File::Find.new(
|
15
|
+
:pattern => "*.rb",
|
16
|
+
:follow => false,
|
17
|
+
:path => ['/usr/local/lib', '/opt/local/lib']
|
18
|
+
)
|
19
|
+
|
20
|
+
rule.find{ |f|
|
21
|
+
puts f
|
22
|
+
}
|
23
|
+
```
|
24
|
+
|
25
|
+
## Rationale
|
26
|
+
|
27
|
+
The current find module in the standard library is inadequate. It is, quite
|
28
|
+
frankly, not much more than a plain Dir.glob call. This library provides an
|
29
|
+
interface based on options typically available on your command line 'find'
|
30
|
+
command, thus allowing you much greater control over how you find your files.
|
31
|
+
|
32
|
+
## Options
|
33
|
+
|
34
|
+
* atime
|
35
|
+
* ctime
|
36
|
+
* follow
|
37
|
+
* ftype
|
38
|
+
* inum
|
39
|
+
* group (name or id)
|
40
|
+
* maxdepth
|
41
|
+
* mindepth
|
42
|
+
* mount
|
43
|
+
* mtime
|
44
|
+
* name (or 'pattern')
|
45
|
+
* path
|
46
|
+
* perm
|
47
|
+
* prune
|
48
|
+
* size
|
49
|
+
* user (name or id)
|
50
|
+
|
51
|
+
In addition to the above options, `FileTest` methods such as `readable?` and
|
52
|
+
`writable?` may be used as keys, with true or false for their values.
|
53
|
+
|
54
|
+
See the documentation for more details about these options.
|
55
|
+
|
56
|
+
## Future Plans
|
57
|
+
|
58
|
+
None at this time. Please log any feature requests on the project page at:
|
59
|
+
|
60
|
+
http://github.com/djberg96/file-find
|
61
|
+
|
62
|
+
## Options I won't support
|
63
|
+
|
64
|
+
Generally speaking, anything that would require mucking around with C code
|
65
|
+
or is just too difficult to implement in a cross platform manner will not be
|
66
|
+
supported. These include the following options:
|
67
|
+
|
68
|
+
* acl/xattr - Way too difficult to implement in a cross platform manner, and
|
69
|
+
a rarely used option in practice.
|
70
|
+
|
71
|
+
* cpio/ncpio - I will not shell out to this or any other 3rd party
|
72
|
+
application.
|
73
|
+
|
74
|
+
* ls/print - Use Ruby's builtin printing methods to print as you see fit.
|
75
|
+
|
76
|
+
* ok - This is not interactive software.
|
77
|
+
|
78
|
+
## Known Issues
|
79
|
+
|
80
|
+
The `:perm` option is limited to 0644 and 0444 on MS Windows.
|
81
|
+
|
82
|
+
The `:user`, `:group`, and `:inum` options require the win32-file gem to work
|
83
|
+
properly on MS Windows. However, win32-file is not officially a dependency.
|
84
|
+
|
85
|
+
## Bugs
|
86
|
+
|
87
|
+
None that I'm aware of beyond the ones mentioned in the Known Issues. Please
|
88
|
+
log any bug reports on the project page at:
|
89
|
+
|
90
|
+
http://github.com/djberg96/file-find
|
91
|
+
|
92
|
+
## Acknowledgements
|
93
|
+
|
94
|
+
* Richard Clamp's File::Find::Rule Perl module for additional ideas and
|
95
|
+
inspiration.
|
96
|
+
* Bill Kleb for ideas regarding name, group and perm enhancements.
|
97
|
+
* Hal Fulton for his implementation of symbolic permissions.
|
98
|
+
|
99
|
+
## License
|
100
|
+
|
101
|
+
Apache-2.0
|
102
|
+
|
103
|
+
## Copyright
|
104
|
+
|
105
|
+
(C) 2007-2021, Daniel J. Berger, All Rights Reserved
|
106
|
+
|
107
|
+
## Author
|
108
|
+
|
109
|
+
Daniel J. Berger
|