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: b10f5c037b215f0a448cae2451d971aff488a75f
4
- data.tar.gz: 04da69b1f2bc39a0b63415c566dfbc3cc7850834
3
+ metadata.gz: e0158b5db88a7322e9e0c2aef2dba1dca08ed9bd
4
+ data.tar.gz: 3e80f4ae117b047fbcfda02d56396e01a6f7a013
5
5
  SHA512:
6
- metadata.gz: fbb4fba2a71ce2ae36b45da1bf2391b5a2dd59049f4b40a345afb2a699e66ae8dbf9fcafc0bd3c7cb8aab7303188a5ec167c070acd1718e0df80792316f1c6c3
7
- data.tar.gz: fd138aa8dfa40f55517879f6b6cff4ab5a6a06b333581b9f99dc467c894e5ce58f28383ed328f94bace8295b349ad4d10b08a2362c413d0f521fceb0fbde331e
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
@@ -1,3 +1,3 @@
1
1
  module StackedConfig
2
- VERSION = '1.0.9'
2
+ VERSION = '1.1.0'
3
3
  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 = ['--help']
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stacked_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent B.