yaml_extend 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +63 -15
- data/bin/yaml_extend +19 -0
- data/bin/yaml_extend.bat +2 -0
- data/lib/yaml_extend/version.rb +1 -1
- data/yaml_extend.gemspec +2 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e62864fb3a63fe8c957b6fc2a2432eeb67da44c5ff278aa00a4a9935c37fd7fd
|
4
|
+
data.tar.gz: 8156d6c5bd7d13d6753fbaecd86eb07f5e59791f7fa4bb790c0e3b1232408a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54a2f706e91c582c96a03c41567395a783bda1690adaff69866777f5dc77cb70da340055ff27b9a9219bf2cb361c54b52c49c297327d48b315d085d9b1eda900
|
7
|
+
data.tar.gz: c955e1c7c7055fb626fa13b8f77f916107ad67478a76758b3c9251dc0245ed84bed77c431ccce690014a4da6e54d872b0420f788f32b8fde334e127859f1e80e
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# yaml_extend
|
2
|
-
![Gem](https://img.shields.io/gem/v/yaml_extend?color=default&style=plastic&logo=ruby&logoColor=red)
|
3
|
-
![
|
2
|
+
[![Gem](https://img.shields.io/gem/v/yaml_extend?color=default&style=plastic&logo=ruby&logoColor=red)](https://rubygems.org/gems/yaml_extend)
|
3
|
+
![downloads](https://img.shields.io/gem/dt/yaml_extend?color=blue&style=plastic)
|
4
4
|
[![License: MIT](https://img.shields.io/badge/License-MIT-gold.svg?style=plastic&logo=mit)](LICENSE)
|
5
5
|
|
6
6
|
> Extends YAML to support file based inheritance.
|
@@ -9,22 +9,19 @@ That can be very handy to build a configuration hierarchy.
|
|
9
9
|
|
10
10
|
Basic support for ERB (embedded ruby) is included and automatically applied when config files are named `*.erb` or `*.erb.*`.
|
11
11
|
|
12
|
-
|
12
|
+
If you are just doing administration without knowing ruby, you can also just use the command line tool that is included to use this librarys features. Ensure, that [ruby](https://www.ruby-lang.org/) is installed on your system, before following further instructions.
|
13
13
|
|
14
|
-
|
14
|
+
### Contents
|
15
|
+
* [Common information](#common-information)
|
16
|
+
* [Installation](#installation)
|
17
|
+
* [Usage](#usage)
|
18
|
+
* [Command line](#command-line)
|
19
|
+
* [Documentation](#documentation)
|
20
|
+
* [Contributing](#contributing)
|
15
21
|
|
16
|
-
```ruby
|
17
|
-
gem 'yaml_extend'
|
18
|
-
```
|
19
22
|
|
20
|
-
And then execute:
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
Or install it yourself as:
|
25
|
-
|
26
|
-
$ gem install yaml_extend
|
27
|
-
|
24
|
+
<a name="common-information"></a>
|
28
25
|
## Common information
|
29
26
|
|
30
27
|
It is possible to build inheritance trees like:
|
@@ -52,6 +49,32 @@ The files to inherit from are specified by the key 'extends:' in the YAML file.
|
|
52
49
|
That key can be customized if you prefer another one.
|
53
50
|
See the examples below.
|
54
51
|
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
<a name="installation"></a>
|
56
|
+
## Installation
|
57
|
+
### Ruby
|
58
|
+
Add this line to your application's Gemfile:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
gem 'yaml_extend'
|
62
|
+
```
|
63
|
+
|
64
|
+
And then execute:
|
65
|
+
|
66
|
+
$ bundle install
|
67
|
+
|
68
|
+
### Command line
|
69
|
+
If you just want to use the command line then run
|
70
|
+
|
71
|
+
$ gem install yaml_extend
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<a name="usage"></a>
|
55
78
|
## Usage
|
56
79
|
yaml_extend adds the method YAML.ext_load_file to YAML.
|
57
80
|
|
@@ -155,6 +178,29 @@ foo: 'bar'
|
|
155
178
|
config = YAML.ext_load_file 'custom2.yml', ['options','extend_file']
|
156
179
|
```
|
157
180
|
|
181
|
+
|
182
|
+
|
183
|
+
<a name="command-line"></a>
|
184
|
+
## Command line
|
185
|
+
|
186
|
+
`yaml_extend` is also available on the command line after installation.
|
187
|
+
|
188
|
+
To parse and merge a prepared YAML file, just run
|
189
|
+
|
190
|
+
```
|
191
|
+
yaml_extend path/to/my/yaml_file.yml
|
192
|
+
```
|
193
|
+
|
194
|
+
Usually you might want to put the result into resulting YAML file. So just use the basic command line features to do so:
|
195
|
+
|
196
|
+
|
197
|
+
```
|
198
|
+
yaml_extend path/to/my/yaml_file.yml > combined_yaml.yml
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
<a name="documentation"></a>
|
158
204
|
## Documentation
|
159
205
|
```ruby
|
160
206
|
YAML.ext_load_file(yaml_path, inheritance_key='extends', options = {})
|
@@ -177,7 +223,9 @@ YAML.ext_load_file(yaml_path, inheritance_key='extends', options = {})
|
|
177
223
|
|
178
224
|
See also rubydoc at [https://www.rubydoc.info/gems/yaml_extend](https://www.rubydoc.info/gems/yaml_extend)
|
179
225
|
|
180
|
-
## Contributing
|
181
226
|
|
227
|
+
|
228
|
+
<a name="documentation"></a>
|
229
|
+
## Contributing
|
182
230
|
Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/yaml_extend. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
183
231
|
|
data/bin/yaml_extend
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'yaml_extend'
|
4
|
+
|
5
|
+
arg = ARGV[0]
|
6
|
+
|
7
|
+
if %w[help -h --help].include?(arg) || arg.nil? || arg == ''
|
8
|
+
puts <<-TEXT
|
9
|
+
|
10
|
+
yaml_extend #{YamlExtend::VERSION}
|
11
|
+
https://github.com/magynhard/yaml_extend
|
12
|
+
|
13
|
+
yaml_extend -h --help # show this info
|
14
|
+
yaml_extend <file> # parse and output given file
|
15
|
+
|
16
|
+
TEXT
|
17
|
+
else
|
18
|
+
puts YAML.ext_load_file(arg).to_yaml
|
19
|
+
end
|
data/bin/yaml_extend.bat
ADDED
data/lib/yaml_extend/version.rb
CHANGED
data/yaml_extend.gemspec
CHANGED
@@ -6,6 +6,7 @@ require 'yaml_extend/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "yaml_extend"
|
8
8
|
spec.version = YamlExtend::VERSION
|
9
|
+
spec.executables = %w[yaml_extend]
|
9
10
|
spec.authors = ["Matthäus Beyrle"]
|
10
11
|
spec.email = ["yaml_extend.gemspec@mail.magynhard.de"]
|
11
12
|
|
@@ -25,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
25
26
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
26
27
|
f.match(%r{^(test|spec|features)/})
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
31
|
spec.require_paths = ['lib']
|
31
32
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_extend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthäus Beyrle
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|
@@ -83,6 +83,8 @@ files:
|
|
83
83
|
- Rakefile
|
84
84
|
- bin/console
|
85
85
|
- bin/setup
|
86
|
+
- bin/yaml_extend
|
87
|
+
- bin/yaml_extend.bat
|
86
88
|
- lib/custom_errors/invalid_key_type_error.rb
|
87
89
|
- lib/yaml_extend.rb
|
88
90
|
- lib/yaml_extend/version.rb
|
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
- !ruby/object:Gem::Version
|
108
110
|
version: '0'
|
109
111
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.1.4
|
111
113
|
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: Extends YAML to support file based inheritance
|