chamber 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +1 -0
  4. data/LICENSE.txt +19 -0
  5. data/Rakefile +1 -0
  6. data/bin/chamber +1 -0
  7. data/lib/chamber.rb +1 -0
  8. data/lib/chamber/binary/heroku.rb +1 -0
  9. data/lib/chamber/binary/runner.rb +1 -0
  10. data/lib/chamber/binary/travis.rb +1 -0
  11. data/lib/chamber/commands/base.rb +1 -0
  12. data/lib/chamber/commands/comparable.rb +1 -0
  13. data/lib/chamber/commands/compare.rb +1 -0
  14. data/lib/chamber/commands/files.rb +1 -0
  15. data/lib/chamber/commands/heroku.rb +1 -0
  16. data/lib/chamber/commands/heroku/clear.rb +1 -0
  17. data/lib/chamber/commands/heroku/compare.rb +1 -0
  18. data/lib/chamber/commands/heroku/pull.rb +1 -0
  19. data/lib/chamber/commands/heroku/push.rb +1 -0
  20. data/lib/chamber/commands/initialize.rb +5 -3
  21. data/lib/chamber/commands/securable.rb +1 -0
  22. data/lib/chamber/commands/secure.rb +1 -0
  23. data/lib/chamber/commands/show.rb +1 -0
  24. data/lib/chamber/commands/travis.rb +1 -0
  25. data/lib/chamber/commands/travis/secure.rb +1 -0
  26. data/lib/chamber/configuration.rb +1 -0
  27. data/lib/chamber/context_resolver.rb +10 -7
  28. data/lib/chamber/decryption_key.rb +1 -0
  29. data/lib/chamber/encryption_methods/none.rb +17 -0
  30. data/lib/chamber/encryption_methods/public_key.rb +27 -0
  31. data/lib/chamber/encryption_methods/ssl.rb +60 -0
  32. data/lib/chamber/environmentable.rb +1 -0
  33. data/lib/chamber/errors/decryption_failure.rb +1 -0
  34. data/lib/chamber/file.rb +9 -1
  35. data/lib/chamber/file_set.rb +4 -3
  36. data/lib/chamber/filters/boolean_conversion_filter.rb +2 -1
  37. data/lib/chamber/filters/decryption_filter.rb +20 -29
  38. data/lib/chamber/filters/encryption_filter.rb +29 -14
  39. data/lib/chamber/filters/environment_filter.rb +2 -1
  40. data/lib/chamber/filters/failed_decryption_filter.rb +3 -2
  41. data/lib/chamber/filters/insecure_filter.rb +1 -0
  42. data/lib/chamber/filters/namespace_filter.rb +2 -1
  43. data/lib/chamber/filters/secure_filter.rb +2 -1
  44. data/lib/chamber/filters/translate_secure_keys_filter.rb +2 -1
  45. data/lib/chamber/instance.rb +1 -0
  46. data/lib/chamber/namespace_set.rb +4 -3
  47. data/lib/chamber/rails.rb +1 -0
  48. data/lib/chamber/rails/railtie.rb +3 -1
  49. data/lib/chamber/rubinius_fix.rb +1 -0
  50. data/lib/chamber/settings.rb +23 -18
  51. data/lib/chamber/version.rb +2 -1
  52. data/spec/lib/chamber/commands/files_spec.rb +5 -2
  53. data/spec/lib/chamber/commands/heroku/clear_spec.rb +1 -0
  54. data/spec/lib/chamber/commands/heroku/compare_spec.rb +1 -0
  55. data/spec/lib/chamber/commands/heroku/pull_spec.rb +1 -0
  56. data/spec/lib/chamber/commands/heroku/push_spec.rb +1 -0
  57. data/spec/lib/chamber/commands/secure_spec.rb +5 -2
  58. data/spec/lib/chamber/commands/show_spec.rb +1 -0
  59. data/spec/lib/chamber/context_resolver_spec.rb +8 -5
  60. data/spec/lib/chamber/file_set_spec.rb +55 -52
  61. data/spec/lib/chamber/file_spec.rb +43 -9
  62. data/spec/lib/chamber/filters/boolean_conversion_filter_spec.rb +14 -5
  63. data/spec/lib/chamber/filters/decryption_filter_spec.rb +85 -9
  64. data/spec/lib/chamber/filters/encryption_filter_spec.rb +76 -10
  65. data/spec/lib/chamber/filters/environment_filter_spec.rb +9 -2
  66. data/spec/lib/chamber/filters/failed_decryption_filter_spec.rb +7 -6
  67. data/spec/lib/chamber/filters/insecure_filter_spec.rb +12 -4
  68. data/spec/lib/chamber/filters/namespace_filter_spec.rb +33 -14
  69. data/spec/lib/chamber/filters/secure_filter_spec.rb +8 -3
  70. data/spec/lib/chamber/filters/translate_secure_keys_filter_spec.rb +10 -3
  71. data/spec/lib/chamber/namespace_set_spec.rb +6 -3
  72. data/spec/lib/chamber/settings_spec.rb +36 -25
  73. data/spec/lib/chamber_spec.rb +25 -10
  74. data/spec/rails-2-test/config/application.rb +1 -0
  75. data/spec/rails-3-test/config/application.rb +1 -0
  76. data/spec/rails-4-test/config/application.rb +1 -0
  77. metadata +35 -9
  78. metadata.gz.sig +0 -0
  79. data/LICENSE +0 -22
