libpath-ruby 0.2.2 → 0.2.2.2
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.
- checksums.yaml +4 -4
 - data/LICENSE +33 -0
 - data/README.md +25 -8
 - data/examples/path_from_arg0.md +43 -43
 - data/examples/path_from_arg0.rb +25 -23
 - data/lib/libpath/constants/unix.rb +74 -74
 - data/lib/libpath/constants/windows.rb +75 -75
 - data/lib/libpath/constants.rb +20 -20
 - data/lib/libpath/diagnostics/parameter_checking.rb +27 -26
 - data/lib/libpath/diagnostics.rb +1 -1
 - data/lib/libpath/exceptions/libpath_base_exception.rb +20 -21
 - data/lib/libpath/exceptions/malformed_name_exception.rb +27 -27
 - data/lib/libpath/exceptions.rb +1 -1
 - data/lib/libpath/form/unix.rb +118 -118
 - data/lib/libpath/form/windows.rb +228 -214
 - data/lib/libpath/form.rb +20 -21
 - data/lib/libpath/internal_/array.rb +57 -57
 - data/lib/libpath/internal_/platform.rb +30 -31
 - data/lib/libpath/internal_/string.rb +25 -20
 - data/lib/libpath/internal_/unix/form.rb +124 -119
 - data/lib/libpath/internal_/windows/drive.rb +80 -75
 - data/lib/libpath/internal_/windows/form.rb +205 -194
 - data/lib/libpath/libpath.rb +4 -1
 - data/lib/libpath/path/unix.rb +120 -118
 - data/lib/libpath/path/windows.rb +126 -124
 - data/lib/libpath/path.rb +21 -21
 - data/lib/libpath/util/unix.rb +261 -261
 - data/lib/libpath/util/windows.rb +403 -403
 - data/lib/libpath/util.rb +20 -20
 - data/lib/libpath/version.rb +25 -26
 - data/lib/libpath.rb +1 -1
 - data/test/performance/benchmark_drive_letter.rb +50 -10
 - data/test/performance/benchmark_gsub_string_or_regex.rb +27 -23
 - data/test/performance/benchmark_rindex2.rb +56 -48
 - data/test/performance/benchmark_split.rb +16 -10
 - data/test/unit/compare/ts_all.rb +4 -4
 - data/test/unit/equate/ts_all.rb +4 -4
 - data/test/unit/equate/unix/ts_all.rb +4 -4
 - data/test/unit/equate/windows/ts_all.rb +4 -4
 - data/test/unit/exceptions/tc_libpath_base_exception.rb +10 -8
 - data/test/unit/exceptions/tc_malformed_name_exception.rb +14 -12
 - data/test/unit/exceptions/ts_all.rb +4 -4
 - data/test/unit/form/tc_absolute_functions.rb +242 -240
 - data/test/unit/form/ts_all.rb +4 -4
 - data/test/unit/form/unix/tc_absolute_functions.rb +158 -155
 - data/test/unit/form/unix/ts_all.rb +4 -4
 - data/test/unit/form/windows/tc_absolute_functions.rb +628 -625
 - data/test/unit/form/windows/ts_all.rb +4 -4
 - data/test/unit/internal_/tc_array.rb +36 -32
 - data/test/unit/internal_/ts_all.rb +4 -4
 - data/test/unit/internal_/unix/form/tc_slash_functions.rb +38 -35
 - data/test/unit/internal_/unix/form/ts_all.rb +4 -4
 - data/test/unit/internal_/unix/tc_split_path.rb +387 -384
 - data/test/unit/internal_/unix/ts_all.rb +4 -4
 - data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +157 -153
 - data/test/unit/internal_/windows/form/tc_slash_functions.rb +39 -35
 - data/test/unit/internal_/windows/form/ts_all.rb +4 -4
 - data/test/unit/internal_/windows/tc_split_path.rb +874 -869
 - data/test/unit/internal_/windows/ts_all.rb +4 -4
 - data/test/unit/parse/ts_all.rb +4 -4
 - data/test/unit/path/tc_path.rb +732 -732
 - data/test/unit/path/ts_all.rb +4 -4
 - data/test/unit/path/unix/tc_path.rb +544 -540
 - data/test/unit/path/unix/ts_all.rb +4 -4
 - data/test/unit/path/windows/tc_path.rb +608 -603
 - data/test/unit/path/windows/ts_all.rb +4 -4
 - data/test/unit/tc_version.rb +25 -22
 - data/test/unit/ts_all.rb +4 -4
 - data/test/unit/util/tc_combine_paths.rb +110 -105
 - data/test/unit/util/tc_derive_relative_path.rb +8 -3
 - data/test/unit/util/tc_make_path_canonical.rb +142 -138
 - data/test/unit/util/ts_all.rb +4 -4
 - data/test/unit/util/unix/tc_combine_paths.rb +38 -34
 - data/test/unit/util/unix/tc_derive_relative_path.rb +80 -75
 - data/test/unit/util/unix/tc_make_path_absolute.rb +74 -70
 - data/test/unit/util/unix/tc_make_path_canonical.rb +95 -90
 - data/test/unit/util/unix/ts_all.rb +4 -4
 - data/test/unit/util/windows/tc_combine_paths.rb +82 -77
 - data/test/unit/util/windows/tc_derive_relative_path.rb +98 -93
 - data/test/unit/util/windows/tc_make_path_absolute.rb +105 -101
 - data/test/unit/util/windows/tc_make_path_canonical.rb +158 -153
 - data/test/unit/util/windows/ts_all.rb +4 -4
 - metadata +9 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d8d3cc14d04488f50a0709403ba13a04673f5436cf2193c329ca213d632098f1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 19d2d08adfe48b6461ec32a4e4b4d40dfd4eb6c4c3e8852f92926f2aad9c744c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e08138e7acbdf52e0d8e2ceac3bc3d71eb7b421cf79c92258a6091659f02e8ed9c23754549c15b51daf8ffbb229392aff47413d022a9c1bb02c1eb034e3aa90a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b7ce9f16572ee000607d5844bd6268b00744ea2739ff531ddcefb167a6b795756f18d0224680e2f127eb3fec8639c2085a4e5cbca149cebe77604a56b5497956
         
     | 
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            libpath.Ruby - BSD 3-Clause License
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
         
     | 
