yaml_extend 1.2.1 → 1.3.1
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 -2
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 128a6d8e367eb8594d0b2c369cf2312821324ed9692ebacb4c39c0d4ccf127ab
|
4
|
+
data.tar.gz: f1cdb90f9ce3cd2c736472c601a723f93f8f284e96e34257197e230c5be8de9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18db51a9171e9f59311891a4dfca7b2a7bf9d8bb0f7575b6de3002c77670b54b5d626fb48a90d03f686a72d726ff756c53f9244221db57ef265115b9198ba577
|
7
|
+
data.tar.gz: df8821b3f7b180e28ebdcddec5870b1b714de3cce8a39125401d525f65d81ce6904e8024f9e51f6d0323d9515056658fb95b04a8fcadda47b168d7bcdf689e75
|
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,8 +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
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
32
|
spec.add_dependency 'deep_merge', '~> 1.1'
|
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.1
|
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
|
@@ -69,7 +69,8 @@ dependencies:
|
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- yaml_extend.gemspec@mail.magynhard.de
|
72
|
-
executables:
|
72
|
+
executables:
|
73
|
+
- yaml_extend
|
73
74
|
extensions: []
|
74
75
|
extra_rdoc_files: []
|
75
76
|
files:
|
@@ -83,6 +84,8 @@ files:
|
|
83
84
|
- Rakefile
|
84
85
|
- bin/console
|
85
86
|
- bin/setup
|
87
|
+
- bin/yaml_extend
|
88
|
+
- bin/yaml_extend.bat
|
86
89
|
- lib/custom_errors/invalid_key_type_error.rb
|
87
90
|
- lib/yaml_extend.rb
|
88
91
|
- lib/yaml_extend/version.rb
|
@@ -107,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
110
|
- !ruby/object:Gem::Version
|
108
111
|
version: '0'
|
109
112
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.1.4
|
111
114
|
signing_key:
|
112
115
|
specification_version: 4
|
113
116
|
summary: Extends YAML to support file based inheritance
|