@@ -1,13 +1,18 @@
1
+ # frozen_string_literal: true
1
2
  require 'openssl'
2
3
  require 'base64'
3
4
  require 'hashie/mash'
4
5
  require 'yaml'
6
+ require 'chamber/encryption_methods/public_key'
7
+ require 'chamber/encryption_methods/ssl'
8
+ require 'chamber/encryption_methods/none'
5
9
 
6
10
  module Chamber
7
11
  module Filters
8
12
  class EncryptionFilter
9
- SECURE_KEY_TOKEN = /\A_secure_/
10
- BASE64_STRING_PATTERN = %r{\A[A-Za-z0-9\+\/]{342}==\z}
13
+ SECURE_KEY_TOKEN = /\A_secure_/
14
+ BASE64_STRING_PATTERN = %r{\A[A-Za-z0-9\+\/]{342}==\z}
15
+ LARGE_DATA_STRING_PATTERN = %r{\A([A-Za-z0-9\+\/#]*\={0,2})#([A-Za-z0-9\+\/#]*\={0,2})#([A-Za-z0-9\+\/#]*\={0,2})\z} # rubocop:disable Metrics/LineLength
11
16
 
12
17
  def initialize(options = {})
13
18
  self.encryption_key = options.fetch(:encryption_key, nil)
@@ -15,7 +20,7 @@ class EncryptionFilter
15
20
  end
16
21
 
17
22
  def self.execute(options = {})
18
- new(options).send(:execute)
23
+ new(options).__send__(:execute)
19
24
  end
20
25
 
21
26
  protected
@@ -27,17 +32,13 @@ class EncryptionFilter
27
32
  settings = Hashie::Mash.new
28
33
 
29
34
  raw_data.each_pair do |key, value|
30
- if value.respond_to? :each_pair
31
- value = execute(value)
32
- elsif key.match(SECURE_KEY_TOKEN)
33
- unless value.respond_to?(:match) && value.match(BASE64_STRING_PATTERN)
34
- serialized_value = YAML.dump(value)
35
- encrypted_string = encryption_key.public_encrypt(serialized_value)
36
- value = Base64.strict_encode64(encrypted_string)
37
- end
38
- end
39
-
40
- settings[key] = value
35
+ settings[key] = if value.respond_to? :each_pair
36
+ execute(value)
37
+ elsif key.match(SECURE_KEY_TOKEN)
38
+ encryption_method(value).encrypt(key, value, encryption_key)
39
+ else
40
+ value
41
+ end
41
42
  end
42
43
 
43
44
  settings
@@ -54,6 +55,20 @@ class EncryptionFilter
54
55
 
55
56
  @encryption_key = OpenSSL::PKey::RSA.new(key_content)
56
57
  end
58
+
59
+ def encryption_method(value)
60
+ if value.respond_to?(:match) && value.match(BASE64_STRING_PATTERN)
61
+ EncryptionMethods::None
62
+ else
63
+ serialized_value = YAML.dump(value)
64
+
65
+ if serialized_value.length <= 128
66
+ EncryptionMethods::PublicKey
67
+ else
68
+ EncryptionMethods::Ssl
69
+ end
70
+ end
71
+ end
57
72
  end
58
73
  end
59
74
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'chamber/environmentable'
2
3
 
3
4
  module Chamber
@@ -54,7 +55,7 @@ class EnvironmentFilter
54
55
  #
55
56
  #
56
57
  def self.execute(options = {})
57
- new(options).send(:execute)
58
+ new(options).__send__(:execute)
58
59
  end
59
60
 
60
61
  protected
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'chamber/errors/decryption_failure'
2
3
 
3
4
  module Chamber
@@ -11,7 +12,7 @@ class FailedDecryptionFilter
11
12
  end
12
13
 
13
14
  def self.execute(options = {})
14
- new(options).send(:execute)
15
+ new(options).__send__(:execute)
15
16
  end
16
17
 
17
18
  protected
@@ -30,7 +31,7 @@ class FailedDecryptionFilter
30
31
 
31
32
  fail Chamber::Errors::DecryptionFailure,
32
33
  "Failed to decrypt #{key} (with an encrypted value of '#{value}') " \
33
- 'in your settings.'
34
+ "in your settings."
34
35
  end
35
36
  end
36
37
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'hashie/mash'
2
3
  require 'chamber/filters/secure_filter'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'hashie/mash'
2
3
 
3
4
  module Chamber
@@ -9,7 +10,7 @@ class NamespaceFilter
9
10
  end
10
11
 
11
12
  def self.execute(options = {})
12
- new(options).send(:execute)
13
+ new(options).__send__(:execute)
13
14
  end
14
15
 
15
16
  protected
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'hashie/mash'
2
3
 
3
4
  module Chamber
@@ -10,7 +11,7 @@ class SecureFilter
10
11
  end
11
12
 
12
13
  def self.execute(options = {})
13
- new(options).send(:execute)
14
+ new(options).__send__(:execute)
14
15
  end
15
16
 
16
17
  protected
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'hashie/mash'
2
3
 
3
4
  module Chamber
@@ -10,7 +11,7 @@ class TranslateSecureKeysFilter
10
11
  end
11
12
 
12
13
  def self.execute(options = {})
13
- new(options).send(:execute)
14
+ new(options).__send__(:execute)
14
15
  end
15
16
 
16
17
  protected
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'chamber/configuration'
2
3
  require 'chamber/file_set'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'set'
2
3
 
3
4
  ###
@@ -83,7 +84,7 @@ class NamespaceSet
83
84
  namespaces.to_a
84
85
  end
85
86
 
86
- alias_method :to_a, :to_ary
87
+ alias to_a to_ary
87
88
 
88
89
  ###
89
90
  # Internal: Determines whether a NamespaceSet is equal to another array-like
@@ -102,8 +103,8 @@ class NamespaceSet
102
103
  # Returns a Boolean
103
104
  #
104
105
  def eql?(other)
105
- other.is_a?(NamespaceSet) &&
106
- namespaces == other.namespaces
106
+ other.is_a?(NamespaceSet) &&
107
+ namespaces == other.namespaces
107
108
  end
108
109
 
109
110
  protected
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  require 'chamber/rails/railtie' if defined?(::Rails)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'socket'
2
3
 
3
4
  module Chamber
@@ -7,7 +8,8 @@ class Railtie < ::Rails::Railtie
7
8
  Chamber.load(basepath: ::Rails.root.join('config'),
8
9
  namespaces: {
9
10
  environment: -> { ::Rails.env },
10
- hostname: -> { Socket.gethostname } })
11
+ hostname: -> { Socket.gethostname },
12
+ })
11
13
  end
12
14
  end
13
15
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'pathname'
2
3
 
3
4
  unless Pathname.instance_methods.include?(:write)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'hashie/mash'
2
3
  require 'chamber/namespace_set'
3
4
  require 'chamber/filters/namespace_filter'
@@ -22,16 +23,16 @@ class Settings
22
23
  self.raw_data = options[:settings] || {}
23
24
  self.decryption_key = options[:decryption_key]
24
25
  self.encryption_key = options[:encryption_key]
25
- self.pre_filters = options[:pre_filters] || [
26
- Filters::NamespaceFilter,
27
- ]
28
- self.post_filters = options[:post_filters] || [
29
- Filters::DecryptionFilter,
30
- Filters::EnvironmentFilter,
31
- Filters::FailedDecryptionFilter,
32
- Filters::BooleanConversionFilter,
33
- Filters::TranslateSecureKeysFilter,
34
- ]
26
+ self.pre_filters = options[:pre_filters] || [
27
+ Filters::NamespaceFilter,
28
+ ]
29
+ self.post_filters = options[:post_filters] || [
30
+ Filters::DecryptionFilter,
31
+ Filters::EnvironmentFilter,
32
+ Filters::FailedDecryptionFilter,
33
+ Filters::BooleanConversionFilter,
34
+ Filters::TranslateSecureKeysFilter,
35
+ ]
35
36
  end
36
37
 
37
38
  ###
@@ -186,7 +187,8 @@ class Settings
186
187
  encryption_key: encryption_key || other_settings.encryption_key,
187
188
  decryption_key: decryption_key || other_settings.decryption_key,
188
189
  namespaces: (namespaces + other_settings.namespaces),
189
- settings: raw_data.merge(other_settings.raw_data))
190
+ settings: raw_data.merge(other_settings.raw_data),
191
+ )
190
192
  end
