runcom 13.2.0 → 13.3.0
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
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +84 -69
- data/lib/runcom/cache.rb +1 -1
- data/lib/runcom/config.rb +1 -1
- data/lib/runcom/data.rb +1 -1
- data/lib/runcom/paths/home.rb +2 -2
- data/lib/runcom/runtime.rb +25 -0
- data/lib/runcom/state.rb +1 -1
- data/runcom.gemspec +3 -3
- data.tar.gz.sig +0 -0
- metadata +7 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d717653804c9418425f0ae3f70d3c2ac383a6f2fce5bd04b985b0cf21cae914
|
|
4
|
+
data.tar.gz: 1fca7e257167ddcb6768e41d102c8d26218d27975440b61e3ec26896ac063be7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d6e95086a44d4fe72fbbbd7fada7846d2aa550e650bdb313d88f91ac23286cc70b6f4e3a9c6e57a6891662e27845d07f1bf50a496378c326977ffaecda0ff93
|
|
7
|
+
data.tar.gz: 8c22abcd79a9941392fa4f908e4f097136e422a32dd6fc1d85281e14ab245ff66c664247c2fd1c8868aedd79c36bdbc2b718aac3da73b8697366d5cef71e3afb
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.adoc
CHANGED
|
@@ -14,13 +14,14 @@ toc::[]
|
|
|
14
14
|
== Features
|
|
15
15
|
|
|
16
16
|
* Wraps the {xdg_link} implementation which provides access to the following environment variables:
|
|
17
|
-
**
|
|
18
|
-
**
|
|
19
|
-
**
|
|
20
|
-
**
|
|
21
|
-
**
|
|
22
|
-
**
|
|
23
|
-
|
|
17
|
+
** `XDG_CACHE_HOME`
|
|
18
|
+
** `XDG_CONFIG_HOME`
|
|
19
|
+
** `XDG_CONFIG_DIRS`
|
|
20
|
+
** `XDG_DATA_HOME`
|
|
21
|
+
** `XDG_DATA_DIRS`
|
|
22
|
+
** `XDG_RUNTIME_DIR`
|
|
23
|
+
** `XDG_STATE_HOME`
|
|
24
|
+
* Enhances the {xdg_link} cache, config, data, runtime, and state implementations with dynamic global and local detection.
|
|
24
25
|
|
|
25
26
|
== Requirements
|
|
26
27
|
|
|
@@ -68,9 +69,10 @@ While there isn’t a sole convenience object as found with the `XDG` gem, you c
|
|
|
68
69
|
|
|
69
70
|
[source,ruby]
|
|
70
71
|
----
|
|
71
|
-
cache = Runcom::Cache.new "demo/
|
|
72
|
+
cache = Runcom::Cache.new "demo/projects.json"
|
|
72
73
|
config = Runcom::Config.new "demo/configuration.yml"
|
|
73
|
-
data = Runcom::Data.new "demo/store
|
|
74
|
+
data = Runcom::Data.new "demo/vault.store"
|
|
75
|
+
runtime = Runcom::Runtime.new "demo/run"
|
|
74
76
|
state = Runcom::State.new "demo/history.log"
|
|
75
77
|
----
|
|
76
78
|
|
|
@@ -81,11 +83,11 @@ Each of the above objects share the same Object API:
|
|
|
81
83
|
* `#initial`: Answers the initial path -- which can be a relative or absolute path -- from which the object was constructed.
|
|
82
84
|
* `#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.
|
|
83
85
|
* `#file_name`: Answers the file name from which the object was constructed.
|
|
84
|
-
* `#active`: Answers first _existing file path_ as computed by
|
|
85
|
-
* `#passive`: Answers first path as computed by
|
|
86
|
+
* `#active`: Answers first _existing file path_ as computed by `+XDG_*_HOME+` followed by each computed `+XDG_*_DIR*+` path in order defined. Otherwise, `nil` is answered when no path exists.
|
|
87
|
+
* `#passive`: Answers first path as computed by `+XDG_*_HOME+` followed by each computed `+XDG_*_DIR*+` 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.
|
|
86
88
|
* `#global`: Answers the first _existing_ or _non-existing_ global path.
|
|
87
89
|
* `#local`: Answers the first _existing_ or _non-existing_ local path.
|
|
88
|
-
* `#all`: Answers all paths which is the combined
|
|
90
|
+
* `#all`: Answers all paths which is the combined `+XDG_*_HOME+` and `+XDG_*_DIR*+` values in order defined. These paths _may_ or _may not_ exist.
|
|
89
91
|
* `#to_s`: Answers an _explicit_ string cast for the current environment.
|
|
90
92
|
* `#to_str`: Answers an _implicit_ string cast for the current environment.
|
|
91
93
|
* `#inspect`: Answers object inspection complete with object type, object ID, and all environment variables.
|
|
@@ -98,74 +100,87 @@ The following are examples of what you will see when exploring the Runcom object
|
|
|
98
100
|
----
|
|
99
101
|
# Initialization
|
|
100
102
|
|
|
101
|
-
cache =
|
|
102
|
-
config =
|
|
103
|
-
data =
|
|
104
|
-
|
|
103
|
+
cache = Runcom::Cache.new "demo/projects.json"
|
|
104
|
+
config = Runcom::Config.new "demo/configuration.yml"
|
|
105
|
+
data = Runcom::Data.new "demo/vault.store"
|
|
106
|
+
runtime = Runcom::Runtime.new "demo/run"
|
|
107
|
+
state = Runcom::State.new "demo/history.log"
|
|
105
108
|
|
|
106
109
|
# Paths
|
|
107
110
|
|
|
108
|
-
cache.initial
|
|
109
|
-
cache.namespace
|
|
110
|
-
cache.file_name
|
|
111
|
-
cache.active
|
|
112
|
-
cache.passive
|
|
113
|
-
cache.global
|
|
114
|
-
cache.local
|
|
115
|
-
cache.all
|
|
116
|
-
|
|
117
|
-
config.initial
|
|
118
|
-
config.namespace
|
|
119
|
-
config.file_name
|
|
120
|
-
config.active
|
|
121
|
-
config.passive
|
|
122
|
-
config.global
|
|
123
|
-
config.local
|
|
124
|
-
config.all
|
|
125
|
-
|
|
126
|
-
data.initial
|
|
127
|
-
data.namespace
|
|
128
|
-
data.file_name
|
|
129
|
-
data.active
|
|
130
|
-
data.passive
|
|
131
|
-
data.global
|
|
132
|
-
data.local
|
|
133
|
-
data.all
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
#
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
state.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
111
|
+
cache.initial # "#<Pathname:demo/projects.json>"
|
|
112
|
+
cache.namespace # "#<Pathname:demo>"
|
|
113
|
+
cache.file_name # "#<Pathname:projects.json>"
|
|
114
|
+
cache.active # nil
|
|
115
|
+
cache.passive # "#<Pathname:/Users/demo/.cache/demo/projects.json>"
|
|
116
|
+
cache.global # "#<Pathname:/Users/demo/.cache/demo/projects.json>"
|
|
117
|
+
cache.local # "#<Pathname:/Users/demo/Engineering/OSS/runcom/.cache/demo/projects.json>"
|
|
118
|
+
cache.all # ["#<Pathname:/Users/demo/Engineering/OSS/runcom/.cache/demo/projects.json>", "#<Pathname:/Users/demo/.cache/demo/projects.json>"]
|
|
119
|
+
|
|
120
|
+
config.initial # "#<Pathname:demo/configuration.yml>"
|
|
121
|
+
config.namespace # "#<Pathname:demo>"
|
|
122
|
+
config.file_name # "#<Pathname:configuration.yml>"
|
|
123
|
+
config.active # nil
|
|
124
|
+
config.passive # "#<Pathname:/Users/demo/.config/demo/configuration.yml>"
|
|
125
|
+
config.global # "#<Pathname:/Users/demo/.config/demo/configuration.yml>"
|
|
126
|
+
config.local # "#<Pathname:/Users/demo/Engineering/OSS/runcom/.config/demo/configuration.yml>"
|
|
127
|
+
config.all # ["#<Pathname:/Users/demo/Engineering/OSS/runcom/.config/demo/configuration.yml>", "#<Pathname:/Users/demo/.config/demo/configuration.yml>", "#<Pathname:/etc/xdg/demo/configuration.yml>"]
|
|
128
|
+
|
|
129
|
+
data.initial # "#<Pathname:demo/vault.store>"
|
|
130
|
+
data.namespace # "#<Pathname:demo>"
|
|
131
|
+
data.file_name # "#<Pathname:vault.store>"
|
|
132
|
+
data.active # nil
|
|
133
|
+
data.passive # "#<Pathname:/Users/demo/.local/share/demo/vault.store>"
|
|
134
|
+
data.global # "#<Pathname:/Users/demo/.local/share/demo/vault.store>"
|
|
135
|
+
data.local # "#<Pathname:/Users/demo/Engineering/OSS/runcom/.local/share/demo/vault.store>"
|
|
136
|
+
data.all # ["#<Pathname:/Users/demo/Engineering/OSS/runcom/.local/share/demo/vault.store>", "#<Pathname:/Users/demo/.local/share/demo/vault.store>", "#<Pathname:/usr/local/share/demo/vault.store>", "#<Pathname:/usr/share/demo/vault.store>"]
|
|
137
|
+
|
|
138
|
+
runtime.initial # "#<Pathname:demo/run>"
|
|
139
|
+
runtime.namespace # "#<Pathname:demo>"
|
|
140
|
+
runtime.file_name # "#<Pathname:run>"
|
|
141
|
+
runtime.active # nil
|
|
142
|
+
runtime.passive # "#<Pathname:/Users/demo/demo/run>"
|
|
143
|
+
runtime.global # "#<Pathname:/Users/demo/demo/run>"
|
|
144
|
+
runtime.local # "#<Pathname:/Users/demo/Engineering/OSS/runcom/demo/run>"
|
|
145
|
+
runtime.all # ["#<Pathname:/Users/demo/Engineering/OSS/runcom/demo/run>", "#<Pathname:/Users/demo/demo/run>"]
|
|
146
|
+
|
|
147
|
+
state.initial # "#<Pathname:demo/history.log>"
|
|
148
|
+
state.namespace # "#<Pathname:demo>"
|
|
149
|
+
state.file_name # "#<Pathname:history.log>"
|
|
150
|
+
state.active # nil
|
|
151
|
+
state.passive # "#<Pathname:/Users/demo/.local/state/demo/history.log>"
|
|
152
|
+
state.global # "#<Pathname:/Users/demo/.local/state/demo/history.log>"
|
|
153
|
+
state.local # "#<Pathname:/Users/demo/Engineering/OSS/runcom/.local/state/demo/history.log>"
|
|
154
|
+
state.all # ["#<Pathname:/Users/demo/Engineering/OSS/runcom/.local/state/demo/history.log>", "#<Pathname:/Users/demo/.local/state/demo/history.log>"]
|
|
155
|
+
|
|
156
|
+
# Strings (explicit and implicit)
|
|
157
|
+
|
|
158
|
+
cache.to_s # "XDG_CACHE_HOME=/Users/demo/Engineering/OSS/runcom/.cache:/Users/demo/.cache"
|
|
159
|
+
config.to_s # "XDG_CONFIG_HOME=/Users/demo/Engineering/OSS/runcom/.config:/Users/demo/.config XDG_CONFIG_DIRS=/etc/xdg"
|
|
160
|
+
data.to_s # "XDG_DATA_HOME=/Users/demo/Engineering/OSS/runcom/.local/share:/Users/demo/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share"
|
|
161
|
+
runtime.to_s # "XDG_RUNTIME_DIR=/Users/demo/Engineering/OSS/runcom:/Users/demo"
|
|
162
|
+
state.to_s # "XDG_STATE_HOME=/Users/demo/Engineering/OSS/runcom/.local/state:/Users/demo/.local/state"
|
|
163
|
+
|
|
164
|
+
cache.to_str # "XDG_CACHE_HOME=/Users/demo/Engineering/OSS/runcom/.cache:/Users/demo/.cache"
|
|
165
|
+
config.to_str # "XDG_CONFIG_HOME=/Users/demo/Engineering/OSS/runcom/.config:/Users/demo/.config XDG_CONFIG_DIRS=/etc/xdg"
|
|
166
|
+
data.to_str # "XDG_DATA_HOME=/Users/demo/Engineering/OSS/runcom/.local/share:/Users/demo/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share"
|
|
167
|
+
runtime.to_str # "XDG_RUNTIME_DIR=/Users/demo/Engineering/OSS/runcom:/Users/demo"
|
|
168
|
+
state.to_str # "XDG_STATE_HOME=/Users/demo/Engineering/OSS/runcom/.local/state:/Users/demo/.local/state"
|
|
155
169
|
|
|
156
170
|
# Inspection
|
|
157
171
|
|
|
158
|
-
cache.inspect
|
|
159
|
-
config.inspect
|
|
160
|
-
data.inspect
|
|
161
|
-
|
|
172
|
+
cache.inspect # "#<Runcom::Cache:2040 XDG_CACHE_HOME=/Users/demo/Engineering/OSS/runcom/.cache:/Users/demo/.cache>"
|
|
173
|
+
config.inspect # "#<Runcom::Config:2060 XDG_CONFIG_HOME=/Users/demo/Engineering/OSS/runcom/.config:/Users/demo/.config XDG_CONFIG_DIRS=/etc/xdg>"
|
|
174
|
+
data.inspect # "#<Runcom::Data:2080 XDG_DATA_HOME=/Users/demo/Engineering/OSS/runcom/.local/share:/Users/demo/.local/share XDG_DATA_DIRS=/usr/local/share:/usr/share>"
|
|
175
|
+
runtime.inspect # "#<Runcom::Runtime:1096 XDG_RUNTIME_DIR=/Users/demo/Engineering/OSS/runcom:/Users/demo>"
|
|
176
|
+
state.inspect # "#<Runcom::State:2100 XDG_STATE_HOME=/Users/demo/Engineering/OSS/runcom/.local/state:/Users/demo/.local/state>"
|
|
162
177
|
----
|
|
163
178
|
|
|
164
179
|
=== Variable Priority
|
|
165
180
|
|
|
166
181
|
Path precedence is determined in the following order (with the first taking highest priority):
|
|
167
182
|
|
|
168
|
-
. *Local Configuration*: If a
|
|
183
|
+
. *Local Configuration*: If a `+XDG_*_HOME+` or `+XDG_*_DIR*+` path relative to the
|
|
169
184
|
current working directory is detected, it will take precedence over the global configuration.
|
|
170
185
|
This is the same behavior as found in Git where the local `.git/config` takes precedence over the
|
|
171
186
|
global `$HOME/.gitconfig`.
|
|
@@ -203,7 +218,7 @@ To contribute, run:
|
|
|
203
218
|
|
|
204
219
|
[source,bash]
|
|
205
220
|
----
|
|
206
|
-
git clone https://github.com/
|
|
221
|
+
git clone https://github.com/demo/runcom
|
|
207
222
|
cd runcom
|
|
208
223
|
bin/setup
|
|
209
224
|
----
|
data/lib/runcom/cache.rb
CHANGED
data/lib/runcom/config.rb
CHANGED
data/lib/runcom/data.rb
CHANGED
data/lib/runcom/paths/home.rb
CHANGED
|
@@ -10,8 +10,8 @@ module Runcom
|
|
|
10
10
|
|
|
11
11
|
delegate %i[key value default] => :standard
|
|
12
12
|
|
|
13
|
-
def initialize pair, environment = ENV
|
|
14
|
-
@standard =
|
|
13
|
+
def initialize pair, environment = ENV, path: XDG::Paths::Home
|
|
14
|
+
@standard = path.new pair, environment
|
|
15
15
|
freeze
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "forwardable"
|
|
4
|
+
|
|
5
|
+
module Runcom
|
|
6
|
+
# A developer friendly XDG runtime wrapper.
|
|
7
|
+
class Runtime
|
|
8
|
+
extend Forwardable
|
|
9
|
+
|
|
10
|
+
CONTEXT = Context.new xdg: XDG::Runtime
|
|
11
|
+
|
|
12
|
+
delegate %i[initial namespace file_name active passive global local all to_s to_str] => :common
|
|
13
|
+
|
|
14
|
+
def initialize path, context: CONTEXT
|
|
15
|
+
@common = Paths::Common.new(path, context:)
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def inspect = "#<#{self.class}:#{object_id} #{common}>"
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
attr_reader :common
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/runcom/state.rb
CHANGED
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 = "13.
|
|
5
|
+
spec.version = "13.3.0"
|
|
6
6
|
spec.authors = ["Brooke Kuhlmann"]
|
|
7
7
|
spec.email = ["brooke@alchemists.io"]
|
|
8
8
|
spec.homepage = "https://alchemists.io/projects/runcom"
|
|
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.required_ruby_version = ">= 4.0"
|
|
26
26
|
|
|
27
27
|
spec.add_dependency "refinements", "~> 14.0"
|
|
28
|
-
spec.add_dependency "xdg", "~> 10.
|
|
29
|
-
spec.add_dependency "zeitwerk", "~> 2.
|
|
28
|
+
spec.add_dependency "xdg", "~> 10.3"
|
|
29
|
+
spec.add_dependency "zeitwerk", "~> 2.8"
|
|
30
30
|
|
|
31
31
|
spec.files = Dir["*.gemspec", "lib/**/*"]
|
|
32
32
|
spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
|
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: 13.
|
|
4
|
+
version: 13.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
@@ -55,28 +55,28 @@ dependencies:
|
|
|
55
55
|
requirements:
|
|
56
56
|
- - "~>"
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
version: '10.
|
|
58
|
+
version: '10.3'
|
|
59
59
|
type: :runtime
|
|
60
60
|
prerelease: false
|
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
|
63
63
|
- - "~>"
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version: '10.
|
|
65
|
+
version: '10.3'
|
|
66
66
|
- !ruby/object:Gem::Dependency
|
|
67
67
|
name: zeitwerk
|
|
68
68
|
requirement: !ruby/object:Gem::Requirement
|
|
69
69
|
requirements:
|
|
70
70
|
- - "~>"
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: '2.
|
|
72
|
+
version: '2.8'
|
|
73
73
|
type: :runtime
|
|
74
74
|
prerelease: false
|
|
75
75
|
version_requirements: !ruby/object:Gem::Requirement
|
|
76
76
|
requirements:
|
|
77
77
|
- - "~>"
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version: '2.
|
|
79
|
+
version: '2.8'
|
|
80
80
|
email:
|
|
81
81
|
- brooke@alchemists.io
|
|
82
82
|
executables: []
|
|
@@ -94,6 +94,7 @@ files:
|
|
|
94
94
|
- lib/runcom/data.rb
|
|
95
95
|
- lib/runcom/paths/common.rb
|
|
96
96
|
- lib/runcom/paths/home.rb
|
|
97
|
+
- lib/runcom/runtime.rb
|
|
97
98
|
- lib/runcom/state.rb
|
|
98
99
|
- runcom.gemspec
|
|
99
100
|
homepage: https://alchemists.io/projects/runcom
|
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
121
122
|
- !ruby/object:Gem::Version
|
|
122
123
|
version: '0'
|
|
123
124
|
requirements: []
|
|
124
|
-
rubygems_version: 4.0.
|
|
125
|
+
rubygems_version: 4.0.15
|
|
125
126
|
specification_version: 4
|
|
126
127
|
summary: A XDG enhanced run command manager for command line interfaces.
|
|
127
128
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|