| 
      
 4 
     | 
    
         
            +
            Copyright (c) 2019, Matthew Wilson and Synesis Software
         
     | 
| 
      
 5 
     | 
    
         
            +
            All rights reserved.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Redistribution and use in source and binary forms, with or without
         
     | 
| 
      
 8 
     | 
    
         
            +
            modification, are permitted provided that the following conditions are
         
     | 
| 
      
 9 
     | 
    
         
            +
            met:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            1. Redistributions of source code must retain the above copyright notice,
         
     | 
| 
      
 12 
     | 
    
         
            +
               this list of conditions and the following disclaimer.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            2. Redistributions in binary form must reproduce the above copyright notice,
         
     | 
| 
      
 15 
     | 
    
         
            +
               this list of conditions and the following disclaimer in the documentation
         
     | 
| 
      
 16 
     | 
    
         
            +
               and/or other materials provided with the distribution.
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            3. Neither the name of the copyright holder nor the names of its
         
     | 
| 
      
 19 
     | 
    
         
            +
               contributors may be used to endorse or promote products derived from
         
     | 
| 
      
 20 
     | 
    
         
            +
               this software without specific prior written permission.
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         
     | 
| 
      
 23 
     | 
    
         
            +
            AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         
     | 
| 
      
 24 
     | 
    
         
            +
            IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
         
     | 
| 
      
 25 
     | 
    
         
            +
            ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
         
     | 
| 
      
 26 
     | 
    
         
            +
            LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
         
     | 
| 
      
 27 
     | 
    
         
            +
            CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
         
     | 