191
193
 
192
194
  ###
@@ -205,29 +207,32 @@ class Settings
205
207
  # Returns a Boolean
206
208
  #
207
209
  def eql?(other)
208
- other.is_a?(Chamber::Settings) &&
209
- data == other.data &&
210
+ other.is_a?(Chamber::Settings) &&
211
+ data == other.data &&
210
212
  namespaces == other.namespaces
211
213
  end
212
214
 
213
215
  def securable
214
216
  Settings.new(metadata.merge(
215
217
  settings: raw_data,
216
- pre_filters: [Filters::SecureFilter]))
218
+ pre_filters: [Filters::SecureFilter],
219
+ ))
217
220
  end
218
221
 
219
222
  def secure
220
223
  Settings.new(metadata.merge(
221
224
  settings: raw_data,
222
225
  pre_filters: [Filters::EncryptionFilter],
223
- post_filters: [Filters::TranslateSecureKeysFilter]))
226
+ post_filters: [Filters::TranslateSecureKeysFilter],
227
+ ))
224
228
  end
225
229
 
226
230
  def insecure
227
231
  Settings.new(metadata.merge(
228
232
  settings: raw_data,
229
233
  pre_filters: [Filters::InsecureFilter],
230
- post_filters: [Filters::TranslateSecureKeysFilter]))
234
+ post_filters: [Filters::TranslateSecureKeysFilter],
235
+ ))
231
236
  end
