runcom 10.0.0 → 10.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8544b04b1234823a0f9edda9da1eceb5f33e945c5637d15261efa80be64d26f
4
- data.tar.gz: ffbb52ac4c8127aa6cb81234d290d65da71099c40b6f3e389856f0878c0e47df
3
+ metadata.gz: 63df1b5963a9b53c660b18679037d055384c3d484093725d46a671b52ea16f9b
4
+ data.tar.gz: e3d84a1e66bb4fb4277651ee0e42a17845b8c1ea632f293c09e5bee490d5c81b
5
5
  SHA512:
6
- metadata.gz: e0f75136a6d3a31858ae1d5876f3356e0a59b86915a3d9f982bc2465b0b14c3ce7ad6cd95473e7e3dad5f10918aa300398ef6e7d3eb72e04ab16a5a1184e283e
7
- data.tar.gz: 2cfe9cb8e86b10cb1f98fa66cb44477a07acd9e680fe3adcb49dd743a56b711c80669bab1756ee5b111acd1fd7fbeef2833d7e40c2ad6c98dcb14d2c0adf38f9
6
+ metadata.gz: 2d6eec9d50e87743748e62dbc3165b38b6b766e149ecd36b7e1619b401b82820688c7a4d5d81d48c004470f1e268e008b877675ead850286596f66b9334ebdf0
7
+ data.tar.gz: 7fdd92df8806c6bdfa6a91a553e8b85153ae9eb0d0108266856e755adc59522569a7f8e2b4b7d5a23cb44fa99934c21f946fdea44e93bfe41b6d9a7a66af5145
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -15,12 +15,12 @@ toc::[]
15
15
 
16
16
  * Wraps the {xdg_link} implementation which provides access to
17
17
  the following environment variables:
18
- ** `$XDG_CACHE_HOME`
19
- ** `$XDG_CONFIG_HOME`
20
- ** `$XDG_CONFIG_DIRS`
21
- ** `$XDG_DATA_HOME`
22
- ** `$XDG_DATA_DIRS`
23
- ** `$XDG_STATE_HOME`
18
+ ** `+$XDG_CACHE_HOME+`
19
+ ** `+$XDG_CONFIG_HOME+`
20
+ ** `+$XDG_CONFIG_DIRS+`
21
+ ** `+$XDG_DATA_HOME+`
22
+ ** `+$XDG_DATA_DIRS+`
23
+ ** `+$XDG_STATE_HOME+`
24
24
  * Enhances the {xdg_link} cache, config, data, and state implementations.
25
25
 
26
26
  == Requirements
@@ -80,18 +80,14 @@ state = Runcom::State.new "demo/history.log"
80
80
  Each of the above objects share the same Object API:
81
81
 
82
82
  * `#relative`: Answers the relative path from which the object was constructed.
83
- * `#namespace`: Answers the relative namespace as a pathname object from which the object was
84
- constructed. The namespace must be identical across the cache, config, and data objects as this is
85
- what uniquely identifies and organizes all files associated with your program.
83
+ * `#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.
86
84
  * `#file_name`: Answers the file name from which the object was constructed.
87
- * `#active`: Answers first _existing_ file path as computed by `+$XDG_*_HOME+` followed by each
88
- computed `+$XDG_*_DIRS+` path in order defined. Otherwise, `nil` is answered back.
89
- * `#global`: Answers the first _existing_ or _non-existing_ global file path only.
90
- * `#local`: Answers the first _existing_ or _non-existing_ local file path only.
91
- * `#all`: Answers all file system paths which is the combined `$XDG_*_HOME` and
92
- `$XDG_*_DIRS` values in order defined. These paths _may_ or _may not_ exist on the file system.
93
- * `#inspect`: Answers a string representation of default XDG home and directory paths for debugging
94
- purposes.
85
+ * `#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.
86
+ * `#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.
87
+ * `#global`: Answers the first _existing_ or _non-existing_ global path only.
88
+ * `#local`: Answers the first _existing_ or _non-existing_ local path only.
89
+ * `#all`: Answers all paths which is the combined `+$XDG_*_HOME+` and `+$XDG_*_DIRS+` values in order defined. These paths _may_ or _may not_ exist.
90
+ * `#inspect`: Answers a string representation of default XDG home and directory paths for debugging purposes.
95
91
 
96
92
  Using a `cache` object, for example, here is what each method answers back:
97
93
 
@@ -103,6 +99,7 @@ cache.relative # => #<Pathname:demo/content.json>
103
99
  cache.namespace # #<Pathname:demo>
104
100
  cache.file_name # #<Pathname:content.json>
