a9n 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c19e68e2155ba1e5eb4b94f13f4345cec6a6550
4
- data.tar.gz: d49bfe9ff3a925e4117a094b190b57493acc0478
3
+ metadata.gz: 9d73a21b7d21d7f80d8a209937f548c9bb0a05eb
4
+ data.tar.gz: b7ba978f6d03444194db9a0da1a939d1a865ebfa
5
5
  SHA512:
6
- metadata.gz: db39e6ebef8b3cbff249bfcd43a57b42fe276886903df28e772ba5f59da862fa8e72d3656b38c98a0f85dc7117c4538dc7d88e00272047cd1473994d877637b6
7
- data.tar.gz: 18c31604129a4785bac83c6d4d28be8225eff924cb0f1b9ae96c32ccd61fe578d3125f2504087681a05212ea0d9e6d12f45f291009353e8e5f0ac73dd245adf1
6
+ metadata.gz: 0fad65cf52480580df5269c90530b1c767a6a77cd4525dc1e3b66fa0c22148bdc3d5761d067cfac942136892e59e5aeaae2ec84348fc25b1ef30c8dce7efcb83
7
+ data.tar.gz: 3481c5165d7ac0e7a8b535ec9f9bffb098c6db6059c56a4912e00bdc44767589d3011cf7ebd28bac41837f193fd265d0c873baea34b8796f0e02fa2099985144
@@ -1 +1 @@
1
- 2.0.0@a9n
1
+ 2.1.5@a9n
data/lib/a9n.rb CHANGED
@@ -57,11 +57,11 @@ module A9n
57
57
  end
58
58
 
59
59
  def var_name_for(file)
60
- :"@#{File.basename(file.to_s, '.*')}"
60
+ :"@#{File.basename(file.to_s).split('.').first}"
61
61
  end
62
62
 
63
63
  def default_files
64
- [root.join("config/#{DEFAULT_SCOPE}.yml").to_s] + Dir[root.join("config/a9n/*.yml")]
64
+ [root.join("config/#{DEFAULT_SCOPE}.yml").to_s] + Dir[root.join("config/a9n/*.{yml,yml.erb}")]
65
65
  end
66
66
 
67
67
  def load(*files)
@@ -53,7 +53,7 @@ module A9n
53
53
 
54
54
  private
55
55
 
56
- def verify!(example, local)
56
+ def verify!(local, example)
57
57
  missing_keys = example.keys - local.keys
58
58
  if missing_keys.any?
59
59
  raise A9n::MissingConfigurationVariables.new("Following variables are missing in #{local_file} file: #{missing_keys.join(",")}")
@@ -1,3 +1,3 @@
1
1
  module A9n
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -38,4 +38,12 @@ describe A9n do
38
38
  expect(subject.mandrill.api_key).to eq("asdf1234")
39
39
  }
40
40
  end
41
+
42
+ context "extra config file with erb" do
43
+ it {
44
+ expect(subject.cloud).to be_kind_of(A9n::Struct)
45
+ expect(subject.cloud.username).to eq("testuser")
46
+ expect(subject.cloud.password).to eq("qwerty")
47
+ }
48
+ end
41
49
  end
@@ -89,10 +89,13 @@ describe A9n::Loader do
89
89
  expect(described_class).to receive(:load_yml).with(subject.example_file, env).and_return(example_config)
90
90
  expect(described_class).to receive(:load_yml).with(subject.local_file, env).and_return(local_config)
91
91
  end
92
- it "raises expection" do
92
+
93
+ let(:missing_variables_names) { example_config.keys - local_config.keys }
94
+
95
+ it "raises expection with missing variables names" do
93
96
  expect {
94
97
  subject.load
95
- }.to raise_error(A9n::MissingConfigurationVariables)
98
+ }.to raise_error(A9n::MissingConfigurationVariables, /#{missing_variables_names.join(', ')}/)
96
99
  end
97
100
  end
98
101
  end
@@ -120,6 +123,12 @@ describe A9n::Loader do
120
123
  ENV["DWARF"] = "erbized dwarf"
121
124
  }
122
125
 
126
+ context 'when file has erb extension' do
127
+ let(:file_path) { File.join(root, "config/a9n/cloud.yml.erb") }
128
+
129
+ it_behaves_like "non-empty config file"
130
+ end
131
+
123
132
  context "having env and defaults data" do
124
133
  let(:file_path) { File.join(root, "config/configuration.yml") }
125
134
 
@@ -0,0 +1,3 @@
1
+ defaults:
2
+ username: "testuser"
3
+ password: "qwerty"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a9n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: a9n is a tool to keep ruby/rails apps extra configuration easily maintainable
14
14
  and verifiable
@@ -18,9 +18,9 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - .gitignore
22
- - .ruby-version
23
- - .travis.yml
21
+ - ".gitignore"
22
+ - ".ruby-version"
23
+ - ".travis.yml"
24
24
  - Gemfile
25
25
  - LICENSE
26
26
  - README.md
@@ -37,6 +37,7 @@ files:
37
37
  - spec/unit/a9n_spec.rb
38
38
  - spec/unit/loader_spec.rb
39
39
  - spec/unit/struct_spec.rb
40
+ - test_app/config/a9n/cloud.yml.erb
40
41
  - test_app/config/a9n/mandrill.yml
41
42
  - test_app/config/configuration.yml
42
43
  - test_app/config/configuration.yml.example
@@ -51,17 +52,17 @@ require_paths:
51
52
  - lib
52
53
  required_ruby_version: !ruby/object:Gem::Requirement
53
54
  requirements:
54
- - - '>='
55
+ - - ">="
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  required_rubygems_version: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - '>='
60
+ - - ">="
60
61
  - !ruby/object:Gem::Version
61
62
  version: '0'
62
63
  requirements: []
63
64
  rubyforge_project:
64
- rubygems_version: 2.2.2
65
+ rubygems_version: 2.4.3
65
66
  signing_key:
66
67
  specification_version: 4
67
68
  summary: a9n is a tool to keep ruby/rails apps extra configuration easily maintainable