232
237
 
233
238
  protected
@@ -247,14 +252,14 @@ class Settings
247
252
  end
248
253
 
249
254
  def raw_data
250
- @filtered_raw_data ||= pre_filters.reduce(@raw_data) do |filtered_data, filter|
255
+ @filtered_raw_data ||= pre_filters.inject(@raw_data) do |filtered_data, filter|
251
256
  filter.execute({ data: filtered_data }.
252
257
  merge(metadata))
253
258
  end
254
259
  end
255
260
 
256
261
  def data
257
- @data ||= post_filters.reduce(raw_data) do |filtered_data, filter|
262
+ @data ||= post_filters.inject(raw_data) do |filtered_data, filter|
258
263
  filter.execute({ data: filtered_data }.
259
264
  merge(metadata))
260
265
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Chamber
2
- VERSION = '2.8.0'
3
+ VERSION = '2.9.0'.freeze
3
4
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/files'
3
4
 
@@ -6,8 +7,10 @@ module Commands
6
7
  describe Files do
7
8
  let(:rootpath) { ::File.expand_path('./spec/fixtures') }
8
9
  let(:options) do
9
- { basepath: rootpath,
10
- rootpath: rootpath }
10
+ {
11
+ basepath: rootpath,
12
+ rootpath: rootpath,
13
+ }
11
14
  end
