pathname2 1.7.2-universal-mingw32 → 1.7.3-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (9) hide show
  1. checksums.yaml +14 -6
  2. data/CHANGES +151 -148
  3. data/MANIFEST +38 -38
  4. data/README +98 -98
  5. data/lib/pathname2.rb +1140 -1140
  6. data/pathname2.gemspec +36 -36
  7. data/test/test_pathname.rb +484 -484
  8. data/test/test_version.rb +13 -13
  9. metadata +23 -25
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bbe8319d8e29a00a0c70582d56ee20c780a12f13
4
- data.tar.gz: ddf0f432a41cc14283c8892374ccd098df6b994d
5
- SHA512:
6
- metadata.gz: 394cfa240ec8f7061375c16fff4e2bfe62a7b04c264009ccda841c53f5b021691e4960e0326282e2310e12cd4afe45308e4cc4212ba4af2b04694bdd3fb838fa
7
- data.tar.gz: dcb6025358e5703130f86180cc638b4399830cffcf3f85f03c63aed880cf106b7050ed093c170b7c0e87299bd11154893b37f7d06c1aecabf1bc373dc782fe46
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzM0YjhkYjYwYjUxYTJhYjFhOWQyYWZiMmIzOGUwMTEzNjNjMDdkMg==
5
+ data.tar.gz: !binary |-
6
+ NjEyYWFhM2Q1YzRjYTI4MTA2Nzg5MjhmYTNhMDY4MmQzYzk0ZjI0ZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NTg4MTBiOTBjMmFjOWYxY2ZjMDkyZmQyOWI0NjUxZmE5NDdlMTJkYTAyYjc0
10
+ OTdjZGYyMDU1YzY2ZjliNjk3MmYxNDgxMWE2ZGIyNzI2YmE1ZjVkOTQ4YmI5
11
+ ODczNThhZjQyOGYxNDI3YWU3ZjM1YzQ5NjQ2MDg2OTY0MWUxYjQ=
12
+ data.tar.gz: !binary |-
13
+ ZDMxMGEzNjJhZTk3Y2U2OTdiYzM2NjEzY2FiOGM4YzMxMzU1ZTZhMjllZWI1
14
+ NmRmZGRiNWI0OTAwNDc2OGU1YjU2YzdjM2Y4YzMwOWU4MWI1MWNmMTYxZDgy
15
+ MWFhMGQ0ODllYzQ0ZTA1MGM2NDA0NWE4YTZjYjQ5MDAyZGM0MGI=
data/CHANGES CHANGED
@@ -1,148 +1,151 @@
1
- == 1.7.2 - 23-Apr-2014
2
- * The join and expand_path methods now return Pathname objects.
3
-
4
- == 1.7.1 - 28-Mar-2014
5
- * Updated gemspec for Windows vs Unix.
6
- * Updated README and MANIFEST.
7
-
8
- == 1.7.0 - 28-Mar-2014
9
- * Windows now uses FFI internally instead of win32-api.
10
- * Added a custom pretty_print method for the pp library.
11
- * Reorganized the test suite for Windows, and added many
12
- more test tasks to the Rakefile.
13
-
14
- == 1.6.5 - 19-Sep-2011
15
- * Added the String#to_path instance method. This returns a Pathname
16
- object.
17
- * The architecture for the Windows gem is now "universal", and some
18
- gemspec dependencies were simplified.
19
-
20
- == 1.6.4 - 20-Jan-2011
21
- * Explicitly remove the Pathname const if it is already defined in order
22
- to avoid a superclass mismatch error. This library assumes that if you
23
- require pathname2, you want my version of the Pathname class.
24
- * Updated URI handling for Ruby 1.9.x.
25
- * Added the Pathname() method, a synonym for Pathname.new.
26
- * Some Rakefile and gemspec tweaks.
27
- * Some updates to the test suite, including some specifically for Windows 7.
28
-
29
- == 1.6.3 - 2-Oct-2009
30
- * Updated Windows platform handling code to include mingw and cygwin.
31
- * Added the :gem rake task.
32
- * Minor gemspec updates.
33
- * Some minor test suite updates.
34
-
35
- == 1.6.2 - 4-Aug-2009
36
- * Now compatible with Ruby 1.9.x.
37
- * License changed to Artistic 2.0.
38
- * Added the Pathname.pwd method as a synonym for Pathname.new(Dir.pwd).
39
- * Modified Pathname#dirname so that you can specify a level that indicates
40
- how many levels up you want to retrieve. For example, if your path was
41
- '/usr/local/bin', then path.dirname(2) would return '/usr'.
42
- * Now compatible with Ruby 1.9.x.
43
- * Bumped required version of the facade library to 1.0.4.
44
-
45
- == 1.6.1 - 8-Nov-2008
46
- * Added the Pathname#[] method, which accepts an index, an index plus a
47
- length, or a range, and returns appropriate the path element(s).
48
- * Refactoring the platform checking in the test suite to use rbconfig instead
49
- of RUBY_PLATFORM.
50
- * More inline documentation examples.
51
-
52
- == 1.6.0 - 13-July-2008
53
- * The facade for ftools (and ftools itself) has been removed. The ftools
54
- library is deprecated in favor of FileUtils.
55
- * PathnameError is now Pathname::Error.
56
- * Bug fix for Pathname#relative_path_from for MS Windows. Thanks go to an
57
- anonymous user for the spot.
58
- * Fixed a bug where frozen strings would raise an error on MS Windows.
59
- * The code is now -w clean.
60
- * Removed the C version as part of the release because it was just too
61
- difficult to maintain both versions. The C code remains in CVS, however.
62
- * Changed platform checking to use rbconfig instead of RUBY_PLATFORM to avoid
63
- potential issues with other Ruby implementation.
64
-
65
- == 1.5.2 - 9-Mar-2007
66
- * Bug fix for the Pathname#realpath method where it was not handling recursive
67
- symlinks. The C version was also fixed, but it only affected platforms that
68
- don't have the realpath() function.
69
- * Added a test for recursive symlinks (for Solaris, anyway).
70
- * Updated the docs for Pathname#realpath.
71
- * Minor speed enhancements for the C version and the elimination of one
72
- (potential) segfault.
73
- * Added a 'Future Plans' section to the README.
74
- * Added a Rakefile. You can now build, clean, and test and install (both the
75
- pure Ruby and C versions).
76
-
77
- == 1.5.1 - 28-Aug-2006
78
- * Added the Kernel#pn method as a shortcut for Pathname.new.
79
- * The Pathname#readlink now properly handles symbolic links. The 'fix'
80
- from 1.4.4 did not work.
81
- * The C extension uses your system's realpath() function for the
82
- Pathname#readlink method if it has one.
83
- * Added the '/' alias for '+'. So, p1 / p2 is the same as p1 + p2.
84
- * The windows-pr package is now required on MS Windows.
85
-
86
- == 1.5.0 - 17-Apr-2006
87
- * Better subclass handling, in that some methods that previously returned
88
- hardcoded Pathname.new now return self.class.new.
89
- * File URL's are now handled on Unix as well (using the 'uri' package).
90
- * Some comment changes/clarifications.
91
- * Added the PathnameError class to the pure Ruby version.
92
-
93
- == 1.4.4 - 23-Mar-2006
94
- * If the path is a symbolic link the Pathname#realpath method
95
- now returns the absolute path of that link, i.e. the result
96
- of File.readlink (as a Pathname object).
97
-
98
- == 1.4.3 - 3-Mar-2006
99
- * Added the Pathname#realpath method.
100
-
101
- == 1.4.2 - 22-Feb-2006
102
- * Fixed the Pathname#relative_path_from method for Windows. This really only
103
- affected edge cases that you probably never saw anyway.
104
- * Added corresponding tests for Windows.
105
-
106
- == 1.4.1 - 18-Feb-2006
107
- * Added the Pathname#parent method.
108
- * Added the Pathname#relative_path_from method.
109
- * Bug fix for Pathname#pstrip on *nix.
110
- * Corresponding test suite additions.
111
-
112
- == 1.4.0 - 19-Dec-2005
113
- * Added destructive and non-destructive methods for some methods - pstrip,
114
- pstrip!, undecorate, undecorate!, clean and clean!.
115
- * Added a C extension version of this package. You can use the C version
116
- instead of the pure Ruby version instead. See the README for more details.
117
- * Fixed bug in the root method where the result wasn't guaranteed to be a
118
- Pathname class.
119
- * Fixed bugs in Windows version where the receiver was inadvertantly modified
120
- in some cases, and added tests to check for this in the future.
121
- * Modified the Dir.glob facade so that it (temporarily) changes to the path
122
- directory, globs on that path, then returns to the original directory.
123
- * Added the bench_pathname.rb script to let you benchmark all Pathname
124
- methods.
125
-
126
- == 1.3.1 - 21-Nov-2005
127
- * Added the Pathname#children method.
128
- * Added tests for the Pathname#children method.
129
-
130
- == 1.3.0 - 28-Oct-2005
131
- * Added the short_path and long_path methods for MS Windows.
132
- * Optimization for the '+' method on Unix.
133
- * Added some examples under the 'examples' directory.
134
- * More tests added and some minor changes to the test suite in general.
135
-
136
- == 1.2.1 - 1-Sep-2005
137
- * Bug fix for the ascend and descend methods wrt Windows and UNC paths.
138
- * More tests added for ascend and descend methods.
139
-
140
- == 1.2.0 - 29-Aug-2005
141
- * Added the 'ascend' and 'descend' methods.
142
- * Added corresponding test suite additions.
143
-
144
- == 1.1.0 - 13-Jul-2005
145
- * Added the 'find' facade.
146
-
147
- == 1.0.0 - 11-Jun-2005
148
- * Initial release
1
+ == 1.7.3 - 24-Apr-2014
2
+ * The basename and dirname methods now return Pathname objects.
3
+
4
+ == 1.7.2 - 23-Apr-2014
5
+ * The join and expand_path methods now return Pathname objects.
6
+
7
+ == 1.7.1 - 28-Mar-2014
8
+ * Updated gemspec for Windows vs Unix.
9
+ * Updated README and MANIFEST.
10
+
11
+ == 1.7.0 - 28-Mar-2014
12
+ * Windows now uses FFI internally instead of win32-api.
13
+ * Added a custom pretty_print method for the pp library.
14
+ * Reorganized the test suite for Windows, and added many
15
+ more test tasks to the Rakefile.
16
+
17
+ == 1.6.5 - 19-Sep-2011
18
+ * Added the String#to_path instance method. This returns a Pathname
19
+ object.
20
+ * The architecture for the Windows gem is now "universal", and some
21
+ gemspec dependencies were simplified.
22
+
23
+ == 1.6.4 - 20-Jan-2011
24
+ * Explicitly remove the Pathname const if it is already defined in order
25
+ to avoid a superclass mismatch error. This library assumes that if you
26
+ require pathname2, you want my version of the Pathname class.
27
+ * Updated URI handling for Ruby 1.9.x.
28
+ * Added the Pathname() method, a synonym for Pathname.new.
29
+ * Some Rakefile and gemspec tweaks.
30
+ * Some updates to the test suite, including some specifically for Windows 7.
31
+
32
+ == 1.6.3 - 2-Oct-2009
33
+ * Updated Windows platform handling code to include mingw and cygwin.
34
+ * Added the :gem rake task.
35
+ * Minor gemspec updates.
36
+ * Some minor test suite updates.
37
+
38
+ == 1.6.2 - 4-Aug-2009
39
+ * Now compatible with Ruby 1.9.x.
40
+ * License changed to Artistic 2.0.
41
+ * Added the Pathname.pwd method as a synonym for Pathname.new(Dir.pwd).
42
+ * Modified Pathname#dirname so that you can specify a level that indicates
43
+ how many levels up you want to retrieve. For example, if your path was
44
+ '/usr/local/bin', then path.dirname(2) would return '/usr'.
45
+ * Now compatible with Ruby 1.9.x.
46
+ * Bumped required version of the facade library to 1.0.4.
47
+
48
+ == 1.6.1 - 8-Nov-2008
49
+ * Added the Pathname#[] method, which accepts an index, an index plus a
50
+ length, or a range, and returns appropriate the path element(s).
51
+ * Refactoring the platform checking in the test suite to use rbconfig instead
52
+ of RUBY_PLATFORM.
53
+ * More inline documentation examples.
54
+
55
+ == 1.6.0 - 13-July-2008
56
+ * The facade for ftools (and ftools itself) has been removed. The ftools
57
+ library is deprecated in favor of FileUtils.
58
+ * PathnameError is now Pathname::Error.
59
+ * Bug fix for Pathname#relative_path_from for MS Windows. Thanks go to an
60
+ anonymous user for the spot.
61
+ * Fixed a bug where frozen strings would raise an error on MS Windows.
62
+ * The code is now -w clean.
63
+ * Removed the C version as part of the release because it was just too
64
+ difficult to maintain both versions. The C code remains in CVS, however.
65
+ * Changed platform checking to use rbconfig instead of RUBY_PLATFORM to avoid
66
+ potential issues with other Ruby implementation.
67
+
68
+ == 1.5.2 - 9-Mar-2007
69
+ * Bug fix for the Pathname#realpath method where it was not handling recursive
70
+ symlinks. The C version was also fixed, but it only affected platforms that
71
+ don't have the realpath() function.
72
+ * Added a test for recursive symlinks (for Solaris, anyway).
73
+ * Updated the docs for Pathname#realpath.
74
+ * Minor speed enhancements for the C version and the elimination of one
75
+ (potential) segfault.
76
+ * Added a 'Future Plans' section to the README.
77
+ * Added a Rakefile. You can now build, clean, and test and install (both the
78
+ pure Ruby and C versions).
79
+
80
+ == 1.5.1 - 28-Aug-2006
81
+ * Added the Kernel#pn method as a shortcut for Pathname.new.
82
+ * The Pathname#readlink now properly handles symbolic links. The 'fix'
83
+ from 1.4.4 did not work.
84
+ * The C extension uses your system's realpath() function for the
85
+ Pathname#readlink method if it has one.
86
+ * Added the '/' alias for '+'. So, p1 / p2 is the same as p1 + p2.
87
+ * The windows-pr package is now required on MS Windows.
88
+
89
+ == 1.5.0 - 17-Apr-2006
90
+ * Better subclass handling, in that some methods that previously returned
91
+ hardcoded Pathname.new now return self.class.new.
92
+ * File URL's are now handled on Unix as well (using the 'uri' package).
93
+ * Some comment changes/clarifications.
94
+ * Added the PathnameError class to the pure Ruby version.
95
+
96
+ == 1.4.4 - 23-Mar-2006
97
+ * If the path is a symbolic link the Pathname#realpath method
98
+ now returns the absolute path of that link, i.e. the result
99
+ of File.readlink (as a Pathname object).
100
+
101
+ == 1.4.3 - 3-Mar-2006
102
+ * Added the Pathname#realpath method.
103
+
104
+ == 1.4.2 - 22-Feb-2006
105
+ * Fixed the Pathname#relative_path_from method for Windows. This really only
106
+ affected edge cases that you probably never saw anyway.
107
+ * Added corresponding tests for Windows.
108
+
109
+ == 1.4.1 - 18-Feb-2006
110
+ * Added the Pathname#parent method.
111
+ * Added the Pathname#relative_path_from method.
112
+ * Bug fix for Pathname#pstrip on *nix.
113
+ * Corresponding test suite additions.
114
+
115
+ == 1.4.0 - 19-Dec-2005
116
+ * Added destructive and non-destructive methods for some methods - pstrip,
117
+ pstrip!, undecorate, undecorate!, clean and clean!.
118
+ * Added a C extension version of this package. You can use the C version
119
+ instead of the pure Ruby version instead. See the README for more details.
120
+ * Fixed bug in the root method where the result wasn't guaranteed to be a
121
+ Pathname class.
122
+ * Fixed bugs in Windows version where the receiver was inadvertantly modified
123
+ in some cases, and added tests to check for this in the future.
124
+ * Modified the Dir.glob facade so that it (temporarily) changes to the path
125
+ directory, globs on that path, then returns to the original directory.
126
+ * Added the bench_pathname.rb script to let you benchmark all Pathname
127
+ methods.
128
+
129
+ == 1.3.1 - 21-Nov-2005
130
+ * Added the Pathname#children method.
131
+ * Added tests for the Pathname#children method.
132
+
133
+ == 1.3.0 - 28-Oct-2005
134
+ * Added the short_path and long_path methods for MS Windows.
135
+ * Optimization for the '+' method on Unix.
136
+ * Added some examples under the 'examples' directory.
137
+ * More tests added and some minor changes to the test suite in general.
138
+
139
+ == 1.2.1 - 1-Sep-2005
140
+ * Bug fix for the ascend and descend methods wrt Windows and UNC paths.
141
+ * More tests added for ascend and descend methods.
142
+
143
+ == 1.2.0 - 29-Aug-2005
144
+ * Added the 'ascend' and 'descend' methods.
145
+ * Added corresponding test suite additions.
146
+
147
+ == 1.1.0 - 13-Jul-2005
148
+ * Added the 'find' facade.
149
+
150
+ == 1.0.0 - 11-Jun-2005
151
+ * Initial release
data/MANIFEST CHANGED
@@ -1,38 +1,38 @@
1
- * CHANGES
2
- * MANIFEST
3
- * Rakefile
4
- * README
5
- * pathname2.gempsec
6
- * benchmarks/bench_all.rb
7
- * benchmarks/bench_plus.rb
8
- * examples/example_pathname.rb
9
- * lib/pathname2.rb
10
- * test/test_pathname.rb
11
- * test/test_version.rb
12
- * test/windows/test_append.rb
13
- * test/windows/test_aref.rb
14
- * test/windows/test_ascend.rb
15
- * test/windows/test_children.rb
16
- * test/windows/test_clean.rb
17
- * test/windows/test_clean_bang.rb
18
- * test/windows/test_constructor.rb
19
- * test/windows/test_descend.rb
20
- * test/windows/test_drive_number.rb
21
- * test/windows/test_each.rb
22
- * test/windows/test_facade.rb
23
- * test/windows/test_is_absolute.rb
24
- * test/windows/test_is_relative.rb
25
- * test/windows/test_is_root.rb
26
- * test/windows/test_is_unc.rb
27
- * test/windows/test_long_path.rb
28
- * test/windows/test_misc.rb
29
- * test/windows/test_parent.rb
30
- * test/windows/test_pstrip.rb
31
- * test/windows/test_pstrip_bang.rb
32
- * test/windows/test_realpath.rb
33
- * test/windows/test_relative_path_from.rb
34
- * test/windows/test_root.rb
35
- * test/windows/test_short_path.rb
36
- * test/windows/test_to_a.rb
37
- * test/windows/test_undecorate.rb
38
- * test/windows/test_undecorate_bang.rb
1
+ * CHANGES
2
+ * MANIFEST
3
+ * Rakefile
4
+ * README
5
+ * pathname2.gempsec
6
+ * benchmarks/bench_all.rb
7
+ * benchmarks/bench_plus.rb
8
+ * examples/example_pathname.rb
9
+ * lib/pathname2.rb
10
+ * test/test_pathname.rb
11
+ * test/test_version.rb
12
+ * test/windows/test_append.rb
13
+ * test/windows/test_aref.rb
14
+ * test/windows/test_ascend.rb
15
+ * test/windows/test_children.rb
16
+ * test/windows/test_clean.rb
17
+ * test/windows/test_clean_bang.rb
18
+ * test/windows/test_constructor.rb
19
+ * test/windows/test_descend.rb
20
+ * test/windows/test_drive_number.rb
21
+ * test/windows/test_each.rb
22
+ * test/windows/test_facade.rb
23
+ * test/windows/test_is_absolute.rb
24
+ * test/windows/test_is_relative.rb
25
+ * test/windows/test_is_root.rb
26
+ * test/windows/test_is_unc.rb
27
+ * test/windows/test_long_path.rb
28
+ * test/windows/test_misc.rb
29
+ * test/windows/test_parent.rb
30
+ * test/windows/test_pstrip.rb
31
+ * test/windows/test_pstrip_bang.rb
32
+ * test/windows/test_realpath.rb
33
+ * test/windows/test_relative_path_from.rb
34
+ * test/windows/test_root.rb
35
+ * test/windows/test_short_path.rb
36
+ * test/windows/test_to_a.rb
37
+ * test/windows/test_undecorate.rb
38
+ * test/windows/test_undecorate_bang.rb
data/README CHANGED
@@ -1,98 +1,98 @@
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
- In Ruby 1.8.3 and 1.8.4 you will see a failure in the test suite regarding
76
- 'fu_world_writable?' from FileUtils. You can ignore this. That method is
77
- supposed to be private. See ruby-core:7383.
78
-
79
- Any other issues should be reported on the project page at
80
- https://github.com/djberg96/pathname2
81
-
82
- == Future Plans
83
- Suggestions welcome.
84
-
85
- == License
86
- Artistic 2.0
87
-
88
- == Copyright
89
- (C) 2003-2014 Daniel J. Berger
90
- All rights reserved.
91
-
92
- == Warranty
93
- This library is provided "as is" and without any express or
94
- implied warranties, including, without limitation, the implied
95
- warranties of merchantability and fitness for a particular purpose.
96
-
97
- == Author
98
- Daniel J. Berger
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
+ In Ruby 1.8.3 and 1.8.4 you will see a failure in the test suite regarding
76
+ 'fu_world_writable?' from FileUtils. You can ignore this. That method is
77
+ supposed to be private. See ruby-core:7383.
78
+
79
+ Any other issues should be reported on the project page at
80
+ https://github.com/djberg96/pathname2
81
+
82
+ == Future Plans
83
+ Suggestions welcome.
84
+
85
+ == License
86
+ Artistic 2.0
87
+
88
+ == Copyright
89
+ (C) 2003-2014 Daniel J. Berger
90
+ All rights reserved.
91
+
92
+ == Warranty
93
+ This library is provided "as is" and without any express or
94
+ implied warranties, including, without limitation, the implied
95
+ warranties of merchantability and fitness for a particular purpose.
96
+
97
+ == Author
98
+ Daniel J. Berger