105
101
  cache.active # nil
102
+ cache.passive # #<Pathname:/Users/demo/.cache/demo/content.json>
106
103
  cache.global # #<Pathname:/Users/demo/.cache/demo/content.json>
107
104
  cache.local # #<Pathname:/Users/demo/Engineering/OSS/runcom/.cache/demo/content.json>
108
105
  cache.all # [#<Pathname:/Users/demo/Engineering/OSS/runcom/.cache/demo/content.json>, #<Pathname:/Users/demo/.cache/demo/content.json>]
@@ -113,7 +110,7 @@ cache.inspect # "XDG_CACHE_HOME=/Users/demo/Engineering/OSS/runcom/.cache:/Us
113
110
 
114
111
  Path precedence is determined in the following order (with the first taking highest priority):
115
112
 
116
- . *Local Configuration* - If a `$XDG_*_HOME` or `$XDG_*_DIRS` path relative to the
113
+ . *Local Configuration* - If a `+$XDG_*_HOME+` or `+$XDG_*_DIRS+` path relative to the
117
114
  current working directory is detected, it will take precedence over the global configuration.
118
115
  This is the same behavior as found in Git where the local `.git/config` takes precedence over the
119
116
  global `$HOME/.gitconfig`.
@@ -122,7 +119,7 @@ Path precedence is determined in the following order (with the first taking high
122
119
 
123
120
  === Building Blocks
124
121
 
125
- 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.
122
+ 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.
126
123
 
127
124
  === Examples
128
125
 
data/lib/runcom/cache.rb CHANGED
@@ -9,7 +9,7 @@ module Runcom
9
9
 
10
10
  CONTEXT = Context.new xdg: XDG::Cache
11
11
 
12
- delegate %i[relative namespace file_name active global local all inspect] => :common
12
+ delegate %i[relative namespace file_name active passive global local all inspect] => :common
13
13
 
14
14
  def initialize path, context: CONTEXT
15
15
  @common = Paths::Common.new path, context:
data/lib/runcom/config.rb CHANGED
@@ -9,7 +9,7 @@ module Runcom
9
9
 
10
10
  CONTEXT = Context.new xdg: XDG::Config
11
11
 
12
- delegate %i[relative namespace file_name active global local all inspect] => :common
12
+ delegate %i[relative namespace file_name active passive global local all inspect] => :common
13
13
 
14
14
  def initialize path, context: CONTEXT
15
15
  @common = Paths::Common.new path, context:
data/lib/runcom/data.rb CHANGED
@@ -9,7 +9,7 @@ module Runcom
9
9
 
10
10
  CONTEXT = Context.new xdg: XDG::Data
11
11
 
12
- delegate %i[relative namespace file_name active global local all inspect] => :common
12
+ delegate %i[relative namespace file_name active passive global local all inspect] => :common
13
13
 
14
14
  def initialize path, context: CONTEXT
15
15
  @common = Paths::Common.new path, context:
@@ -26,6 +26,8 @@ module Runcom
26
26
 
27
27
  def active = all.select(&:file?).find(&:exist?)
28
28
 
29
+ def passive = active || global
30
+
29
31
  def global
30
32
  all.tap { |paths| paths.delete local }
31
33
  .first
data/lib/runcom/state.rb CHANGED
@@ -9,7 +9,7 @@ module Runcom
9
9
 
10
10
  CONTEXT = Context.new xdg: XDG::State
11
11
 
12
- delegate %i[relative namespace file_name active global local all inspect] => :common
12
+ delegate %i[relative namespace file_name active passive global local all inspect] => :common
13
13
 
14
14
  def initialize path, context: CONTEXT
15
15
  @common = Paths::Common.new path, context:
data/runcom.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "runcom"
5
- spec.version = "10.0.0"
5
+ spec.version = "10.1.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/runcom"
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runcom
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.0
4
+ version: 10.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -35,7 +35,7 @@ cert_chain:
35
35
  3n5C8/6Zh9DYTkpcwPSuIfAga6wf4nXc9m6JAw8AuMLaiWN/r/2s4zJsUHYERJEu
36
36
  gZGm4JqtuSg8pYjPeIJxS960owq+SfuC+jxqmRA54BisFCv/0VOJi7tiJVY=
37
37
  -----END CERTIFICATE-----
38
- date: 2023-06-13 00:00:00.000000000 Z
38
+ date: 2023-07-13 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: refinements
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.4.14
129
+ rubygems_version: 3.4.16
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: A XDG enhanced run command manager for command line interfaces.
metadata.gz.sig CHANGED
Binary file