12
15
 
13
16
  it 'can return values formatted as environment variables' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/heroku/clear'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/heroku/compare'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/heroku/pull'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/heroku/push'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/secure'
3
4
  require 'fileutils'
@@ -9,10 +10,12 @@ describe Secure do
9
10
  let(:settings_directory) { rootpath + 'settings' }
10
11
  let(:settings_filename) { settings_directory + 'unencrypted.yml' }
11
12
  let(:options) do
12
- { basepath: rootpath,
13
+ {
14
+ basepath: rootpath,
13
15
  rootpath: rootpath,
14
16
  encryption_key: rootpath + '../spec_key',
15
- shell: double.as_null_object }
17
+ shell: double.as_null_object,
18
+ }
16
19
  end
17
20
 
18
21
  before(:each) do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/commands/show'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/context_resolver'
3
4
 
@@ -34,7 +35,7 @@ describe ContextResolver do
34
35
  options = ContextResolver.resolve(rootpath: './app',
35
36
  namespaces: 'ns')
36
37
 
37
- expect(options[:basepath].to_s).to eql './app'
38
+ expect(options[:basepath].to_s).to eql './app'
38
39
  end
39
40
 
40
41
  it 'always sets the basepath to a Pathname even if it is passed in as a String' do
@@ -46,8 +47,10 @@ describe ContextResolver do
46
47
  it 'sets the default files if none are passed in' do
47
48
  options = ContextResolver.resolve(basepath: './app')
48
49
 
49
- expect(options[:files].map(&:to_s)).to eql ['./app/settings*.yml',
50
- './app/settings']
50
+ expect(options[:files].map(&:to_s)).to eql [
51
+ './app/settings*.yml',
52
+ './app/settings',
53
+ ]
51
54
  end
52
55
 
53
56
  it 'can handle if keys are passed as strings' do
@@ -64,13 +67,13 @@ describe ContextResolver do
64
67
 
65
68
  options = ContextResolver.resolve
66
69
 
67
- expect(options[:rootpath].to_s).to eql 'my_dir'
70
+ expect(options[:rootpath].to_s).to eql 'my_dir'
68
71
  end
69
72
 
70
73
  it 'sets the encryption key to the default if not passed in' do
71
74
  options = ContextResolver.resolve(rootpath: rails_3_path)
72
75
 
73
- expect(options[:encryption_key].to_s).to include 'rails-3-test/.chamber.pub.pem'
76
+ expect(options[:encryption_key].to_s).to include 'rails-3-test/.chamber.pub.pem'
74
77
  end
75
78
 
76
79
  it 'sets the decryption key to the default if not passed in' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rspectacular'
2
3
  require 'chamber/file_set'
3
4
  require 'fileutils'
@@ -16,10 +17,10 @@ describe FileSet do
16
17
 
17
18
  file_set = FileSet.new files: '/tmp/settings'
18
19
 
19
- expect(file_set.filenames).to eql [
20
- '/tmp/settings/another_settings_file.yml',
21
- '/tmp/settings/some_settings_file.yml',
22
- ]
20
+ expect(file_set.filenames).to eql [
21
+ '/tmp/settings/another_settings_file.yml',
22
+ '/tmp/settings/some_settings_file.yml',
23
+ ]
23
24
 
