Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/ruby.yml
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@

#
# Created: 15th August 2026
# Updated: 15th August 2026
# Updated: 19th August 2026
#

name: Ruby
Expand DownExpand Up@@ -70,13 +70,20 @@ jobs:
uses: actions/checkout@v4

- name: Remove Gemfile.lock
shell: bash
run: rm -f Gemfile.lock

- name: Set up Ruby v${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
# Bundler 4 honours Gemfile `lockfile false`, so no Gemfile.lock
# is written. bundler-cache cats that file after `bundle lock`
# and fails on Windows 3.2+ (setup-ruby installs Bundler ~> 4).
bundler-cache: false

- name: Install gems
run: bundle install

- name: Show Ruby version
run: ruby -v
Expand All@@ -87,7 +94,7 @@ jobs:
- name: Gem build and install smoke
shell: bash
run: |
gem build libpath.gemspec
gem build libpath-ruby.gemspec
gem install --local libpath-ruby-*.gem
ruby -e "require 'libpath/version'; abort('VERSION missing') unless defined?(LibPath::VERSION); puts LibPath::VERSION"

Expand All@@ -102,13 +109,17 @@ jobs:
uses: actions/checkout@v4

- name: Remove Gemfile.lock
shell: bash
run: rm -f Gemfile.lock

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
ruby-version: '3.4'
bundler-cache: false

- name: Install gems
run: bundle install

- name: Show Ruby version
run: ruby -v
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
# directories (by name)

/.bzr/
/.bundle/
/.bzr/
/.config/
/.svn/
/.vscode/
/.yardoc/

/_build/
/_yardoc/

/InstalledFiles/
Expand All@@ -23,17 +25,22 @@
/tmp/
/vendor/bundle/


# directories (by pattern)


# files (by name)

.DS_Store
.repl_history
.ruby-version
.rvmrc

Gemfile.lock

/spec/examples.txt


# files (by pattern)

*~
Expand Down
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
# libpath.Ruby - Changes <!-- omit in toc -->


## 0.2.4 - 19th August 2026

* renamed **libpath.gemspec** to **libpath-ruby.gemspec** so the filename stem matches `spec.name`;
* **libpath-ruby.gemspec**: `required_ruby_version` is the range `>= 2.0`; **Gemfile.lock** and **.ruby-version** excluded from `spec.files`; `spec.summary` matches the README tagline; packaged **AUTHORS**, **CHANGES**, **CONTRIBUTING**, **EXAMPLES**, **FAQ**, **INSTALL**, **NEWS**, **SECURITY**, **TODO**;
* **Gemfile** sets `lockfile false` when Bundler supports it; stop tracking **Gemfile.lock**;
* CI uses `bundler-cache: false` and explicit `bundle install`; **Warnings** job on Ruby **3.4**; `gem build libpath-ruby.gemspec`;
* updated **run_all_unit_tests.sh** (from https://github.com/synesissoftware/misc-dev-scripts) to skip **tput** when **$TERM** is unset or stdout is not a TTY;
* library source **Home:** URLs now use `https`;
* **README.md**: tagline before badges; canonical badge row; **Dependencies** (Efferent / Afferent); related projects; License → `./LICENSE`;
* **EXAMPLES.md** example links are repo-relative (`./examples/…`);
* `elide_redundant_path_name_separators!` is freeze-safe (Ruby 3.4 `FrozenError` on a frozen remainder, e.g. malformed UNC);


## 0.2.3 - 15th August 2026

* added `# frozen_string_literal: true` to all **lib/** sources;
Expand Down
6 changes: 3 additions & 3 deletions EXAMPLES.md
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
# libpath.Ruby - Examples <!-- omit in toc -->

|Name | Source & Description | Summary|
|------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
|**path_from_arg0** | [examples/path_from_arg0.rb](/examples/path_from_arg0.rb)<br/>[examples/path_from_arg0.md](/examples/path_from_arg0.md) | Simple example illustrating creation of an instance of `LibPath::Path::ParsedPath`, and obtaining its attributes|
|Name|Source & Description|Summary|
|---|---|---|
|**path_from_arg0**|[examples/path_from_arg0.rb](./examples/path_from_arg0.rb)<br/>[examples/path_from_arg0.md](./examples/path_from_arg0.md)|Simple example illustrating creation of an instance of `LibPath::Path::ParsedPath`, and obtaining its attributes|


<!-- ########################### end of file ########################### -->
1 change: 0 additions & 1 deletion FAQ.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,5 +24,4 @@ gem install libpath-ruby
See [README.md](./README.md) for usage.



<!-- ########################### end of file ########################### -->
7 changes: 7 additions & 0 deletions Gemfile
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,13 @@

source "https://rubygems.org"

# Suppress lockfile on Bundler 4+ (gem: do not pin the graph). No-op on
# Bundler that lacks the DSL (Ruby 2.x CI). Do not combine with
# ruby/setup-ruby `bundler-cache: true` — that action cats Gemfile.lock
# after `bundle lock` and fails when no file is written (Windows 3.2+,
# where setup-ruby installs Bundler ~> 4).
lockfile false if respond_to?(:lockfile)

gemspec

# rake 13 requires Ruby >= 2.3
Expand Down
20 changes: 0 additions & 20 deletions Gemfile.lock

This file was deleted.

1 change: 1 addition & 0 deletions NEWS.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@

| Date | News Item |
| ----------------- | -------------------------------------------------------------------------------------------- |
| 19th August 2026 | [**libpath.Ruby** 0.2.4](https://github.com/synesissoftware/libpath.Ruby/releases/tag/0.2.4) |
| 15th August 2026 | [**libpath.Ruby** 0.2.3](https://github.com/synesissoftware/libpath.Ruby/releases/tag/0.2.3) |
| 13th April 2024 | [**libpath.Ruby** 0.2.2.3](https://github.com/synesissoftware/libpath.Ruby/releases/tag/0.2.2.3) |
| 7th April 2024 | **libpath.Ruby** 0.2.2.2 released |
Expand Down
62 changes: 57 additions & 5 deletions README.md
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
# libpath.Ruby <!-- omit in toc -->

**libpath**, for Ruby
Path parsing library, for Ruby

![Language](https://img.shields.io/badge/Ruby-CC342D?style=flat&logo=ruby&logoColor=white)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
[![Gem Version](https://badge.fury.io/rb/libpath-ruby.svg)](https://badge.fury.io/rb/libpath-ruby)
[![Last Commit](https://img.shields.io/github/last-commit/synesissoftware/libpath.Ruby)](https://github.com/synesissoftware/libpath.Ruby/commits/master)
[![Ruby](https://github.com/synesissoftware/libpath.Ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/synesissoftware/libpath.Ruby/actions/workflows/ruby.yml)


Expand All@@ -15,6 +18,13 @@
- [Project Information](#project-information)
- [Where to get help](#where-to-get-help)
- [Contribution guidelines](#contribution-guidelines)
- [Dependencies](#dependencies)
- [Efferent (fan-out)](#efferent-fan-out)
- [Runtime Dependencies (aka "Normal Dependencies")](#runtime-dependencies-aka-normal-dependencies)
- [Development Dependencies](#development-dependencies)
- [Afferent (fan-in)](#afferent-fan-in)
- [Runtime dependents](#runtime-dependents)
- [Development dependents](#development-dependents)
- [Related projects](#related-projects)
- [License](#license)

Expand All@@ -23,6 +33,8 @@

**libpath** is a path-parsing and utility library. It is concerned entirely with paths, as opposed to file-system entities.

The first **libpath** library was a C library with a C++ wrapper. There have been several implementations in other languages. **libpath.Ruby** is the Ruby version.


## Installation

Expand All@@ -40,6 +52,7 @@ Use via **require**, as in:
require 'libpath'
```


## Components

The main components of **libpath.Ruby** are:
Expand DownExpand Up@@ -71,17 +84,56 @@ Examples are provided in the ```examples``` directory, along with a markdown des
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/libpath.Ruby.


### Dependencies


#### Efferent (fan-out)

Libraries upon which **libpath.Ruby** depends:


##### Runtime Dependencies (aka "Normal Dependencies")

* \<none>;


##### Development Dependencies

* [**rake**](https://rubygems.org/gems/rake);
* [**test-unit**](https://rubygems.org/gems/test-unit);
* [**xqsr3**](https://github.com/synesissoftware/xqsr3);


#### Afferent (fan-in)

Projects that depend on **libpath.Ruby**:


##### Runtime dependents

* \<none>;

> **NOTE**: **[recls.Ruby](https://github.com/synesissoftware/recls.Ruby)** version 3+ is planned to depend on **libpath.Ruby** (it currently has its own path-parsing logic).


##### Development dependents

* \<none>;


### Related projects

**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).
* [**libpath**](https://github.com/synesissoftware/libpath) (**C**/**C++**);
* [**libpath.Go**](https://github.com/synesissoftware/libpath.Go);
* [**libpath.Python**](https://github.com/synesissoftware/libpath.Python);
* [**libpath.Rust**](https://github.com/synesissoftware/libpath.Rust);

**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.
**libpath.Ruby** is based on the C/C++ **libpath** library, 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).


### License

**libpath.Ruby** is released under the 3-clause BSD license. See LICENSE for details.
**libpath.Ruby** is released under the 3-clause BSD license. See [LICENSE](./LICENSE) for details.


<!-- ########################### end of file ########################### -->

11 changes: 9 additions & 2 deletions TODO.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@

## Functional improvements

* \<none>
* [ ] quiet Ruby 3.4+ `literal string will be frozen in the future` warnings from `gsub!` in **lib/libpath/internal_/windows/form.rb** (tests already pass under `-W`);


## Performance improvements
Expand All@@ -13,7 +13,14 @@

## Packaging improvements

* [ ] Rename gemspec so the filename stem matches `spec.name` (`libpath.gemspec` → **libpath-ruby.gemspec**);
* [x] ~~~rename gemspec so the filename stem matches `spec.name` (`libpath.gemspec` → **libpath-ruby.gemspec**)~~~;
* [x] ~~~obtain a **run_all_unit_tests.sh** (from **misc-dev-scripts**) that skips `tput` when `$TERM` is unset or stdout is not a TTY (CI: `tput: No value for $TERM and no -T specified`)~~~;
* [x] ~~~**Gemfile** `lockfile false`; stop tracking **Gemfile.lock**; CI `bundler-cache: false`~~~;
* [x] ~~~gemspec polish: README tagline as `spec.summary`, package docs, exclude **Gemfile.lock** / **.ruby-version**~~~;
* [x] ~~~README canonical structure (tagline before badges; **Dependencies**; CI badge → **ruby.yml**)~~~;
* [x] ~~~after the packaging/boilerplate/CI baseline: bump **VERSION** and align **CHANGES**/**NEWS**~~~;
* [ ] **git rm** **Gemfile.lock** when committing this lift (deleted in the work tree and gitignored; still in HEAD);
* [ ] this lift is on **bp-2**, which is not in CI `on.push.branches` (gold seven-name set); use a PR (unfiltered `pull_request:`) or merge to a listed branch to run push CI;


<!-- ########################### end of file ########################### -->
2 changes: 1 addition & 1 deletion lib/libpath/constants/unix.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 29th January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
2 changes: 1 addition & 1 deletion lib/libpath/constants/windows.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 29th January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
2 changes: 1 addition & 1 deletion lib/libpath/exceptions/libpath_base_exception.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 30th January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
2 changes: 1 addition & 1 deletion lib/libpath/exceptions/malformed_name_exception.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 30th January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
2 changes: 1 addition & 1 deletion lib/libpath/form/unix.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 8th January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
2 changes: 1 addition & 1 deletion lib/libpath/form/windows.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 8th January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
1 change: 1 addition & 0 deletions lib/libpath/internal_/unix/form.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,6 +75,7 @@ def self.elide_redundant_path_name_separators s # :nodoc:
# @!visibility private
def self.elide_redundant_path_name_separators! s # :nodoc:

s = s.dup if s.frozen?
s.gsub!(/\/\/+/, '/')

s
Expand Down
3 changes: 2 additions & 1 deletion lib/libpath/internal_/windows/form.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,7 @@ def self.elide_redundant_path_name_separators s # :nodoc:
# @!visibility private
def self.elide_redundant_path_name_separators! s # :nodoc:

s = s.dup if s.frozen?
s.gsub!(/[\\\/]{2,}/, '\\')

s
Expand DownExpand Up@@ -208,7 +209,7 @@ def self.split_path s # :nodoc:

f1_volume, rem, frm = self.get_windows_volume s

self.elide_redundant_path_name_separators! rem
rem = self.elide_redundant_path_name_separators! rem

f1_volume.define_singleton_method(:form) { frm } if f1_volume

Expand Down
2 changes: 1 addition & 1 deletion lib/libpath/path/unix.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
# Created: 21st January 2019
# Updated: 15th August 2026
#
# Home: http://github.com/synesissoftware/libpath.Ruby
# Home: https://github.com/synesissoftware/libpath.Ruby
#
# Author: Matthew Wilson
#
Expand Down
Loading
Loading