conifer 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/Gemfile.lock +2 -1
- data/lib/conifer/file.rb +5 -5
- data/lib/conifer/version.rb +1 -1
- data/lib/conifer.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d91f2c9c3d4253a4772d4a5a9cbca13f5a3313b4158e598929aa0797e6e9f0d
|
4
|
+
data.tar.gz: b21e1ae6db73299773d4cb7804fb83ef9c0febe3d68b7cf4cd6269de12b3ad9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5863b2cdefb74a782c170d366c97bc1917cddafd24d95cda9423585b16b7db991a01fd3cc9f0dd649d727e934fca9abe1d652cdc3a0145a4e4d5180787e65df2
|
7
|
+
data.tar.gz: a76f8bc190504af328f4a20aac8377c64a3995aab245e1dfcb139cdc7e2f76ce55b09a7021362a44265633ce70bd2ec43bbbce7baffd44d70498703505c950eb
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby 3.1.
|
1
|
+
ruby 3.1.2
|
data/Gemfile.lock
CHANGED
data/lib/conifer/file.rb
CHANGED
@@ -8,14 +8,14 @@ module Conifer
|
|
8
8
|
NotFoundError = Class.new(StandardError)
|
9
9
|
UnsupportedFormatError = Class.new(StandardError)
|
10
10
|
|
11
|
-
attr_reader :name, :dir, :prefix, :format, :
|
11
|
+
attr_reader :name, :dir, :prefix, :format, :options
|
12
12
|
|
13
|
-
def initialize(name, dir:, prefix: nil, format: :yml,
|
13
|
+
def initialize(name, dir:, prefix: nil, format: :yml, **options)
|
14
14
|
@name = name
|
15
15
|
@dir = dir
|
16
16
|
@prefix = prefix
|
17
17
|
@format = format
|
18
|
-
@
|
18
|
+
@options = options
|
19
19
|
end
|
20
20
|
|
21
21
|
def [](key)
|
@@ -26,9 +26,9 @@ module Conifer
|
|
26
26
|
def parsed
|
27
27
|
@parsed ||= case format
|
28
28
|
when :yml, :yaml
|
29
|
-
YAML.safe_load(ERB.new(::File.read(path)).result,
|
29
|
+
YAML.safe_load(ERB.new(::File.read(path)).result, **options)
|
30
30
|
when :json
|
31
|
-
JSON.parse(ERB.new(::File.read(path)).result)
|
31
|
+
JSON.parse(ERB.new(::File.read(path)).result, **options)
|
32
32
|
else
|
33
33
|
raise UnsupportedFormatError, "Format '#{format}' is not supported"
|
34
34
|
end
|
data/lib/conifer/version.rb
CHANGED
data/lib/conifer.rb
CHANGED
@@ -11,7 +11,7 @@ module Conifer
|
|
11
11
|
# rubocop:disable Metrics/ParameterLists
|
12
12
|
module ClassMethods
|
13
13
|
def conifer(name, prefix: nil, dir: nil, format: :yml, method: ::File.basename(name.to_s, ".#{format}"),
|
14
|
-
singleton: false,
|
14
|
+
singleton: false, **options)
|
15
15
|
dir ||= ::File.expand_path(::File.dirname(caller_locations.first.path))
|
16
16
|
|
17
17
|
body = proc do
|
@@ -19,7 +19,7 @@ module Conifer
|
|
19
19
|
|
20
20
|
instance_variable_set "@conifer_#{method}",
|
21
21
|
Conifer::File.new(name, prefix: prefix, format: format,
|
22
|
-
dir: dir,
|
22
|
+
dir: dir, **options).tap(&:validate!)
|
23
23
|
end
|
24
24
|
|
25
25
|
singleton ? define_singleton_method(method, &body) : define_method(method, &body)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conifer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hamed Asghari
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: climate_control
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.3.
|
144
|
+
rubygems_version: 3.3.7
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Conifer allows you to easily manage YAML configuration files and import them
|