24
25
  ::FileUtils.rm_rf('/tmp/settings')
25
26
  end
@@ -30,10 +31,10 @@ describe FileSet do
30
31
 
31
32
  file_set = FileSet.new files: '/tmp/settings/*.yml'
32
33
 
33
- expect(file_set.filenames).to eql [
34
- '/tmp/settings/another_settings_file.yml',
35
- '/tmp/settings/some_settings_file.yml',
36
- ]
34
+ expect(file_set.filenames).to eql [
35
+ '/tmp/settings/another_settings_file.yml',
36
+ '/tmp/settings/some_settings_file.yml',
37
+ ]
37
38
 
38
39
  ::FileUtils.rm_rf('/tmp/settings')
39
40
  end
@@ -44,10 +45,10 @@ describe FileSet do
44
45
 
45
46
  file_set = FileSet.new files: '/tmp/settings'
46
47
 
47
- expect(file_set.filenames).to eql [
48
- '/tmp/settings/another_settings_file.yml.erb',
49
- '/tmp/settings/some_settings_file.yml',
50
- ]
48
+ expect(file_set.filenames).to eql [
49
+ '/tmp/settings/another_settings_file.yml.erb',
50
+ '/tmp/settings/some_settings_file.yml',
51
+ ]
51
52
 
52
53
  ::FileUtils.rm_rf('/tmp/settings')
53
54
  end
@@ -59,8 +60,8 @@ describe FileSet do
59
60
  namespaces: ['blue']
60
61
 
61
62
  expect(file_set.filenames).to eql [
62
- '/tmp/settings/settings-blue.yml',
63
- ]
63
+ '/tmp/settings/settings-blue.yml',
64
+ ]
64
65
 
65
66
  ::FileUtils.rm_f('/tmp/settings/settings-blue.yml')
66
67
  end
@@ -85,8 +86,8 @@ describe FileSet do
85
86
  namespaces: ['blue']
86
87
 
87
88
  expect(file_set.filenames).to eql [
88
- '/tmp/dash-set/settings.yml',
89
- ]
89
+ '/tmp/dash-set/settings.yml',
90
+ ]
90
91
 
91
92
  ::FileUtils.rm_r('/tmp/dash-set/settings.yml')
92
93
  end
@@ -95,13 +96,13 @@ describe FileSet do
95
96
  ::File.new('/tmp/settings.yml', 'w+')
96
97
 
97
98
  file_set = FileSet.new files: [
98
- '/tmp/settings.yml',
99
- '/tmp/settings.yml',
100
- ]
99
+ '/tmp/settings.yml',
100
+ '/tmp/settings.yml',
101
+ ]
101
102
 
102
103
  expect(file_set.filenames).to eql [
103
- '/tmp/settings.yml',
104
- ]
104
+ '/tmp/settings.yml',
105
+ ]
105
106
 
106
107
  ::FileUtils.rm_f('/tmp/settings.yml')
107
108
  end
@@ -111,14 +112,14 @@ describe FileSet do
111
112
  ::File.new('/tmp/settings/new_file.yml', 'w+')
112
113
 
113
114
  file_set = FileSet.new files: [
114
- '/tmp/settings.yml',
115
- '/tmp/settings/*.yml',
116
- ]
115
+ '/tmp/settings.yml',
116
+ '/tmp/settings/*.yml',
117
+ ]
117
118
 
118
- expect(file_set.filenames).to eql [
119
- '/tmp/settings.yml',
120
- '/tmp/settings/new_file.yml',
121
- ]
119
+ expect(file_set.filenames).to eql [
120
+ '/tmp/settings.yml',
121
+ '/tmp/settings/new_file.yml',
122
+ ]
122
123
 
123
124
  ::FileUtils.rm_rf('/tmp/settings*')
124
125
  end
@@ -128,9 +129,9 @@ describe FileSet do
128
129
 
129
130
  file_set = FileSet.new files: '/tmp/settings.yml'