| 
      
 28 
     | 
    
         
            +
            SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
         
     | 
| 
      
 29 
     | 
    
         
            +
            INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
         
     | 
| 
      
 30 
     | 
    
         
            +
            CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
         
     | 
| 
      
 31 
     | 
    
         
            +
            ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
         
     | 
| 
      
 32 
     | 
    
         
            +
            POSSIBILITY OF SUCH DAMAGE.
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,26 +1,34 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # libpath.Ruby
         
     | 
| 
      
 1 
     | 
    
         
            +
            # libpath.Ruby <!-- omit in toc -->
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            **libpath**, for Ruby
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            [](https://badge.fury.io/rb/libpath-ruby)
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            ## Table of Contents
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Table of Contents <!-- omit in toc -->
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            - [Introduction](#introduction)
         
     | 
| 
      
 11 
     | 
    
         
            +
            - [Installation](#installation)
         
     | 
| 
      
 12 
     | 
    
         
            +
            - [Components](#components)
         
     | 
| 
      
 13 
     | 
    
         
            +
            - [Examples](#examples)
         
     | 
| 
      
 14 
     | 
    
         
            +
            - [Project Information](#project-information)
         
     | 
| 
      
 15 
     | 
    
         
            +
              - [Where to get help](#where-to-get-help)
         
     | 
| 
      
 16 
     | 
    
         
            +
              - [Contribution guidelines](#contribution-guidelines)
         
     | 
| 
      
 17 
     | 
    
         
            +
              - [Related projects](#related-projects)
         
     | 
| 
      
 18 
     | 
    
         
            +
              - [License](#license)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       13 
20 
     | 
    
         | 
| 
       14 
21 
     | 
    
         
             
            ## Introduction
         
     | 
| 
       15 
22 
     | 
    
         | 
| 
       16 
23 
     | 
    
         
             
            **libpath** is a path-parsing and utility library. It is concerned entirely with paths, as opposed to file-system entities.
         
     | 
| 
       17 
24 
     | 
    
         | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       18 
26 
     | 
    
         
             
            ## Installation
         
     | 
| 
       19 
27 
     | 
    
         | 
| 
       20 
28 
     | 
    
         
             
            Install via **gem** as in:
         
     | 
| 
       21 
29 
     | 
    
         | 
| 
       22 
30 
     | 
    
         
             
            ```
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
            gem install libpath-ruby
         
     | 
| 
       24 
32 
     | 
    
         
             
            ```
         
     | 
| 
       25 
33 
     | 
    
         | 
| 
       26 
34 
     | 
    
         
             
            or add it to your `Gemfile`.
         
     | 
| 
         @@ -35,27 +43,36 @@ require 'libpath' 
     | 
|
| 
       35 
43 
     | 
    
         | 
| 
       36 
44 
     | 
    
         
             
            T.B.C.
         
     | 
| 
       37 
45 
     | 
    
         | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       38 
47 
     | 
    
         
             
            ## Examples
         
     | 
| 
       39 
48 
     | 
    
         | 
| 
       40 
49 
     | 
    
         
             
            Examples are provided in the ```examples``` directory, along with a markdown description for each. A detailed list TOC of them is provided in [EXAMPLES.md](./EXAMPLES.md).
         
     | 
| 
       41 
50 
     | 
    
         | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       42 
52 
     | 
    
         
             
            ## Project Information
         
     | 
| 
       43 
53 
     | 
    
         | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       44 
55 
     | 
    
         
             
            ### Where to get help
         
     | 
| 
       45 
56 
     | 
    
         | 
| 
       46 
57 
     | 
    
         
             
            [GitHub Page](https://github.com/synesissoftware/libpath.Ruby "GitHub Page")
         
     | 
| 
       47 
58 
     | 
    
         | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
       48 
60 
     | 
    
         
             
            ### Contribution guidelines
         
     | 
| 
       49 
61 
     | 
    
         | 
| 
       50 
62 
     | 
    
         
             
            Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/libpath.Ruby.
         
     | 
| 
       51 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
       52 
65 
     | 
    
         
             
            ### Related projects
         
     | 
| 
       53 
66 
     | 
    
         | 
| 
       54 
67 
     | 
    
         
             
            **libpath.Ruby** is based on the [C/C++ libpath library](https://github.com/synesissoftware/libpath), which itself was prompted by a request on the [STLSoft](https://github.com/synesissoftware/STLSoft-1.10) project by my friend and esteemed programmer [Adi Shavit](https://github.com/adishavit).
         
     | 
| 
       55 
68 
     | 
    
         | 
| 
       56 
69 
     | 
    
         
             
            **libpath.Ruby** will be used in **version 3+** of the **[recls.Ruby](https://github.com/synesissoftware/recls.Ruby)** library, which currently has its own path-parsing logic.
         
     | 
| 
       57 
70 
     | 
    
         | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
       58 
72 
     | 
    
         
             
            ### License
         
     | 
| 
       59 
73 
     | 
    
         | 
| 
       60 
74 
     | 
    
         
             
            **libpath.Ruby** is released under the 3-clause BSD license. See LICENSE for details.
         
     | 
| 
       61 
75 
     | 
    
         | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            <!-- ########################### end of file ########################### -->
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
    
        data/examples/path_from_arg0.md
    CHANGED
    
    | 
         @@ -16,23 +16,23 @@ require 'libpath/path' 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            PATH_ATTRIBUTES = %i{
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
              given_path
         
     | 
| 
      
 20 
     | 
    
         
            +
              absolute_path
         
     | 
| 
      
 21 
     | 
    
         
            +
              compare_path
         
     | 
| 
      
 22 
     | 
    
         
            +
              directory
         
     | 
| 
      
 23 
     | 
    
         
            +
              directory_path
         
     | 
| 
      
 24 
     | 
    
         
            +
              dirname
         
     | 
| 
      
 25 
     | 
    
         
            +
              directory_parts
         
     | 
| 
      
 26 
     | 
    
         
            +
              file_full_name
         
     | 
| 
      
 27 
     | 
    
         
            +
              basename
         
     | 
| 
      
 28 
     | 
    
         
            +
              file_name_only
         
     | 
| 
      
 29 
     | 
    
         
            +
              stem
         
     | 
| 
      
 30 
     | 
    
         
            +
              file_extension
         
     | 
| 
      
 31 
     | 
    
         
            +
              extension
         
     | 
| 
      
 32 
     | 
    
         
            +
              search_directory
         
     | 
| 
      
 33 
     | 
    
         
            +
              search_relative_path
         
     | 
| 
      
 34 
     | 
    
         
            +
              search_relative_directory_path
         
     | 
| 
      
 35 
     | 
    
         
            +
              search_relative_directory_parts
         
     | 
| 
       36 
36 
     | 
    
         
             
            }
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         | 
| 
         @@ -49,16 +49,16 @@ puts 
     | 
|
| 
       49 
49 
     | 
    
         | 
| 
       50 
50 
     | 
    
         
             
            puts "\tall attributes:"
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
            max_name_len 
     | 
| 
       53 
     | 
    
         
            -
            max_type_len 
     | 
| 
      
 52 
     | 
    
         
            +
            max_name_len = PATH_ATTRIBUTES.map { |sym| sym.to_s.size }.max_by { |s| s }
         
     | 
| 
      
 53 
     | 
    
         
            +
            max_type_len = PATH_ATTRIBUTES.map { |sym| path.send(sym).class.to_s.size }.max_by { |s| s }
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
            PATH_ATTRIBUTES.each do |attr|
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
              name  = attr.to_s
         
     | 
| 
      
 58 
     | 
    
         
            +
              value = path.send(attr)
         
     | 
| 
      
 59 
     | 
    
         
            +
              type  = value.class
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
      
 61 
     | 
    
         
            +
              puts "\t\t#{name.to_s.rjust(max_name_len)} (#{type.to_s.rjust(max_type_len)}) : #{value}"
         
     | 
| 
       62 
62 
     | 
    
         
             
            end
         
     | 
| 
       63 
63 
     | 
    
         
             
            ```
         
     | 
| 
       64 
64 
     | 
    
         | 
| 
         @@ -75,25 +75,25 @@ The output is: 
     | 
|
| 
       75 
75 
     | 
    
         
             
            ```
         
     | 
| 
       76 
76 
     | 
    
         
             
            path obtained from '.gitignore' (with search directory '../../../CLASP/CLASP.Ruby/trunk'):
         
     | 
| 
       77 
77 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
      
 78 
     | 
    
         
            +
              path: /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/.gitignore
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
              all attributes:
         
     | 
| 
      
 81 
     | 
    
         
            +
                                    given_path (  String) : .gitignore
         
     | 
| 
      
 82 
     | 
    
         
            +
                                  absolute_path (  String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/.gitignore
         
     | 
| 
      
 83 
     | 
    
         
            +
                                  compare_path (  String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/.gitignore
         
     | 
| 
      
 84 
     | 
    
         
            +
                                      directory (  String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/
         
     | 
| 
      
 85 
     | 
    
         
            +
                                directory_path (  String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/
         
     | 
| 
      
 86 
     | 
    
         
            +
                                        dirname (  String) : /Users/matthewwilson/dev/freelibs/libpath/libpath.Ruby/trunk/
         
     | 
| 
      
 87 
     | 
    
         
            +
                                directory_parts (   Array) : ["/", "Users/", "matthewwilson/", "dev/", "freelibs/", "libpath/", "libpath.Ruby/", "trunk/"]
         
     | 
| 
      
 88 
     | 
    
         
            +
                                file_full_name (  String) : .gitignore
         
     | 
| 
      
 89 
     | 
    
         
            +
                                      basename (  String) : .gitignore
         
     | 
| 
      
 90 
     | 
    
         
            +
                                file_name_only (NilClass) :
         
     | 
| 
      
 91 
     | 
    
         
            +
                                          stem (NilClass) :
         
     | 
| 
      
 92 
     | 
    
         
            +
                                file_extension (  String) : .gitignore
         
     | 
| 
      
 93 
     | 
    
         
            +
                                      extension (  String) : .gitignore
         
     | 
| 
      
 94 
     | 
    
         
            +
                              search_directory (  String) : /Users/matthewwilson/dev/freelibs/CLASP/CLASP.Ruby/trunk/
         
     | 
| 
      
 95 
     | 
    
         
            +
                          search_relative_path (  String) : ../../../libpath/libpath.Ruby/trunk/.gitignore
         
     | 
| 
      
 96 
     | 
    
         
            +
                search_relative_directory_path (  String) : ../../../libpath/libpath.Ruby/trunk/
         
     | 
| 
      
 97 
     | 
    
         
            +
                search_relative_directory_parts (   Array) : ["../", "../", "../", "libpath/", "libpath.Ruby/", "trunk/"]
         
     | 
| 
       98 
98 
     | 
    
         
             
            ```
         
     | 
| 
       99 
99 
     | 
    
         | 
    
        data/examples/path_from_arg0.rb
    CHANGED
    
    | 
         @@ -7,23 +7,23 @@ require 'libpath/path' 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            PATH_ATTRIBUTES = %i{
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
              given_path
         
     | 
| 
      
 11 
     | 
    
         
            +
              absolute_path
         
     | 
| 
      
 12 
     | 
    
         
            +
              compare_path
         
     | 
| 
      
 13 
     | 
    
         
            +
              directory
         
     | 
| 
      
 14 
     | 
    
         
            +
              directory_path
         
     | 
| 
      
 15 
     | 
    
         
            +
              dirname
         
     | 
| 
      
 16 
     | 
    
         
            +
              directory_parts
         
     | 
| 
      
 17 
     | 
    
         
            +
              file_full_name
         
     | 
| 
      
 18 
     | 
    
         
            +
              basename
         
     | 
| 
      
 19 
     | 
    
         
            +
              file_name_only
         
     | 
| 
      
 20 
     | 
    
         
            +
              stem
         
     | 
| 
      
 21 
     | 
    
         
            +
              file_extension
         
     | 
| 
      
 22 
     | 
    
         
            +
              extension
         
     | 
| 
      
 23 
     | 
    
         
            +
              search_directory
         
     | 
| 
      
 24 
     | 
    
         
            +
              search_relative_path
         
     | 
| 
      
 25 
     | 
    
         
            +
              search_relative_directory_path
         
     | 
| 
      
 26 
     | 
    
         
            +
              search_relative_directory_parts
         
     | 
| 
       27 
27 
     | 
    
         
             
            }
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         | 
| 
         @@ -40,16 +40,18 @@ puts 
     | 
|
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
            puts "\tall attributes:"
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
            max_name_len 
     | 
| 
       44 
     | 
    
         
            -
            max_type_len 
     | 
| 
      
 43 
     | 
    
         
            +
            max_name_len = PATH_ATTRIBUTES.map { |sym| sym.to_s.size }.max_by { |s| s }
         
     | 
| 
      
 44 
     | 
    
         
            +
            max_type_len = PATH_ATTRIBUTES.map { |sym| path.send(sym).class.to_s.size }.max_by { |s| s }
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
            PATH_ATTRIBUTES.each do |attr|
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
              name  = attr.to_s
         
     | 
| 
      
 49 
     | 
    
         
            +
              value = path.send(attr)
         
     | 
| 
      
 50 
     | 
    
         
            +
              type  = value.class
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
              puts "\t\t#{name.to_s.rjust(max_name_len)} (#{type.to_s.rjust(max_type_len)}) : #{value}"
         
     | 
| 
       53 
53 
     | 
    
         
             
            end
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         | 
| 
      
 56 
     | 
    
         
            +
            # ############################## end of file ############################# #
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
         @@ -1,15 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # ######################################################################## #
         
     | 
| 
       2 
     | 
    
         
            -
            # File: 
     | 
| 
      
 2 
     | 
    
         
            +
            # File:     libpath/constants/unix.rb
         
     | 
| 
       3 
3 
     | 
    
         
             
            #
         
     | 
| 
       4 
     | 
    
         
            -
            # Purpose: 
     | 
| 
      
 4 
     | 
    
         
            +
            # Purpose:  LibPath::Constants::Unix module
         
     | 
| 
       5 
5 
     | 
    
         
             
            #
         
     | 
| 
       6 
     | 
    
         
            -
            # Created: 
     | 
| 
       7 
     | 
    
         
            -
            # Updated: 
     | 
| 
      
 6 
     | 
    
         
            +
            # Created:  29th January 2019
         
     | 
| 
      
 7 
     | 
    
         
            +
            # Updated:  7th April 2024
         
     | 
| 
       8 
8 
     | 
    
         
             
            #
         
     | 
| 
       9 
     | 
    
         
            -
            # Home: 
     | 
| 
      
 9 
     | 
    
         
            +
            # Home:     http://github.com/synesissoftware/libpath.Ruby
         
     | 
| 
       10 
10 
     | 
    
         
             
            #
         
     | 
| 
       11 
     | 
    
         
            -
            # Author: 
     | 
| 
      
 11 
     | 
    
         
            +
            # Author:   Matthew Wilson
         
     | 
| 
       12 
12 
     | 
    
         
             
            #
         
     | 
| 
      
 13 
     | 
    
         
            +
            # Copyright (c) 2019-2024, Matthew Wilson and Synesis Information Systems
         
     | 
| 
       13 
14 
     | 
    
         
             
            # Copyright (c) 2019, Matthew Wilson and Synesis Software
         
     | 
| 
       14 
15 
     | 
    
         
             
            # All rights reserved.
         
     | 
| 
       15 
16 
     | 
    
         
             
            #
         
     | 
| 
         @@ -43,104 +44,103 @@ 
     | 
|
| 
       43 
44 
     | 
    
         
             
            # ######################################################################## #
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
46 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
47 
     | 
    
         
             
            =begin
         
     | 
| 
       48 
48 
     | 
    
         
             
            =end
         
     | 
| 
       49 
49 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
            module LibPath 
     | 
| 
       51 
     | 
    
         
            -
            module Constants 
     | 
| 
       52 
     | 
    
         
            -
            module Unix 
     | 
| 
      
 50 
     | 
    
         
            +
            module LibPath
         
     | 
| 
      
 51 
     | 
    
         
            +
            module Constants
         
     | 
| 
      
 52 
     | 
    
         
            +
            module Unix
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
            # Module defining instance functions that will be included and extended into
         
     | 
| 
       55 
     | 
    
         
            -
            # any class or module including/extending module LibPath::Constants::Unix
         
     | 
| 
       56 
     | 
    
         
            -
            module LibPath_Constants_Unix_Methods
         
     | 
| 
      
 54 
     | 
    
         
            +
              # Module defining instance functions that will be included and extended into
         
     | 
| 
      
 55 
     | 
    
         
            +
              # any class or module including/extending module LibPath::Constants::Unix
         
     | 
| 
      
 56 
     | 
    
         
            +
              module LibPath_Constants_Unix_Methods
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
                # Defines invalid characters
         
     | 
| 
      
 59 
     | 
    
         
            +
                module InvalidCharacters
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 61 
     | 
    
         
            +
                  # Innately invalid characters
         
     | 
| 
      
 62 
     | 
    
         
            +
                  module Innate
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
      
 64 
     | 
    
         
            +
                    # The list of characters
         
     | 
| 
      
 65 
     | 
    
         
            +
                    LIST = [
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 67 
     | 
    
         
            +
                      "\0",
         
     | 
| 
      
 68 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 69 
     | 
    
         
            +
                    # The regular expression
         
     | 
| 
      
 70 
     | 
    
         
            +
                    RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end # module Innate
         
     | 
| 
       72 
72 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
                  # Valid path name separator characters
         
     | 
| 
      
 74 
     | 
    
         
            +
                  module PathNameSeparators
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
                    # The list of characters
         
     | 
| 
      
 77 
     | 
    
         
            +
                    LIST = [
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
      
 79 
     | 
    
         
            +
                      '/',
         
     | 
| 
      
 80 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 81 
     | 
    
         
            +
                    # The regular expression
         
     | 
| 
      
 82 
     | 
    
         
            +
                    RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end # module PathNameSeparators
         
     | 
| 
       84 
84 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 85 
     | 
    
         
            +
                  # Valid path separator characters
         
     | 
| 
      
 86 
     | 
    
         
            +
                  module PathSeparators
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
                    # The list of characters
         
     | 
| 
      
 89 
     | 
    
         
            +
                    LIST = [
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
      
 91 
     | 
    
         
            +
                      ':',
         
     | 
| 
      
 92 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 93 
     | 
    
         
            +
                    # The regular expression
         
     | 
| 
      
 94 
     | 
    
         
            +
                    RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
         
     | 
| 
      
 95 
     | 
    
         
            +
                  end # module PathSeparators
         
     | 
| 
       96 
96 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
      
 97 
     | 
    
         
            +
                  # Invalid shell characters
         
     | 
| 
      
 98 
     | 
    
         
            +
                  module Shell
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 100 
     | 
    
         
            +
                    # The list of characters
         
     | 
| 
      
 101 
     | 
    
         
            +
                    LIST = [
         
     | 
| 
       102 
102 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
            end # module LibPath_Constants_Unix_Methods
         
     | 
| 
      
 103 
     | 
    
         
            +
                      '*',
         
     | 
| 
      
 104 
     | 
    
         
            +
                      '<',
         
     | 
| 
      
 105 
     | 
    
         
            +
                      '>',
         
     | 
| 
      
 106 
     | 
    
         
            +
                      '?',
         
     | 
| 
      
 107 
     | 
    
         
            +
                      '|',
         
     | 
| 
      
 108 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 109 
     | 
    
         
            +
                    # The regular expression
         
     | 
| 
      
 110 
     | 
    
         
            +
                    RE = /[#{LIST.map { |m| Regexp.escape m }.join}]/
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end # module Shell
         
     | 
| 
      
 112 
     | 
    
         
            +
                end # module InvalidCharacters
         
     | 
| 
      
 113 
     | 
    
         
            +
              end # module LibPath_Constants_Unix_Methods
         
     | 
| 
       114 
114 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
            # @!visibility private
         
     | 
| 
       116 
     | 
    
         
            -
            def self.extended receiver # :nodoc:
         
     | 
| 
      
 115 
     | 
    
         
            +
              # @!visibility private
         
     | 
| 
      
 116 
     | 
    
         
            +
              def self.extended receiver # :nodoc:
         
     | 
| 
       117 
117 
     | 
    
         | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 118 
     | 
    
         
            +
                receiver.class_eval do
         
     | 
| 
       119 
119 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
      
 120 
     | 
    
         
            +
                  extend LibPath_Constants_Unix_Methods
         
     | 
| 
      
 121 
     | 
    
         
            +
                end
         
     | 
| 
       122 
122 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
            end
         
     | 
| 
      
 123 
     | 
    
         
            +
                $stderr.puts "#{receiver} extended by #{LibPath_Constants_Unix_Methods}" if $DEBUG
         
     | 
| 
      
 124 
     | 
    
         
            +
              end
         
     | 
| 
       125 
125 
     | 
    
         | 
| 
       126 
     | 
    
         
            -
            # @!visibility private
         
     | 
| 
       127 
     | 
    
         
            -
            def self.included receiver # :nodoc:
         
     | 
| 
      
 126 
     | 
    
         
            +
              # @!visibility private
         
     | 
| 
      
 127 
     | 
    
         
            +
              def self.included receiver # :nodoc:
         
     | 
| 
       128 
128 
     | 
    
         | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
                receiver.class_eval do
         
     | 
| 
       130 
130 
     | 
    
         | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
             
     | 
| 
      
 131 
     | 
    
         
            +
                  include LibPath_Constants_Unix_Methods
         
     | 
| 
      
 132 
     | 
    
         
            +
                end
         
     | 
| 
       133 
133 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
            end
         
     | 
| 
      
 134 
     | 
    
         
            +
                $stderr.puts "#{receiver} included #{LibPath_Constants_Unix_Methods}" if $DEBUG
         
     | 
| 
      
 135 
     | 
    
         
            +
              end
         
     | 
| 
       136 
136 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
            extend LibPath_Constants_Unix_Methods
         
     | 
| 
       138 
     | 
    
         
            -
            include LibPath_Constants_Unix_Methods
         
     | 
| 
      
 137 
     | 
    
         
            +
              extend LibPath_Constants_Unix_Methods
         
     | 
| 
      
 138 
     | 
    
         
            +
              include LibPath_Constants_Unix_Methods
         
     | 
| 
       139 
139 
     | 
    
         | 
| 
       140 
140 
     | 
    
         
             
            end # module Unix
         
     | 
| 
       141 
141 
     | 
    
         
             
            end # module Constants
         
     | 
| 
       142 
142 
     | 
    
         
             
            end # module LibPath
         
     | 
| 
       143 
143 
     | 
    
         | 
| 
       144 
     | 
    
         
            -
            # ############################## end of file ############################# #
         
     | 
| 
       145 
144 
     | 
    
         | 
| 
      
 145 
     | 
    
         
            +
            # ############################## end of file ############################# #
         
     | 
| 
       146 
146 
     | 
    
         |