fedux_org-stdlib 0.10.6 → 0.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fedux_org_stdlib/app_config.rb +7 -2
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/app_config_spec.rb +28 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 581b510bdcfc031ca357feb35d1cc3eb7bfb1ce3
|
4
|
+
data.tar.gz: 83bb71f27a2a1fdaedaa7dce820eb6a28f12abdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08a3e1bb4d16d5fb11e834738b725074570c8f3007335c5ef92937aca92173a975dd43d65b0233b120412bd7a4746f6bac007f23843ba031d09c20ab7747310f
|
7
|
+
data.tar.gz: 0198151c482ece2ab1a45953907a8156e8e6824cb960e0c5faa8b693c06c92b1e93863f9403cf14d67794dd0e39d1452773d5575defa283edbce2c65d5378c4c
|
data/Gemfile.lock
CHANGED
@@ -285,8 +285,13 @@ module FeduxOrgStdlib
|
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
-
|
289
|
-
|
288
|
+
# Convert config to yaml
|
289
|
+
def to_yaml(prepend: nil, **args)
|
290
|
+
yaml = Psych.dump to_h(**args).deep_stringify_keys
|
291
|
+
|
292
|
+
return yaml.split("\n").map { |l| l.prepend prepend }.join("\n") if prepend
|
293
|
+
|
294
|
+
yaml
|
290
295
|
end
|
291
296
|
|
292
297
|
private
|
data/spec/app_config_spec.rb
CHANGED
@@ -644,9 +644,7 @@ RSpec.describe AppConfig do
|
|
644
644
|
it 'dumps configuration to yaml' do
|
645
645
|
config_klass = Class.new(AppConfig) do
|
646
646
|
option :opt1, 'test1'
|
647
|
-
|
648
647
|
option :opt2, %w(test2 test2)
|
649
|
-
|
650
648
|
option :opt3, test3: 'value3'
|
651
649
|
|
652
650
|
def _class_name
|
@@ -673,9 +671,7 @@ RSpec.describe AppConfig do
|
|
673
671
|
it 'filters keys' do
|
674
672
|
config_klass = Class.new(AppConfig) do
|
675
673
|
option :opt1, 'test1'
|
676
|
-
|
677
674
|
option :opt2, %w(test2 test2)
|
678
|
-
|
679
675
|
option :opt3, test3: 'value3'
|
680
676
|
|
681
677
|
def _class_name
|
@@ -695,5 +691,33 @@ RSpec.describe AppConfig do
|
|
695
691
|
opt1: test1
|
696
692
|
EOS
|
697
693
|
end
|
694
|
+
|
695
|
+
it 'prepends lines' do
|
696
|
+
config_klass = Class.new(AppConfig) do
|
697
|
+
option :opt1, 'test1'
|
698
|
+
option :opt2, %w(test2 test2)
|
699
|
+
option :opt3, test3: 'value3'
|
700
|
+
|
701
|
+
def _class_name
|
702
|
+
'TestConfig'
|
703
|
+
end
|
704
|
+
|
705
|
+
def _module_name
|
706
|
+
'MyApplication'
|
707
|
+
end
|
708
|
+
end
|
709
|
+
|
710
|
+
config = config_klass.new
|
711
|
+
expect(config.to_yaml(prepend: '# ')).to eq <<-EOS.strip_heredoc.chomp
|
712
|
+
# ---
|
713
|
+
# opt1: test1
|
714
|
+
# opt2:
|
715
|
+
# - test2
|
716
|
+
# - test2
|
717
|
+
# opt3:
|
718
|
+
# test3: value3
|
719
|
+
EOS
|
720
|
+
end
|
721
|
+
|
698
722
|
end
|
699
723
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fedux_org-stdlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Meyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|