pathname2 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +5 -0
- data/CHANGES +171 -0
- data/LICENSE +177 -0
- data/MANIFEST +40 -0
- data/README +97 -0
- data/Rakefile +222 -0
- data/benchmarks/bench_pathname.rb +127 -0
- data/benchmarks/bench_plus.rb +34 -0
- data/certs/djberg96_pub.pem +26 -0
- data/examples/example_pathname.rb +25 -0
- data/lib/pathname2.rb +1140 -0
- data/pathname2.gemspec +46 -0
- data/test/test_pathname.rb +486 -0
- data/test/test_version.rb +17 -0
- data/test/windows/test_append.rb +59 -0
- data/test/windows/test_aref.rb +37 -0
- data/test/windows/test_ascend.rb +51 -0
- data/test/windows/test_children.rb +42 -0
- data/test/windows/test_clean.rb +50 -0
- data/test/windows/test_clean_bang.rb +50 -0
- data/test/windows/test_constructor.rb +48 -0
- data/test/windows/test_descend.rb +51 -0
- data/test/windows/test_drive_number.rb +58 -0
- data/test/windows/test_each.rb +28 -0
- data/test/windows/test_facade.rb +64 -0
- data/test/windows/test_is_absolute.rb +47 -0
- data/test/windows/test_is_relative.rb +46 -0
- data/test/windows/test_is_root.rb +44 -0
- data/test/windows/test_is_unc.rb +51 -0
- data/test/windows/test_join.rb +52 -0
- data/test/windows/test_long_path.rb +41 -0
- data/test/windows/test_misc.rb +33 -0
- data/test/windows/test_parent.rb +37 -0
- data/test/windows/test_pstrip.rb +42 -0
- data/test/windows/test_pstrip_bang.rb +46 -0
- data/test/windows/test_realpath.rb +39 -0
- data/test/windows/test_relative_path_from.rb +60 -0
- data/test/windows/test_root.rb +59 -0
- data/test/windows/test_short_path.rb +41 -0
- data/test/windows/test_to_a.rb +46 -0
- data/test/windows/test_undecorate.rb +47 -0
- data/test/windows/test_undecorate_bang.rb +53 -0
- metadata +176 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 657637a782220d1879e2afe644578c8dd731e994ac80ec66824782880baec049
|
4
|
+
data.tar.gz: 074c9b9c6784fc6c6130f702533e43397ae50492794ad9165f89efcfa8fe1d4d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9cb825cc9518667e377cef5a1b22929b8fb833074e885e6a43e5e2e7ee97fdc905404ab218c1cf907fae11a8c4e34ca49d89f1281eec71eb917d6576c367e52c
|
7
|
+
data.tar.gz: 4079e1f5e0d571a1080837fd54277f76eaa3928bcf6159df64901d00a0dff0abf8d2ab96e034fb857ad7cd1dddb0db0c88f7c02f370aefb6f097779b4ae6adf0
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
data/CHANGES
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
== 1.8.2 - 21-Jul-2020
|
2
|
+
* Added a LICENSE file as required by the Apache-2.0 license.
|
3
|
+
|
4
|
+
== 1.8.1 - 31-Jan-2019
|
5
|
+
* The VERSION constant is now frozen.
|
6
|
+
* Added metadata to the gemspec.
|
7
|
+
* Fixed missing hyphen in license name.
|
8
|
+
* Updated cert, should be good for about 10 years.
|
9
|
+
|
10
|
+
== 1.8.0 - 19-Jun-2016
|
11
|
+
* Changed license to Apache-2.0.
|
12
|
+
* Some cleanup and updates to the Rakefile and benchmarks.
|
13
|
+
* Refactored some realpath tests so they're not touching system files like
|
14
|
+
/dev/stdin any more. Thanks go to Michael R. Crusoe for pointing out the
|
15
|
+
potential pitfalls of doing that.
|
16
|
+
|
17
|
+
== 1.7.4 - 7-Sep-2015
|
18
|
+
* This gem is now signed.
|
19
|
+
* Rakefile now assumes Rubygems 2.x for some tasks.
|
20
|
+
|
21
|
+
== 1.7.3 - 24-Apr-2014
|
22
|
+
* The basename and dirname methods now return Pathname objects.
|
23
|
+
|
24
|
+
== 1.7.2 - 23-Apr-2014
|
25
|
+
* The join and expand_path methods now return Pathname objects.
|
26
|
+
|
27
|
+
== 1.7.1 - 28-Mar-2014
|
28
|
+
* Updated gemspec for Windows vs Unix.
|
29
|
+
* Updated README and MANIFEST.
|
30
|
+
|
31
|
+
== 1.7.0 - 28-Mar-2014
|
32
|
+
* Windows now uses FFI internally instead of win32-api.
|
33
|
+
* Added a custom pretty_print method for the pp library.
|
34
|
+
* Reorganized the test suite for Windows, and added many
|
35
|
+
more test tasks to the Rakefile.
|
36
|
+
|
37
|
+
== 1.6.5 - 19-Sep-2011
|
38
|
+
* Added the String#to_path instance method. This returns a Pathname
|
39
|
+
object.
|
40
|
+
* The architecture for the Windows gem is now "universal", and some
|
41
|
+
gemspec dependencies were simplified.
|
42
|
+
|
43
|
+
== 1.6.4 - 20-Jan-2011
|
44
|
+
* Explicitly remove the Pathname const if it is already defined in order
|
45
|
+
to avoid a superclass mismatch error. This library assumes that if you
|
46
|
+
require pathname2, you want my version of the Pathname class.
|
47
|
+
* Updated URI handling for Ruby 1.9.x.
|
48
|
+
* Added the Pathname() method, a synonym for Pathname.new.
|
49
|
+
* Some Rakefile and gemspec tweaks.
|
50
|
+
* Some updates to the test suite, including some specifically for Windows 7.
|
51
|
+
|
52
|
+
== 1.6.3 - 2-Oct-2009
|
53
|
+
* Updated Windows platform handling code to include mingw and cygwin.
|
54
|
+
* Added the :gem rake task.
|
55
|
+
* Minor gemspec updates.
|
56
|
+
* Some minor test suite updates.
|
57
|
+
|
58
|
+
== 1.6.2 - 4-Aug-2009
|
59
|
+
* Now compatible with Ruby 1.9.x.
|
60
|
+
* License changed to Artistic 2.0.
|
61
|
+
* Added the Pathname.pwd method as a synonym for Pathname.new(Dir.pwd).
|
62
|
+
* Modified Pathname#dirname so that you can specify a level that indicates
|
63
|
+
how many levels up you want to retrieve. For example, if your path was
|
64
|
+
'/usr/local/bin', then path.dirname(2) would return '/usr'.
|
65
|
+
* Now compatible with Ruby 1.9.x.
|
66
|
+
* Bumped required version of the facade library to 1.0.4.
|
67
|
+
|
68
|
+
== 1.6.1 - 8-Nov-2008
|
69
|
+
* Added the Pathname#[] method, which accepts an index, an index plus a
|
70
|
+
length, or a range, and returns appropriate the path element(s).
|
71
|
+
* Refactoring the platform checking in the test suite to use rbconfig instead
|
72
|
+
of RUBY_PLATFORM.
|
73
|
+
* More inline documentation examples.
|
74
|
+
|
75
|
+
== 1.6.0 - 13-July-2008
|
76
|
+
* The facade for ftools (and ftools itself) has been removed. The ftools
|
77
|
+
library is deprecated in favor of FileUtils.
|
78
|
+
* PathnameError is now Pathname::Error.
|
79
|
+
* Bug fix for Pathname#relative_path_from for MS Windows. Thanks go to an
|
80
|
+
anonymous user for the spot.
|
81
|
+
* Fixed a bug where frozen strings would raise an error on MS Windows.
|
82
|
+
* The code is now -w clean.
|
83
|
+
* Removed the C version as part of the release because it was just too
|
84
|
+
difficult to maintain both versions. The C code remains in CVS, however.
|
85
|
+
* Changed platform checking to use rbconfig instead of RUBY_PLATFORM to avoid
|
86
|
+
potential issues with other Ruby implementation.
|
87
|
+
|
88
|
+
== 1.5.2 - 9-Mar-2007
|
89
|
+
* Bug fix for the Pathname#realpath method where it was not handling recursive
|
90
|
+
symlinks. The C version was also fixed, but it only affected platforms that
|
91
|
+
don't have the realpath() function.
|
92
|
+
* Added a test for recursive symlinks (for Solaris, anyway).
|
93
|
+
* Updated the docs for Pathname#realpath.
|
94
|
+
* Minor speed enhancements for the C version and the elimination of one
|
95
|
+
(potential) segfault.
|
96
|
+
* Added a 'Future Plans' section to the README.
|
97
|
+
* Added a Rakefile. You can now build, clean, and test and install (both the
|
98
|
+
pure Ruby and C versions).
|
99
|
+
|
100
|
+
== 1.5.1 - 28-Aug-2006
|
101
|
+
* Added the Kernel#pn method as a shortcut for Pathname.new.
|
102
|
+
* The Pathname#readlink now properly handles symbolic links. The 'fix'
|
103
|
+
from 1.4.4 did not work.
|
104
|
+
* The C extension uses your system's realpath() function for the
|
105
|
+
Pathname#readlink method if it has one.
|
106
|
+
* Added the '/' alias for '+'. So, p1 / p2 is the same as p1 + p2.
|
107
|
+
* The windows-pr package is now required on MS Windows.
|
108
|
+
|
109
|
+
== 1.5.0 - 17-Apr-2006
|
110
|
+
* Better subclass handling, in that some methods that previously returned
|
111
|
+
hardcoded Pathname.new now return self.class.new.
|
112
|
+
* File URL's are now handled on Unix as well (using the 'uri' package).
|
113
|
+
* Some comment changes/clarifications.
|
114
|
+
* Added the PathnameError class to the pure Ruby version.
|
115
|
+
|
116
|
+
== 1.4.4 - 23-Mar-2006
|
117
|
+
* If the path is a symbolic link the Pathname#realpath method
|
118
|
+
now returns the absolute path of that link, i.e. the result
|
119
|
+
of File.readlink (as a Pathname object).
|
120
|
+
|
121
|
+
== 1.4.3 - 3-Mar-2006
|
122
|
+
* Added the Pathname#realpath method.
|
123
|
+
|
124
|
+
== 1.4.2 - 22-Feb-2006
|
125
|
+
* Fixed the Pathname#relative_path_from method for Windows. This really only
|
126
|
+
affected edge cases that you probably never saw anyway.
|
127
|
+
* Added corresponding tests for Windows.
|
128
|
+
|
129
|
+
== 1.4.1 - 18-Feb-2006
|
130
|
+
* Added the Pathname#parent method.
|
131
|
+
* Added the Pathname#relative_path_from method.
|
132
|
+
* Bug fix for Pathname#pstrip on *nix.
|
133
|
+
* Corresponding test suite additions.
|
134
|
+
|
135
|
+
== 1.4.0 - 19-Dec-2005
|
136
|
+
* Added destructive and non-destructive methods for some methods - pstrip,
|
137
|
+
pstrip!, undecorate, undecorate!, clean and clean!.
|
138
|
+
* Added a C extension version of this package. You can use the C version
|
139
|
+
instead of the pure Ruby version instead. See the README for more details.
|
140
|
+
* Fixed bug in the root method where the result wasn't guaranteed to be a
|
141
|
+
Pathname class.
|
142
|
+
* Fixed bugs in Windows version where the receiver was inadvertantly modified
|
143
|
+
in some cases, and added tests to check for this in the future.
|
144
|
+
* Modified the Dir.glob facade so that it (temporarily) changes to the path
|
145
|
+
directory, globs on that path, then returns to the original directory.
|
146
|
+
* Added the bench_pathname.rb script to let you benchmark all Pathname
|
147
|
+
methods.
|
148
|
+
|
149
|
+
== 1.3.1 - 21-Nov-2005
|
150
|
+
* Added the Pathname#children method.
|
151
|
+
* Added tests for the Pathname#children method.
|
152
|
+
|
153
|
+
== 1.3.0 - 28-Oct-2005
|
154
|
+
* Added the short_path and long_path methods for MS Windows.
|
155
|
+
* Optimization for the '+' method on Unix.
|
156
|
+
* Added some examples under the 'examples' directory.
|
157
|
+
* More tests added and some minor changes to the test suite in general.
|
158
|
+
|
159
|
+
== 1.2.1 - 1-Sep-2005
|
160
|
+
* Bug fix for the ascend and descend methods wrt Windows and UNC paths.
|
161
|
+
* More tests added for ascend and descend methods.
|
162
|
+
|
163
|
+
== 1.2.0 - 29-Aug-2005
|
164
|
+
* Added the 'ascend' and 'descend' methods.
|
165
|
+
* Added corresponding test suite additions.
|
166
|
+
|
167
|
+
== 1.1.0 - 13-Jul-2005
|
168
|
+
* Added the 'find' facade.
|
169
|
+
|
170
|
+
== 1.0.0 - 11-Jun-2005
|
171
|
+
* Initial release
|
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
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
* CHANGES
|
2
|
+
* LICENSE
|
3
|
+
* MANIFEST
|
4
|
+
* Rakefile
|
5
|
+
* README
|
6
|
+
* pathname2.gempsec
|
7
|
+
* benchmarks/bench_all.rb
|
8
|
+
* benchmarks/bench_plus.rb
|
9
|
+
* certs/djberg96_pub.pem
|
10
|
+
* examples/example_pathname.rb
|
11
|
+
* lib/pathname2.rb
|
12
|
+
* test/test_pathname.rb
|
13
|
+
* test/test_version.rb
|
14
|
+
* test/windows/test_append.rb
|
15
|
+
* test/windows/test_aref.rb
|
16
|
+
* test/windows/test_ascend.rb
|
17
|
+
* test/windows/test_children.rb
|
18
|
+
* test/windows/test_clean.rb
|
19
|
+
* test/windows/test_clean_bang.rb
|
20
|
+
* test/windows/test_constructor.rb
|
21
|
+
* test/windows/test_descend.rb
|
22
|
+
* test/windows/test_drive_number.rb
|
23
|
+
* test/windows/test_each.rb
|
24
|
+
* test/windows/test_facade.rb
|
25
|
+
* test/windows/test_is_absolute.rb
|
26
|
+
* test/windows/test_is_relative.rb
|
27
|
+
* test/windows/test_is_root.rb
|
28
|
+
* test/windows/test_is_unc.rb
|
29
|
+
* test/windows/test_long_path.rb
|
30
|
+
* test/windows/test_misc.rb
|
31
|
+
* test/windows/test_parent.rb
|
32
|
+
* test/windows/test_pstrip.rb
|
33
|
+
* test/windows/test_pstrip_bang.rb
|
34
|
+
* test/windows/test_realpath.rb
|
35
|
+
* test/windows/test_relative_path_from.rb
|
36
|
+
* test/windows/test_root.rb
|
37
|
+
* test/windows/test_short_path.rb
|
38
|
+
* test/windows/test_to_a.rb
|
39
|
+
* test/windows/test_undecorate.rb
|
40
|
+
* test/windows/test_undecorate_bang.rb
|
data/README
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
== Description
|
2
|
+
A drop-in replacement for the current Pathname class.
|
3
|
+
|
4
|
+
== Prerequisites
|
5
|
+
* facade
|
6
|
+
* ffi (Windows only)
|
7
|
+
* test-unit (testing only)
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
gem install pathname2
|
12
|
+
|
13
|
+
== Synopsis
|
14
|
+
require 'pathname2'
|
15
|
+
|
16
|
+
# Unix
|
17
|
+
path1 = Pathname.new("/foo/bar/baz")
|
18
|
+
path2 = Pathname.new("../zap")
|
19
|
+
|
20
|
+
path1 + path2 # "/foo/bar/zap"
|
21
|
+
path1 / path2 # "/foo/bar/zap" (same as +)
|
22
|
+
path1.exists? # Does this path exist?
|
23
|
+
path1.dirname # "/foo/bar"
|
24
|
+
path1.to_a # ['foo','bar','baz']
|
25
|
+
|
26
|
+
# Windows
|
27
|
+
path1 = Pathname.new("C:/foo/bar/baz")
|
28
|
+
path2 = Pathname.new("../zap")
|
29
|
+
|
30
|
+
path1 + path2 # "C:\\foo\\bar\\zap"
|
31
|
+
path1.root # "C:\\"
|
32
|
+
path1.to_a # ['C:','foo','bar','baz']
|
33
|
+
|
34
|
+
== Windows Notes
|
35
|
+
All forward slashes are converted to backslashes for Pathname objects.
|
36
|
+
|
37
|
+
== Differences between Unix and Windows
|
38
|
+
If your pathname consists solely of ".", or "..", the return
|
39
|
+
value for Pathname#clean will be different. On Win32, "\\" is returned,
|
40
|
+
while on Unix "." is returned. I consider this an extreme edge case and
|
41
|
+
will not worry myself with it.
|
42
|
+
|
43
|
+
== Differences between Pathname in the standard library and this version
|
44
|
+
* It is a subclass of String (and thus, mixes in Enumerable).
|
45
|
+
* It has sensical to_a and root instance methods.
|
46
|
+
* It works on Windows and Unix. The current implementation does not work
|
47
|
+
with Windows path names very well, and not at all when it comes to UNC
|
48
|
+
paths.
|
49
|
+
* The Pathname#cleanpath method works differently - it always returns
|
50
|
+
a canonical pathname. In addition, there is no special consideration
|
51
|
+
for symlinks (yet), though I'm not sure it warrants it.
|
52
|
+
* The Pathname#+ method auto cleans.
|
53
|
+
* It uses a facade for all File and Dir methods, as well as most FileUtils
|
54
|
+
methods.
|
55
|
+
* Pathname#clean works slightly differently. In the stdlib version,
|
56
|
+
Pathname#clean("../a") returns "../a". In this version, it returns "a".
|
57
|
+
This affects other methods, such as Pathname#relative_path_from.
|
58
|
+
* Accepts file urls and converts them to paths automatically, e.g.
|
59
|
+
file:///foo%20bar/baz becomes '/foo/bar/baz'.
|
60
|
+
* Adds a Kernel level +pn+ method as a shortcut.
|
61
|
+
* Allows you to add paths together with the '/' operator.
|
62
|
+
|
63
|
+
== Method Priority
|
64
|
+
Because there is some overlap in method names between File, Dir, and
|
65
|
+
FileUtils, the priority is as follows:
|
66
|
+
|
67
|
+
* File
|
68
|
+
* Dir
|
69
|
+
* FileUtils
|
70
|
+
|
71
|
+
In other words, whichever of these defines a given method first is the
|
72
|
+
method that is used by the pathname2 library.
|
73
|
+
|
74
|
+
== Known Issues
|
75
|
+
On MS Windows, some methods may not work on pathnames greater than 260
|
76
|
+
characters because of internal function limitations.
|
77
|
+
|
78
|
+
Any issues you find should be reported on the project page at
|
79
|
+
https://github.com/djberg96/pathname2
|
80
|
+
|
81
|
+
== Future Plans
|
82
|
+
Suggestions welcome.
|
83
|
+
|
84
|
+
== License
|
85
|
+
Apache-2.0
|
86
|
+
|
87
|
+
== Copyright
|
88
|
+
(C) 2003-2020 Daniel J. Berger
|
89
|
+
All rights reserved.
|
90
|
+
|
91
|
+
== Warranty
|
92
|
+
This library is provided "as is" and without any express or
|
93
|
+
implied warranties, including, without limitation, the implied
|
94
|
+
warranties of merchantability and fitness for a particular purpose.
|
95
|
+
|
96
|
+
== Author
|
97
|
+
Daniel J. Berger
|