runcom 5.1.1 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/runcom.rb +4 -2
- data/lib/runcom/cache.rb +8 -17
- data/lib/runcom/config.rb +11 -25
- data/lib/runcom/context.rb +14 -0
- data/lib/runcom/data.rb +7 -18
- data/lib/runcom/identity.rb +1 -1
- data/lib/runcom/paths/common.rb +46 -0
- data/lib/runcom/paths/{friendly.rb → home.rb} +4 -4
- metadata +26 -52
- 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: 2c36440a5f6b7c7e5e9bc63457ff04ce4f03a2bb888ebf5ddd3294b6fbb554ed
|
4
|
+
data.tar.gz: 7e15a92472a4ecf47e591e244965439b79337d17c98db9a651a626ec73adcc8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36cb0e69cb446658acd3c812f21909b5dfbfb2e42c37b89b50f1bf8b0bfa910110768dc77ab1d5510c61d1c0e298b3ca4e926e62aaef14a569a520706a9b9bbd
|
7
|
+
data.tar.gz: a787c56d515d8462db7453a692e60031dee3e5e91109acb110619e7e76ad944962443fbf3b2873cf3db634bb401c629f7d671dcc654b8e4db6b68b3708a79ae8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/runcom.rb
CHANGED
@@ -4,7 +4,9 @@ require "xdg"
|
|
4
4
|
require "runcom/identity"
|
5
5
|
require "runcom/errors/base"
|
6
6
|
require "runcom/errors/syntax"
|
7
|
-
require "runcom/paths/
|
8
|
-
require "runcom/
|
7
|
+
require "runcom/paths/home"
|
8
|
+
require "runcom/paths/common"
|
9
|
+
require "runcom/context"
|
9
10
|
require "runcom/cache"
|
11
|
+
require "runcom/config"
|
10
12
|
require "runcom/data"
|
data/lib/runcom/cache.rb
CHANGED
@@ -1,31 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
4
|
+
|
3
5
|
module Runcom
|
4
6
|
# A developer friendly wrapper of XDG cache.
|
5
|
-
Cache
|
7
|
+
class Cache
|
6
8
|
extend Forwardable
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
def initialize *arguments
|
11
|
-
super
|
10
|
+
DEFAULT_CONTEXT = Context.new xdg: XDG::Cache
|
12
11
|
|
13
|
-
|
14
|
-
self[:environment] ||= ENV
|
15
|
-
@cache = XDG::Cache.new home: home, environment: environment
|
16
|
-
freeze
|
17
|
-
end
|
18
|
-
|
19
|
-
def path
|
20
|
-
paths.find(&:exist?)
|
21
|
-
end
|
12
|
+
delegate %i[relative namespace file_name current all inspect] => :common
|
22
13
|
|
23
|
-
def
|
24
|
-
|
14
|
+
def initialize path, context: DEFAULT_CONTEXT
|
15
|
+
@common = Paths::Common.new path, context: context
|
25
16
|
end
|
26
17
|
|
27
18
|
private
|
28
19
|
|
29
|
-
attr_reader :
|
20
|
+
attr_reader :common
|
30
21
|
end
|
31
22
|
end
|
data/lib/runcom/config.rb
CHANGED
@@ -1,42 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "pathname"
|
4
3
|
require "yaml"
|
5
4
|
require "refinements/hashes"
|
6
5
|
|
7
|
-
# :reek:TooManyInstanceVariables
|
8
6
|
module Runcom
|
9
7
|
# A developer friendly wrapper of XDG config.
|
10
8
|
class Config
|
11
9
|
extend Forwardable
|
12
10
|
using Refinements::Hashes
|
13
11
|
|
14
|
-
|
12
|
+
DEFAULT_CONTEXT = Context.new xdg: XDG::Config
|
15
13
|
|
16
|
-
delegate %i[inspect] => :
|
14
|
+
delegate %i[relative namespace file_name current all inspect] => :common
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
@
|
21
|
-
@environment = environment
|
22
|
-
@file_name = file_name
|
23
|
-
@defaults = defaults
|
24
|
-
@config = XDG::Config.new home: Runcom::Paths::Friendly, environment: environment
|
16
|
+
def initialize path, defaults: {}, context: DEFAULT_CONTEXT
|
17
|
+
@common = Paths::Common.new path, context: context
|
18
|
+
@context = context
|
25
19
|
@settings = defaults.deep_merge process_settings
|
26
20
|
freeze
|
27
21
|
end
|
28
|
-
# rubocop:enable Metrics/ParameterLists
|
29
|
-
|
30
|
-
def path
|
31
|
-
paths.find(&:exist?)
|
32
|
-
end
|
33
|
-
|
34
|
-
def paths
|
35
|
-
config.all.map { |root| Pathname "#{root}/#{name}/#{file_name}" }
|
36
|
-
end
|
37
22
|
|
38
23
|
def merge other
|
39
|
-
self.class.new
|
24
|
+
self.class.new common.relative, defaults: settings.deep_merge(other.to_h), context: context
|
40
25
|
end
|
41
26
|
|
42
27
|
# :reek:FeatureEnvy
|
@@ -47,7 +32,7 @@ module Runcom
|
|
47
32
|
alias eql? ==
|
48
33
|
|
49
34
|
def hash
|
50
|
-
[
|
35
|
+
[common.relative, to_h, self.class].hash
|
51
36
|
end
|
52
37
|
|
53
38
|
def to_h
|
@@ -56,18 +41,19 @@ module Runcom
|
|
56
41
|
|
57
42
|
private
|
58
43
|
|
59
|
-
attr_reader :
|
44
|
+
attr_reader :common, :context, :settings
|
60
45
|
|
61
46
|
def process_settings
|
62
47
|
load_settings
|
63
48
|
rescue Psych::SyntaxError => error
|
64
49
|
raise Errors::Syntax, error.message
|
65
50
|
rescue StandardError
|
66
|
-
defaults
|
51
|
+
context.defaults
|
52
|
+
{}
|
67
53
|
end
|
68
54
|
|
69
55
|
def load_settings
|
70
|
-
yaml = YAML.load_file
|
56
|
+
yaml = YAML.load_file common.current
|
71
57
|
yaml.is_a?(Hash) ? yaml : {}
|
72
58
|
end
|
73
59
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Runcom
|
4
|
+
# A common context for all XDG custom objects.
|
5
|
+
Context = Struct.new :defaults, :home, :environment, :xdg, keyword_init: true do
|
6
|
+
def initialize *arguments
|
7
|
+
super
|
8
|
+
|
9
|
+
self[:home] ||= Paths::Home
|
10
|
+
self[:environment] ||= ENV
|
11
|
+
self[:xdg] = xdg.new home: home, environment: environment if xdg
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/runcom/data.rb
CHANGED
@@ -1,33 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "forwardable"
|
4
4
|
|
5
5
|
module Runcom
|
6
6
|
# A developer friendly wrapper of XDG data.
|
7
|
-
Data
|
7
|
+
class Data
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
-
|
10
|
+
DEFAULT_CONTEXT = Context.new xdg: XDG::Data
|
11
11
|
|
12
|
-
|
13
|
-
super
|
12
|
+
delegate %i[relative namespace file_name current all inspect] => :common
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
@data = XDG::Data.new home: home, environment: environment
|
18
|
-
freeze
|
19
|
-
end
|
20
|
-
|
21
|
-
def path
|
22
|
-
paths.find(&:exist?)
|
23
|
-
end
|
24
|
-
|
25
|
-
def paths
|
26
|
-
data.all.map { |root| Pathname "#{root}/#{name}" }
|
14
|
+
def initialize path, context: DEFAULT_CONTEXT
|
15
|
+
@common = Paths::Common.new path, context: context
|
27
16
|
end
|
28
17
|
|
29
18
|
private
|
30
19
|
|
31
|
-
attr_reader :
|
20
|
+
attr_reader :common
|
32
21
|
end
|
33
22
|
end
|
data/lib/runcom/identity.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "forwardable"
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
module Runcom
|
7
|
+
module Paths
|
8
|
+
# Provides common path/functionality for all XDG enhanced objects.
|
9
|
+
class Common
|
10
|
+
extend Forwardable
|
11
|
+
|
12
|
+
delegate %i[inspect] => :xdg
|
13
|
+
|
14
|
+
attr_reader :relative
|
15
|
+
|
16
|
+
def initialize relative, context: Context.new
|
17
|
+
@relative = Pathname relative
|
18
|
+
@context = context
|
19
|
+
end
|
20
|
+
|
21
|
+
def namespace
|
22
|
+
relative.parent
|
23
|
+
end
|
24
|
+
|
25
|
+
def file_name
|
26
|
+
relative.basename
|
27
|
+
end
|
28
|
+
|
29
|
+
def current
|
30
|
+
all.find(&:exist?)
|
31
|
+
end
|
32
|
+
|
33
|
+
def all
|
34
|
+
xdg.all.map { |root| root.join relative }
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
attr_reader :context
|
40
|
+
|
41
|
+
def xdg
|
42
|
+
context.xdg
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "forwardable"
|
4
|
+
require "pathname"
|
4
5
|
|
5
6
|
module Runcom
|
6
7
|
module Paths
|
7
|
-
# A XDG home path
|
8
|
-
|
9
|
-
class Friendly
|
8
|
+
# A XDG home path that prefers local over global path.
|
9
|
+
class Home
|
10
10
|
extend Forwardable
|
11
11
|
|
12
12
|
delegate %i[key value default] => :standard
|
13
13
|
|
14
14
|
def initialize pair, environment = ENV
|
15
|
-
@standard = XDG::Paths::
|
15
|
+
@standard = XDG::Paths::Home.new pair, environment
|
16
16
|
end
|
17
17
|
|
18
18
|
def dynamic
|
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:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
dKvURM+1PwDCzC5tvRwjhUJIizau6+MtkFCvJHmaAj1aZL3odcPejHj5Hxt/0CUW
|
29
29
|
y84=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date:
|
31
|
+
date: 2020-01-01 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: refinements
|
@@ -36,28 +36,28 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '7.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '7.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: xdg
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '4.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '4.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: bundler-audit
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,34 +72,6 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0.6'
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: gemsmith
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '13.5'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '13.5'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: git-cop
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '3.5'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '3.5'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: guard-rspec
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -120,28 +92,28 @@ dependencies:
|
|
120
92
|
requirements:
|
121
93
|
- - "~>"
|
122
94
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0.
|
95
|
+
version: '0.12'
|
124
96
|
type: :development
|
125
97
|
prerelease: false
|
126
98
|
version_requirements: !ruby/object:Gem::Requirement
|
127
99
|
requirements:
|
128
100
|
- - "~>"
|
129
101
|
- !ruby/object:Gem::Version
|
130
|
-
version: '0.
|
102
|
+
version: '0.12'
|
131
103
|
- !ruby/object:Gem::Dependency
|
132
104
|
name: pry-byebug
|
133
105
|
requirement: !ruby/object:Gem::Requirement
|
134
106
|
requirements:
|
135
107
|
- - "~>"
|
136
108
|
- !ruby/object:Gem::Version
|
137
|
-
version: '3.
|
109
|
+
version: '3.7'
|
138
110
|
type: :development
|
139
111
|
prerelease: false
|
140
112
|
version_requirements: !ruby/object:Gem::Requirement
|
141
113
|
requirements:
|
142
114
|
- - "~>"
|
143
115
|
- !ruby/object:Gem::Version
|
144
|
-
version: '3.
|
116
|
+
version: '3.7'
|
145
117
|
- !ruby/object:Gem::Dependency
|
146
118
|
name: rake
|
147
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,70 +162,70 @@ dependencies:
|
|
190
162
|
requirements:
|
191
163
|
- - "~>"
|
192
164
|
- !ruby/object:Gem::Version
|
193
|
-
version: '0.
|
165
|
+
version: '0.78'
|
194
166
|
type: :development
|
195
167
|
prerelease: false
|
196
168
|
version_requirements: !ruby/object:Gem::Requirement
|
197
169
|
requirements:
|
198
170
|
- - "~>"
|
199
171
|
- !ruby/object:Gem::Version
|
200
|
-
version: '0.
|
172
|
+
version: '0.78'
|
201
173
|
- !ruby/object:Gem::Dependency
|
202
174
|
name: rubocop-performance
|
203
175
|
requirement: !ruby/object:Gem::Requirement
|
204
176
|
requirements:
|
205
177
|
- - "~>"
|
206
178
|
- !ruby/object:Gem::Version
|
207
|
-
version: '1.
|
179
|
+
version: '1.5'
|
208
180
|
type: :development
|
209
181
|
prerelease: false
|
210
182
|
version_requirements: !ruby/object:Gem::Requirement
|
211
183
|
requirements:
|
212
184
|
- - "~>"
|
213
185
|
- !ruby/object:Gem::Version
|
214
|
-
version: '1.
|
186
|
+
version: '1.5'
|
215
187
|
- !ruby/object:Gem::Dependency
|
216
188
|
name: rubocop-rake
|
217
189
|
requirement: !ruby/object:Gem::Requirement
|
218
190
|
requirements:
|
219
191
|
- - "~>"
|
220
192
|
- !ruby/object:Gem::Version
|
221
|
-
version: '0.
|
193
|
+
version: '0.5'
|
222
194
|
type: :development
|
223
195
|
prerelease: false
|
224
196
|
version_requirements: !ruby/object:Gem::Requirement
|
225
197
|
requirements:
|
226
198
|
- - "~>"
|
227
199
|
- !ruby/object:Gem::Version
|
228
|
-
version: '0.
|
200
|
+
version: '0.5'
|
229
201
|
- !ruby/object:Gem::Dependency
|
230
202
|
name: rubocop-rspec
|
231
203
|
requirement: !ruby/object:Gem::Requirement
|
232
204
|
requirements:
|
233
205
|
- - "~>"
|
234
206
|
- !ruby/object:Gem::Version
|
235
|
-
version: '1.
|
207
|
+
version: '1.37'
|
236
208
|
type: :development
|
237
209
|
prerelease: false
|
238
210
|
version_requirements: !ruby/object:Gem::Requirement
|
239
211
|
requirements:
|
240
212
|
- - "~>"
|
241
213
|
- !ruby/object:Gem::Version
|
242
|
-
version: '1.
|
214
|
+
version: '1.37'
|
243
215
|
- !ruby/object:Gem::Dependency
|
244
216
|
name: simplecov
|
245
217
|
requirement: !ruby/object:Gem::Requirement
|
246
218
|
requirements:
|
247
219
|
- - "~>"
|
248
220
|
- !ruby/object:Gem::Version
|
249
|
-
version: '0.
|
221
|
+
version: '0.17'
|
250
222
|
type: :development
|
251
223
|
prerelease: false
|
252
224
|
version_requirements: !ruby/object:Gem::Requirement
|
253
225
|
requirements:
|
254
226
|
- - "~>"
|
255
227
|
- !ruby/object:Gem::Version
|
256
|
-
version: '0.
|
228
|
+
version: '0.17'
|
257
229
|
description:
|
258
230
|
email:
|
259
231
|
- brooke@alchemists.io
|
@@ -268,11 +240,13 @@ files:
|
|
268
240
|
- lib/runcom.rb
|
269
241
|
- lib/runcom/cache.rb
|
270
242
|
- lib/runcom/config.rb
|
243
|
+
- lib/runcom/context.rb
|
271
244
|
- lib/runcom/data.rb
|
272
245
|
- lib/runcom/errors/base.rb
|
273
246
|
- lib/runcom/errors/syntax.rb
|
274
247
|
- lib/runcom/identity.rb
|
275
|
-
- lib/runcom/paths/
|
248
|
+
- lib/runcom/paths/common.rb
|
249
|
+
- lib/runcom/paths/home.rb
|
276
250
|
homepage: https://github.com/bkuhlmann/runcom
|
277
251
|
licenses:
|
278
252
|
- Apache-2.0
|
@@ -288,15 +262,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
288
262
|
requirements:
|
289
263
|
- - "~>"
|
290
264
|
- !ruby/object:Gem::Version
|
291
|
-
version: '2.
|
265
|
+
version: '2.7'
|
292
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
293
267
|
requirements:
|
294
268
|
- - ">="
|
295
269
|
- !ruby/object:Gem::Version
|
296
270
|
version: '0'
|
297
271
|
requirements: []
|
298
|
-
rubygems_version: 3.
|
272
|
+
rubygems_version: 3.1.2
|
299
273
|
signing_key:
|
300
274
|
specification_version: 4
|
301
|
-
summary: An XDG enhanced run command manager for command line interfaces
|
275
|
+
summary: An XDG enhanced run command manager for command line interfaces.
|
302
276
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|