runcom 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c9b270a9865431f290d90716f65907061c51a524
4
+ data.tar.gz: ea0cd3f564cbd12d31372083d4f414ed0825d195
5
+ SHA512:
6
+ metadata.gz: c8d5af1ce442632375127b792d89b3a796c55aab3c416239bddf8d6f5461ec1f85b0747b6b82f94a50eb5c3bef7724f3dfd76b27e1c73c145798748a4751507c
7
+ data.tar.gz: 703f57f7a559896a5e48aa049e048c730e76e1365824c0bfd8855c5e0c8f18cad85025a49a1e60fc5a35696432431e42e28ef246691e836dcf37819e1d8974be
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
@@ -0,0 +1,4 @@
1
+ t��?�x��,5��R��~$1��U��0/9t㞮ocr~͵*�y���P��S�2_?�խ�9��$
2
+ �,�������|(�- ��[�I�S�
3
+ ,-�/�RhU��D8׸��.��g7��y�p&>yrB����W�G�!��`��ML ��z8�
4
+ KA'�iևy���^qeQ- A���V��X���Q$�d�IH���>��,���30�!5੼A�p�2�
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2016 [Alchemists](https://www.alchemists.io).
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # Runcom
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/runcom.svg)](http://badge.fury.io/rb/runcom)
4
+ [![Code Climate GPA](https://codeclimate.com/github/bkuhlmann/runcom.svg)](https://codeclimate.com/github/bkuhlmann/runcom)
5
+ [![Code Climate Coverage](https://codeclimate.com/github/bkuhlmann/runcom/coverage.svg)](https://codeclimate.com/github/bkuhlmann/runcom)
6
+ [![Gemnasium Status](https://gemnasium.com/bkuhlmann/runcom.svg)](https://gemnasium.com/bkuhlmann/runcom)
7
+ [![Travis CI Status](https://secure.travis-ci.org/bkuhlmann/runcom.svg)](https://travis-ci.org/bkuhlmann/runcom)
8
+ [![Patreon](https://img.shields.io/badge/patreon-donate-brightgreen.svg)](https://www.patreon.com/bkuhlmann)
9
+
10
+ A [run command manager](https://en.wikipedia.org/wiki/Run_commands) for command line interfaces
11
+ (CLI). It manages/resolves local or global resource (i.e. `.<program>rc`) settings for CLIs.
12
+
13
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
14
+
15
+ # Table of Contents
16
+
17
+ - [Features](#features)
18
+ - [Requirements](#requirements)
19
+ - [Setup](#setup)
20
+ - [Usage](#usage)
21
+ - [Tests](#tests)
22
+ - [Versioning](#versioning)
23
+ - [Code of Conduct](#code-of-conduct)
24
+ - [Contributions](#contributions)
25
+ - [License](#license)
26
+ - [History](#history)
27
+ - [Credits](#credits)
28
+
29
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
30
+
31
+ # Features
32
+
33
+ - Loads local or global YAML resource configurations.
34
+ - Automatically detects and resolves local or global resource configurations.
35
+ - Provides support for merging of nested/complex configurations.
36
+ - Supports hash representation of configuration.
37
+
38
+ # Requirements
39
+
40
+ 0. [Ruby 2.3.1](https://www.ruby-lang.org)
41
+
42
+ # Setup
43
+
44
+ For a secure install, type the following (recommended):
45
+
46
+ gem cert --add <(curl --location --silent https://www.alchemists.io/gem-public.pem)
47
+ gem install runcom --trust-policy MediumSecurity
48
+
49
+ NOTE: A HighSecurity trust policy would be best but MediumSecurity enables signed gem verification
50
+ while allowing the installation of unsigned dependencies since they are beyond the scope of this
51
+ gem.
52
+
53
+ For an insecure install, type the following (not recommended):
54
+
55
+ gem install runcom
56
+
57
+ Add the following to your Gemfile:
58
+
59
+ gem "runcom"
60
+
61
+ # Usage
62
+
63
+ Start by leveraging the `Runcom::Configuration` object as follows:
64
+
65
+ configuration = Runcom::Configuration file_name: ".examplerc"
66
+
67
+ There is optional support for default settings too:
68
+
69
+ configuration = Runcom::Configuration file_name: ".examplerc", defaults: {name: "Example"}
70
+
71
+ Default settings will be overwitten if matching local or global setting keys are detected. Order of
72
+ precedence is determined as follows:
73
+
74
+ 0. Local (i.e. `<current working directory>/.examplerc`)
75
+ 0. Global (i.e. `$HOME/.examplerc`)
76
+ 0. Defaults (i.e. `{}` unless specified upon initialization).
77
+
78
+ If multiple settings are detected, only the first one found will be used.
79
+
80
+ For further details, study the public interface as provided by the
81
+ [`Runcom::Configuration`](lib/runcom/configuration.rb) object.
82
+
83
+ # Tests
84
+
85
+ To test, run:
86
+
87
+ bundle exec rake
88
+
89
+ # Versioning
90
+
91
+ Read [Semantic Versioning](http://semver.org) for details. Briefly, it means:
92
+
93
+ - Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
94
+ - Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
95
+ - Major (X.y.z) - Incremented for any backwards incompatible public API changes.
96
+
97
+ # Code of Conduct
98
+
99
+ Please note that this project is released with a [CODE OF CONDUCT](CODE_OF_CONDUCT.md). By
100
+ participating in this project you agree to abide by its terms.
101
+
102
+ # Contributions
103
+
104
+ Read [CONTRIBUTING](CONTRIBUTING.md) for details.
105
+
106
+ # License
107
+
108
+ Copyright (c) 2016 [Alchemists](https://www.alchemists.io).
109
+ Read [LICENSE](LICENSE.md) for details.
110
+
111
+ # History
112
+
113
+ Read [CHANGES](CHANGES.md) for details.
114
+ Built with [Gemsmith](https://github.com/bkuhlmann/gemsmith).
115
+
116
+ # Credits
117
+
118
+ Developed by [Brooke Kuhlmann](https://www.alchemists.io) at
119
+ [Alchemists](https://www.alchemists.io).
data/lib/runcom.rb ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "runcom/identity"
4
+ require "runcom/configuration"
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/hashes"
4
+
5
+ module Runcom
6
+ # Default gem configuration with support for custom settings.
7
+ class Configuration
8
+ using Refinements::Hashes
9
+
10
+ def initialize file_name:, defaults: {}
11
+ @file_name = file_name
12
+ @defaults = defaults
13
+ @settings = defaults.deep_merge load_settings
14
+ end
15
+
16
+ def local?
17
+ File.exist? local_path
18
+ end
19
+
20
+ def global?
21
+ File.exist? global_path
22
+ end
23
+
24
+ def local_path
25
+ File.join Dir.pwd, file_name
26
+ end
27
+
28
+ def global_path
29
+ File.join ENV["HOME"], file_name
30
+ end
31
+
32
+ def computed_path
33
+ local? ? local_path : global_path
34
+ end
35
+
36
+ def merge custom_settings
37
+ settings.deep_merge custom_settings
38
+ end
39
+
40
+ def to_h
41
+ settings
42
+ end
43
+
44
+ private
45
+
46
+ attr_reader :file_name, :defaults, :settings
47
+
48
+ def load_settings
49
+ yaml = YAML.load_file computed_path
50
+ yaml.is_a?(Hash) ? yaml : {}
51
+ rescue
52
+ defaults
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runcom
4
+ # Gem identity information.
5
+ module Identity
6
+ def self.name
7
+ "runcom"
8
+ end
9
+
10
+ def self.label
11
+ "Runcom"
12
+ end
13
+
14
+ def self.version
15
+ "0.1.0"
16
+ end
17
+
18
+ def self.version_label
19
+ "#{label} #{version}"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "rspec/core/rake_task"
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ rescue LoadError => error
7
+ puts error.message
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "rubocop/rake_task"
5
+ RuboCop::RakeTask.new
6
+ rescue LoadError => error
7
+ puts error.message
8
+ end
metadata ADDED
@@ -0,0 +1,229 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: runcom
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brooke Kuhlmann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZicm9v
14
+ a2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQBGRYC
15
+ aW8wHhcNMTYxMDE5MTY0NDEzWhcNMTcxMDE5MTY0NDEzWjBBMQ8wDQYDVQQDDAZi
16
+ cm9va2UxGjAYBgoJkiaJk/IsZAEZFgphbGNoZW1pc3RzMRIwEAYKCZImiZPyLGQB
17
+ GRYCaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCgryPL4/IbWDcL
18
+ fnqpnoJALqj+ega7hSsvvD8sac57HPNLeKcOmSafFiQLAnTmmE132ZlFc8kyZRVn
19
+ zmqSESowO5jd+ggFuy1ySqQJXhwgik04KedKRUjpIDZePrjw+M5UJT1qzKCKL2xI
20
+ nx5cOKP1fSWJ1RRu8JhaDeSloGtYMdw2c28wnKPNIsWDood4xhbLcY9IqeISft2e
21
+ oTAHTHandHbvt24X3/n67ceNjLBbsVZPXCC1C8C8ccjHjA4Tm2uiFoDwThMcPggg
22
+ 90H6fh0vLFcNAobdPEchbge8tWtfmMPz2+C4yklANn81GA+ANsBS1uwx6mxJoMQU
23
+ BNVp0aLvAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
+ BBRS85Rn1BaqeIONByw4t46DMDMzHDAfBgNVHREEGDAWgRRicm9va2VAYWxjaGVt
25
+ aXN0cy5pbzAfBgNVHRIEGDAWgRRicm9va2VAYWxjaGVtaXN0cy5pbzANBgkqhkiG
26
+ 9w0BAQUFAAOCAQEAZMb57Y4wdpbX8XxTukEO7VC1pndccUsxdbziGsAOiuHET3Aq
27
+ ygLvrfdYrN88/w+qxncW5bxbO3a6UGkuhIFUPM8zRSE/rh6bCcJljTJrExVt42eV
28
+ aYCb7WJNsx3eNXHn3uQodq3tD+lmNJzz2bFeT3smGSKEnALBjqorO/2mpDh4FJ3S
29
+ 4CcDYsJ1ywep8LDJDBBGdKz9moL+axryzpeTpgTT/fFYFzRzWrURPyDvPOikh9TX
30
+ n/LUZ1dKhIHzfKx1B4+TEIefArObGfkLIDM8+Dq1RX7TF1k81Men7iu4MgE9bYBn
31
+ 3dE+xI3FdB5gWcdWxdtgRCmWjtXeYYyb4z6NQQ==
32
+ -----END CERTIFICATE-----
33
+ date: 2016-11-03 00:00:00.000000000 Z
34
+ dependencies:
35
+ - !ruby/object:Gem::Dependency
36
+ name: refinements
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
42
+ type: :runtime
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '3.0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '11.0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '11.0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: gemsmith
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '7.7'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '7.7'
77
+ - !ruby/object:Gem::Dependency
78
+ name: pry
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0.10'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.10'
91
+ - !ruby/object:Gem::Dependency
92
+ name: pry-byebug
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '3.4'
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '3.4'
105
+ - !ruby/object:Gem::Dependency
106
+ name: pry-state
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.1'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '0.1'
119
+ - !ruby/object:Gem::Dependency
120
+ name: rspec
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '3.5'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '3.5'
133
+ - !ruby/object:Gem::Dependency
134
+ name: guard-rspec
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '4.7'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '4.7'
147
+ - !ruby/object:Gem::Dependency
148
+ name: climate_control
149
+ requirement: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: '0.0'
154
+ type: :development
155
+ prerelease: false
156
+ version_requirements: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '0.0'
161
+ - !ruby/object:Gem::Dependency
162
+ name: rubocop
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '0.45'
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '0.45'
175
+ - !ruby/object:Gem::Dependency
176
+ name: codeclimate-test-reporter
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '0.6'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
187
+ - !ruby/object:Gem::Version
188
+ version: '0.6'
189
+ description:
190
+ email:
191
+ - brooke@alchemists.io
192
+ executables: []
193
+ extensions: []
194
+ extra_rdoc_files:
195
+ - README.md
196
+ - LICENSE.md
197
+ files:
198
+ - LICENSE.md
199
+ - README.md
200
+ - lib/runcom.rb
201
+ - lib/runcom/configuration.rb
202
+ - lib/runcom/identity.rb
203
+ - lib/tasks/rspec.rake
204
+ - lib/tasks/rubocop.rake
205
+ homepage: https://github.com/bkuhlmann/runcom
206
+ licenses:
207
+ - MIT
208
+ metadata: {}
209
+ post_install_message:
210
+ rdoc_options: []
211
+ require_paths:
212
+ - lib
213
+ required_ruby_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ requirements: []
224
+ rubyforge_project:
225
+ rubygems_version: 2.6.8
226
+ signing_key:
227
+ specification_version: 4
228
+ summary: A run command manager for command line interfaces.
229
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ 5|���>�˵R�e�8HW�"�.�縛�_5d ��4*��N���8'��b��n\� =�)��]���I�'W&UK)��*��|����s�ꄈ�u�j�#��Ă@��gb�h���f-�;���}Z��I�����l{�a���2��$����󰞕هK�����Ͽb��j�C�S~\>��I��� �>Z5�Z�2b֞e�Na
2
+ �@)ݚHH2