130
131
 
131
- expect(file_set.filenames).to eql [
132
- '/tmp/settings.yml',
133
- ]
132
+ expect(file_set.filenames).to eql [
133
+ '/tmp/settings.yml',
134
+ ]
134
135
 
135
136
  ::FileUtils.rm_rf('/tmp/settings*')
136
137
  end
@@ -143,17 +144,17 @@ describe FileSet do
143
144
  namespaces: %w{blue green}
144
145
 
145
146
  expect(file_set.filenames).to eql [
146
- '/tmp/settings/settings-blue.yml',
147
- '/tmp/settings/settings-green.yml',
148
- ]
147
+ '/tmp/settings/settings-blue.yml',
148
+ '/tmp/settings/settings-green.yml',
149
+ ]
149
150
 
150
151
  file_set = FileSet.new files: '/tmp/settings/settings*.yml',
151
152
  namespaces: %w{green blue}
152
153
 
153
154
  expect(file_set.filenames).to eql [
154
- '/tmp/settings/settings-green.yml',
155
- '/tmp/settings/settings-blue.yml',
156
- ]
155
+ '/tmp/settings/settings-green.yml',
156
+ '/tmp/settings/settings-blue.yml',
157
+ ]
157
158
 
158
159
  ::FileUtils.rm_f('/tmp/settings/settings*.yml')
159
160
  end
@@ -166,9 +167,9 @@ describe FileSet do
166
167
  namespaces: ['blue']
167
168
 
168
169
  expect(file_set.filenames).to eql [
169
- '/tmp/settings.yml',
170
- '/tmp/settings-blue.yml',
171
- ]
170
+ '/tmp/settings.yml',
171
+ '/tmp/settings-blue.yml',
172
+ ]
172
173
 
173
174
  ::FileUtils.rm_f('/tmp/settings*.yml')
174
175
  end
@@ -181,9 +182,9 @@ describe FileSet do
181
182
  namespaces: ['blue']
182
183
 
183
184
  expect(file_set.filenames).to eql [
184
- '/tmp/settings.yml',
185
- '/tmp/settings-blue.yml',
186
- ]
185
+ '/tmp/settings.yml',
186
+ '/tmp/settings-blue.yml',
187
+ ]
187
188
 
188
189
  ::FileUtils.rm_f('/tmp/settings*.yml')
189
190
  end
@@ -194,14 +195,16 @@ describe FileSet do
194
195
  ::File.new('/tmp/settings/credentials-development.yml', 'w+')
195
196
  ::File.new('/tmp/settings/settings.yml', 'w+')
196
197
 
197
- file_set = FileSet.new files: ['/tmp/settings/credentials*.yml',
198
- '/tmp/settings/settings*.yml'],
198
+ file_set = FileSet.new files: [
199
+ '/tmp/settings/credentials*.yml',
200
+ '/tmp/settings/settings*.yml',
201
+ ],
199
202
  namespaces: ['development']
200
203
 
201
204
  expect(file_set.filenames).to eql [
202
- '/tmp/settings/credentials-development.yml',
203
- '/tmp/settings/settings.yml',
204
- ]
205
+ '/tmp/settings/credentials-development.yml',
206
+ '/tmp/settings/settings.yml',
207
+ ]
205
208
 
206
209
  ::FileUtils.rm_rf('/tmp/settings')
207
210
  end
@@ -212,10 +215,10 @@ describe FileSet do
212
215
 
213
216
  file_set = FileSet.new files: '/tmp/settings/*.yml'
214
217
 
215
- expect(file_set.filenames).to eql [
216
- '/tmp/settings/another_settings_file.yml',
217
- '/tmp/settings/some_settings_file.yml',
218
- ]
218
+ expect(file_set.filenames).to eql [
219
+ '/tmp/settings/another_settings_file.yml',
220
+ '/tmp/settings/some_settings_file.yml',
221
+ ]
219
222
 
220
223
  ::FileUtils.rm_rf('/tmp/settings')
221
224
  end