yaml_ref_resolver 0.4.0 → 0.4.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 +6 -0
- data/lib/yaml_ref_resolver/cli.rb +16 -3
- data/lib/yaml_ref_resolver/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2565dc38efb9a0e8317a54550ddc80e81fc312fd
|
4
|
+
data.tar.gz: 08d97334000c2e541367b696b579dca8db7e9ce2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 380e942e7dd2ba9327d0d9a959d4270fa3da2af89df909b29c22afe3a1f3e26d4f3d4036bc6e4c973c73e95b95f209bd5c5cc7172ea08c6cc65ed82f6ef9c6b1
|
7
|
+
data.tar.gz: eb3680a4034ea315ce9794de10f2234c3579e0f3d582c791048f32fefe35b00a9d7aee21f12db24eb34ccdf2bdccb920d866161a6154fce31f5fd3beb5cabd77
|
data/README.md
CHANGED
@@ -67,6 +67,12 @@ $ yaml_ref_resolver -i ./path/to/index.yaml -o ./path/to/output.yaml
|
|
67
67
|
$ yaml_ref_resolver -i ./path/to/index.yaml -w
|
68
68
|
```
|
69
69
|
|
70
|
+
`-j` or `--json` switch outputs in json format instead of yaml format.
|
71
|
+
|
72
|
+
```
|
73
|
+
$ yaml_ref_resolver -i ./path/to/index.yaml -j
|
74
|
+
```
|
75
|
+
|
70
76
|
## Contributing
|
71
77
|
|
72
78
|
Bug reports and pull requests are very welcome on GitHub at https://github.com/Joe-noh/yaml_ref_resolver.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "yaml_ref_resolver"
|
2
|
+
require "json"
|
2
3
|
require "optparse"
|
3
4
|
require "filewatcher"
|
4
5
|
|
@@ -9,6 +10,7 @@ class YamlRefResolver
|
|
9
10
|
@input = nil
|
10
11
|
@output = nil
|
11
12
|
@watch = false
|
13
|
+
@json = false
|
12
14
|
|
13
15
|
define_options
|
14
16
|
end
|
@@ -30,14 +32,21 @@ class YamlRefResolver
|
|
30
32
|
private
|
31
33
|
|
32
34
|
def resolve_and_dump
|
33
|
-
yaml = resolver.resolve(@input).to_yaml
|
34
35
|
|
35
36
|
if @output
|
36
37
|
File.open(@output, "w") do |f|
|
37
|
-
f.puts
|
38
|
+
f.puts yaml_or_json
|
38
39
|
end
|
39
40
|
else
|
40
|
-
$stdout.write
|
41
|
+
$stdout.write yaml_or_json
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def yaml_or_json
|
46
|
+
if @json
|
47
|
+
JSON.pretty_generate resolver.resolve(@input)
|
48
|
+
else
|
49
|
+
resolver.resolve(@input).to_yaml
|
41
50
|
end
|
42
51
|
end
|
43
52
|
|
@@ -66,6 +75,10 @@ class YamlRefResolver
|
|
66
75
|
@opt.on('-w', '--watch', 'glob pattern to watch cahnges') do
|
67
76
|
@watch = true
|
68
77
|
end
|
78
|
+
|
79
|
+
@opt.on('-j', '--json', 'output in json format') do
|
80
|
+
@json = true
|
81
|
+
end
|
69
82
|
end
|
70
83
|
|
71
84
|
def validate_input_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_ref_resolver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe-noh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: filewatcher
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.5.1
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: Resolves referencing to other YAML files.
|