runcom 2.0.1 → 3.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/README.md +9 -7
- data/lib/runcom/configuration.rb +32 -15
- data/lib/runcom/identity.rb +1 -1
- data/lib/runcom/xdg/configuration.rb +1 -1
- metadata +31 -57
- 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: 6a957c88bd4bd09900d6471688d00d365390837bf00fc04ae417554b9ffb575e
|
4
|
+
data.tar.gz: fdece804569302d90ac3ca35c5775416d180e6e3c499dce81742e8e6611f7051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbc1145bc4818734ad328b36d1cc1a153ab2aea703e9f9cace693a2be03a131f03bbed1fbb198824b6ac38dc3addd74fcdde34e93153458aade0afd85cca984a
|
7
|
+
data.tar.gz: 52f0b77a602b49e8f196ef502b2a9e54a03e3a3cf9b0cd9601ec3cdf4a905d3ebc3e0a77f6dd087cc018edc91d595a5e98965776b9a8a2cf3890dff93131b0e6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -3,9 +3,7 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/runcom.svg)](http://badge.fury.io/rb/runcom)
|
4
4
|
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/129b7ea524a0f5a6a805/maintainability)](https://codeclimate.com/github/bkuhlmann/runcom/maintainability)
|
5
5
|
[![Code Climate Test Coverage](https://api.codeclimate.com/v1/badges/129b7ea524a0f5a6a805/test_coverage)](https://codeclimate.com/github/bkuhlmann/runcom/test_coverage)
|
6
|
-
[![Gemnasium Status](https://gemnasium.com/bkuhlmann/runcom.svg)](https://gemnasium.com/bkuhlmann/runcom)
|
7
6
|
[![Circle CI Status](https://circleci.com/gh/bkuhlmann/runcom.svg?style=svg)](https://circleci.com/gh/bkuhlmann/runcom)
|
8
|
-
[![Patreon](https://img.shields.io/badge/patreon-donate-brightgreen.svg)](https://www.patreon.com/bkuhlmann)
|
9
7
|
|
10
8
|
Runcom (a.k.a. [Run Command](https://en.wikipedia.org/wiki/Run_commands)) provides common
|
11
9
|
functionality for Command Line Interfaces (CLIs) in which to manage global, local, or multiple
|
@@ -71,25 +69,29 @@ from custom locations. It is meant to be used within your CLI program(s).
|
|
71
69
|
|
72
70
|
An object can be initialized as follows:
|
73
71
|
|
74
|
-
configuration = Runcom::Configuration.new
|
72
|
+
configuration = Runcom::Configuration.new "example"
|
75
73
|
|
76
74
|
The default file name for a configuration is `configuration.yml` but a custom name can be used if
|
77
75
|
desired:
|
78
76
|
|
79
|
-
configuration = Runcom::Configuration.new
|
77
|
+
configuration = Runcom::Configuration.new "example", file_name: "example.yml"
|
80
78
|
|
81
79
|
Default settings can be initialized as well:
|
82
80
|
|
83
|
-
configuration = Runcom::Configuration.new
|
81
|
+
configuration = Runcom::Configuration.new "example", defaults: {name: "Example"}
|
84
82
|
|
85
83
|
Once a configuration has been initialized, a hash representation can be obtained:
|
86
84
|
|
87
85
|
configuration.to_h
|
88
86
|
|
89
|
-
A configuration can be merged with another hash (handy for runtime overrides)
|
87
|
+
A configuration can be merged with another hash (handy for runtime overrides):
|
90
88
|
|
91
89
|
updated_configuration = configuration.merge {name: "Updated Name"}
|
92
90
|
|
91
|
+
A configuration can also be merged with another configuration:
|
92
|
+
|
93
|
+
updated_configuration = configuration.merge Runcom::Configuration.new("other", defaults: {a: 1})
|
94
|
+
|
93
95
|
The computed path of the configuration can be asked for as well:
|
94
96
|
|
95
97
|
configuration.path # "~/.config/example/configuration.yml"
|
@@ -166,7 +168,7 @@ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
|
|
166
168
|
|
167
169
|
## License
|
168
170
|
|
169
|
-
Copyright
|
171
|
+
Copyright 2016 [Alchemists](https://www.alchemists.io).
|
170
172
|
Read [LICENSE](LICENSE.md) for details.
|
171
173
|
|
172
174
|
## History
|
data/lib/runcom/configuration.rb
CHANGED
@@ -9,36 +9,42 @@ module Runcom
|
|
9
9
|
class Configuration
|
10
10
|
using Refinements::Hashes
|
11
11
|
|
12
|
-
|
12
|
+
DEFAULT_FILE_NAME = "configuration.yml"
|
13
13
|
|
14
|
-
def initialize
|
15
|
-
@
|
14
|
+
def initialize name, file_name: DEFAULT_FILE_NAME, defaults: {}
|
15
|
+
@name = name
|
16
|
+
@file_name = file_name
|
16
17
|
@defaults = defaults
|
17
18
|
@settings = defaults.deep_merge process_settings
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
-
|
21
|
+
def path
|
22
|
+
paths.find(&:exist?)
|
22
23
|
end
|
23
24
|
|
24
|
-
def
|
25
|
-
settings
|
25
|
+
def merge other
|
26
|
+
self.class.new name, file_name: file_name, defaults: settings.deep_merge(other.to_h)
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
+
# :reek:FeatureEnvy
|
30
|
+
def == other
|
31
|
+
other.is_a?(Configuration) && hash == other.hash
|
32
|
+
end
|
29
33
|
|
30
|
-
|
34
|
+
alias eql? ==
|
31
35
|
|
32
|
-
def
|
33
|
-
|
34
|
-
paths.find(&:exist?)
|
36
|
+
def hash
|
37
|
+
[name, file_name, to_h, self.class].hash
|
35
38
|
end
|
36
39
|
|
37
|
-
def
|
38
|
-
|
39
|
-
yaml.is_a?(Hash) ? yaml : {}
|
40
|
+
def to_h
|
41
|
+
settings
|
40
42
|
end
|
41
43
|
|
44
|
+
private
|
45
|
+
|
46
|
+
attr_reader :name, :file_name, :defaults, :settings
|
47
|
+
|
42
48
|
def process_settings
|
43
49
|
load_settings
|
44
50
|
rescue Psych::SyntaxError => error
|
@@ -46,5 +52,16 @@ module Runcom
|
|
46
52
|
rescue StandardError
|
47
53
|
defaults
|
48
54
|
end
|
55
|
+
|
56
|
+
def load_settings
|
57
|
+
yaml = YAML.load_file path
|
58
|
+
yaml.is_a?(Hash) ? yaml : {}
|
59
|
+
end
|
60
|
+
|
61
|
+
def paths
|
62
|
+
XDG::Configuration.computed_dirs.map do |root|
|
63
|
+
Pathname "#{root}/#{name}/#{file_name}"
|
64
|
+
end
|
65
|
+
end
|
49
66
|
end
|
50
67
|
end
|
data/lib/runcom/identity.rb
CHANGED
@@ -6,7 +6,7 @@ module Runcom
|
|
6
6
|
module XDG
|
7
7
|
# Represents X Desktop Group (XGD) configuration support. XGD is also known as
|
8
8
|
# [Free Desktop](https://www.freedesktop.org). Here is the exact
|
9
|
-
# [specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html)
|
9
|
+
# [specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html) used
|
10
10
|
# for this implementation.
|
11
11
|
class Configuration
|
12
12
|
def self.home_dir
|
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: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -10,27 +10,26 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
GyTL6s+8CnN9sL2Spfh/YdRn/29r4g2qi6FomQ==
|
13
|
+
MIIDQDCCAiigAwIBAgIBATANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
|
14
|
+
a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeF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d9JBAm4G7mJiV93MsuCM5N4ZDY7XaxIhvctNSNhX/Yn8LLdtGI
|
30
|
+
b4jw5t40FKyNUvLPPXYAvQALBtk=
|
32
31
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-
|
32
|
+
date: 2018-04-01 00:00:00.000000000 Z
|
34
33
|
dependencies:
|
35
34
|
- !ruby/object:Gem::Dependency
|
36
35
|
name: refinements
|
@@ -38,14 +37,14 @@ dependencies:
|
|
38
37
|
requirements:
|
39
38
|
- - "~>"
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: '5.
|
40
|
+
version: '5.1'
|
42
41
|
type: :runtime
|
43
42
|
prerelease: false
|
44
43
|
version_requirements: !ruby/object:Gem::Requirement
|
45
44
|
requirements:
|
46
45
|
- - "~>"
|
47
46
|
- !ruby/object:Gem::Version
|
48
|
-
version: '5.
|
47
|
+
version: '5.1'
|
49
48
|
- !ruby/object:Gem::Dependency
|
50
49
|
name: bundler-audit
|
51
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,34 +87,6 @@ dependencies:
|
|
88
87
|
- - "~>"
|
89
88
|
- !ruby/object:Gem::Version
|
90
89
|
version: '1.0'
|
91
|
-
- !ruby/object:Gem::Dependency
|
92
|
-
name: gemsmith
|
93
|
-
requirement: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '11.0'
|
98
|
-
type: :development
|
99
|
-
prerelease: false
|
100
|
-
version_requirements: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '11.0'
|
105
|
-
- !ruby/object:Gem::Dependency
|
106
|
-
name: git-cop
|
107
|
-
requirement: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '2.0'
|
112
|
-
type: :development
|
113
|
-
prerelease: false
|
114
|
-
version_requirements: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - "~>"
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '2.0'
|
119
90
|
- !ruby/object:Gem::Dependency
|
120
91
|
name: guard-rspec
|
121
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,14 +149,14 @@ dependencies:
|
|
178
149
|
requirements:
|
179
150
|
- - "~>"
|
180
151
|
- !ruby/object:Gem::Version
|
181
|
-
version: '4.
|
152
|
+
version: '4.8'
|
182
153
|
type: :development
|
183
154
|
prerelease: false
|
184
155
|
version_requirements: !ruby/object:Gem::Requirement
|
185
156
|
requirements:
|
186
157
|
- - "~>"
|
187
158
|
- !ruby/object:Gem::Version
|
188
|
-
version: '4.
|
159
|
+
version: '4.8'
|
189
160
|
- !ruby/object:Gem::Dependency
|
190
161
|
name: rspec
|
191
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,14 +177,14 @@ dependencies:
|
|
206
177
|
requirements:
|
207
178
|
- - "~>"
|
208
179
|
- !ruby/object:Gem::Version
|
209
|
-
version: '0.
|
180
|
+
version: '0.54'
|
210
181
|
type: :development
|
211
182
|
prerelease: false
|
212
183
|
version_requirements: !ruby/object:Gem::Requirement
|
213
184
|
requirements:
|
214
185
|
- - "~>"
|
215
186
|
- !ruby/object:Gem::Version
|
216
|
-
version: '0.
|
187
|
+
version: '0.54'
|
217
188
|
description:
|
218
189
|
email:
|
219
190
|
- brooke@alchemists.io
|
@@ -234,7 +205,10 @@ files:
|
|
234
205
|
homepage: https://github.com/bkuhlmann/runcom
|
235
206
|
licenses:
|
236
207
|
- Apache-2.0
|
237
|
-
metadata:
|
208
|
+
metadata:
|
209
|
+
source_code_uri: https://github.com/bkuhlmann/runcom
|
210
|
+
changelog_uri: https://github.com/bkuhlmann/runcom/blob/master/CHANGES.md
|
211
|
+
bug_tracker_uri: https://github.com/bkuhlmann/runcom/issues
|
238
212
|
post_install_message:
|
239
213
|
rdoc_options: []
|
240
214
|
require_paths:
|
@@ -251,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
225
|
version: '0'
|
252
226
|
requirements: []
|
253
227
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.7.
|
228
|
+
rubygems_version: 2.7.6
|
255
229
|
signing_key:
|
256
230
|
specification_version: 4
|
257
231
|
summary: A run command manager for command line interfaces.
|
metadata.gz.sig
CHANGED
Binary file
|