stacked_config 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0158b5db88a7322e9e0c2aef2dba1dca08ed9bd
|
4
|
+
data.tar.gz: 3e80f4ae117b047fbcfda02d56396e01a6f7a013
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a53fc2c107073a657985d86acddba0182a482c65d9b11f31269f757328431be2865bc2c2ec560dc71723a566a72719930060b94219f08b61b06789ce715906a
|
7
|
+
data.tar.gz: e8952818ffb801400d1b92ac26eb4e12f8e0537ff2435a3bda6dfca14ebdc1ddf795b489c70d9720a088dee64328d2342007f34b732a6603bca80939c4109144
|
@@ -42,6 +42,14 @@ module StackedConfig
|
|
42
42
|
slop_definition.to_s
|
43
43
|
end
|
44
44
|
|
45
|
+
def extra_parameters
|
46
|
+
save = ARGV.dup
|
47
|
+
return slop_definition.parse!.dup
|
48
|
+
ensure
|
49
|
+
ARGV.replace save
|
50
|
+
end
|
51
|
+
|
52
|
+
|
45
53
|
private
|
46
54
|
|
47
55
|
# Builds a nice separator
|
@@ -69,8 +77,6 @@ module StackedConfig
|
|
69
77
|
end
|
70
78
|
end
|
71
79
|
|
72
|
-
|
73
|
-
|
74
80
|
end
|
75
81
|
|
76
82
|
end
|
@@ -26,7 +26,7 @@ describe StackedConfig::Layers::CommandLineLayer do
|
|
26
26
|
|
27
27
|
context 'when command line parameter are passed' do
|
28
28
|
before(:all) {
|
29
|
-
ARGV
|
29
|
+
ARGV.replace ['--help']
|
30
30
|
}
|
31
31
|
|
32
32
|
it 'should end-up as a value in the layer' do
|
@@ -37,5 +37,19 @@ describe StackedConfig::Layers::CommandLineLayer do
|
|
37
37
|
|
38
38
|
end
|
39
39
|
|
40
|
+
context 'when extra command line parameter are passed (not part of a defined option)' do
|
41
|
+
let(:extra_options) {%w(extra1 extra2) }
|
42
|
+
let(:options) { %w(--help --verbose) + extra_options }
|
43
|
+
|
44
|
+
it 'should provide the extra options while leaving ARGV untouched' do
|
45
|
+
ARGV.replace options
|
46
|
+
subject.reload
|
47
|
+
expect(subject.extra_parameters).to eq extra_options
|
48
|
+
expect(ARGV).to eq options
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
40
54
|
|
41
55
|
end
|