README.adoc in runcom-10.0.1 vs README.adoc in runcom-10.1.0
- old
+ new
@@ -13,16 +13,16 @@
== Features
* Wraps the {xdg_link} implementation which provides access to
the following environment variables:
-** `$XDG_CACHE_HOME`
-** `$XDG_CONFIG_HOME`
-** `$XDG_CONFIG_DIRS`
-** `$XDG_DATA_HOME`
-** `$XDG_DATA_DIRS`
-** `$XDG_STATE_HOME`
+** `+$XDG_CACHE_HOME+`
+** `+$XDG_CONFIG_HOME+`
+** `+$XDG_CONFIG_DIRS+`
+** `+$XDG_DATA_HOME+`
+** `+$XDG_DATA_DIRS+`
+** `+$XDG_STATE_HOME+`
* Enhances the {xdg_link} cache, config, data, and state implementations.
== Requirements
. https://www.ruby-lang.org[Ruby]
@@ -78,22 +78,18 @@
💡 By default, each Runcom object expects a relative path but you can use a fully qualified path as well.
Each of the above objects share the same Object API:
* `#relative`: Answers the relative path from which the object was constructed.
-* `#namespace`: Answers the relative namespace as a pathname object from which the object was
- constructed. The namespace must be identical across the cache, config, and data objects as this is
- what uniquely identifies and organizes all files associated with your program.
+* `#namespace`: Answers the namespace as a pathname object from which the instance was constructed. The namespace must be unique and identical across the cache, config, data, and state objects since this is what identifies and organizes all files associated with your program.
* `#file_name`: Answers the file name from which the object was constructed.
-* `#active`: Answers first _existing_ file path as computed by `+$XDG_*_HOME+` followed by each
- computed `+$XDG_*_DIRS+` path in order defined. Otherwise, `nil` is answered back.
-* `#global`: Answers the first _existing_ or _non-existing_ global file path only.
-* `#local`: Answers the first _existing_ or _non-existing_ local file path only.
-* `#all`: Answers all file system paths which is the combined `$XDG_*_HOME` and
- `$XDG_*_DIRS` values in order defined. These paths _may_ or _may not_ exist on the file system.
-* `#inspect`: Answers a string representation of default XDG home and directory paths for debugging
- purposes.
+* `#active`: Answers first _existing file path_ as computed by `+$XDG_*_HOME+` followed by each computed `+$XDG_*_DIRS+` path in order defined. Otherwise, `nil` is answered back when no path exists.
+* `#passive`: Answers first path as computed by `+$XDG_*_HOME+` followed by each computed `+$XDG_*_DIRS+` path in order defined which _may_ or _may not_ exist. This behaves like `#active` but doesn't care if the path exists. Handy for situations where you'd like the active path but can fallback to creating the global path if otherwise.
+* `#global`: Answers the first _existing_ or _non-existing_ global path only.
+* `#local`: Answers the first _existing_ or _non-existing_ local path only.
+* `#all`: Answers all paths which is the combined `+$XDG_*_HOME+` and `+$XDG_*_DIRS+` values in order defined. These paths _may_ or _may not_ exist.
+* `#inspect`: Answers a string representation of default XDG home and directory paths for debugging purposes.
Using a `cache` object, for example, here is what each method answers back:
[source,ruby]
----
@@ -101,29 +97,30 @@
cache.relative # => #<Pathname:demo/content.json>
cache.namespace # #<Pathname:demo>
cache.file_name # #<Pathname:content.json>
cache.active # nil
+cache.passive # #<Pathname:/Users/demo/.cache/demo/content.json>
cache.global # #<Pathname:/Users/demo/.cache/demo/content.json>
cache.local # #<Pathname:/Users/demo/Engineering/OSS/runcom/.cache/demo/content.json>
cache.all # [#<Pathname:/Users/demo/Engineering/OSS/runcom/.cache/demo/content.json>, #<Pathname:/Users/demo/.cache/demo/content.json>]
cache.inspect # "XDG_CACHE_HOME=/Users/demo/Engineering/OSS/runcom/.cache:/Users/demo/.cache"
----
=== Variable Priority
Path precedence is determined in the following order (with the first taking highest priority):
-. *Local Configuration* - If a `$XDG_*_HOME` or `$XDG_*_DIRS` path relative to the
+. *Local Configuration* - If a `+$XDG_*_HOME+` or `+$XDG_*_DIRS+` path relative to the
current working directory is detected, it will take precedence over the global configuration.
This is the same behavior as found in Git where the local `.git/config` takes precedence over the
global `$HOME/.gitconfig`.
. *Global Configuration* - When a local configuration isn’t found, the global configuration is used
as defined by the _XDG Base Directory Specification_.
=== Building Blocks
-While {xdg_link} and Runcom are powerful in their own right, a great building block you can add on top of this gem is the {etcher_link} gem which loads, transforms, validates, and produces structured data from raw Runcom information. For more sophisticated applications, this synergetic coupling of `XDG -> Runcom -> Etcher` makes for nicely designed architectures.
+While {xdg_link} and Runcom are powerful in their own right, a great building block you can add on top of this gem is the {etcher_link} gem which loads, transforms, validates, and produces structured data from raw Runcom information. For more sophisticated applications, this synergetic coupling of `XDG + Runcom + Etcher` makes for nicely designed architectures.
=== Examples
Examples of gems built atop this gem are: