a9n 0.8.2 → 0.8.3

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
  SHA256:
3
- metadata.gz: 64635e48744929de570a088a20cbd25dfd0f0d8e436f315bafda97fe5ede1201
4
- data.tar.gz: 797e01d61523df13ec756aeb118554736436dc65bcb96e89862bdcae558efb63
3
+ metadata.gz: 37c61d91df158a98905540788736c8cb991ac74ad07b7e731d3cc4c90a7db51a
4
+ data.tar.gz: 91b249ed588ec98a51d630cc3ead8fd3940e1aac5b2a37c052fb6d90419cd9bc
5
5
  SHA512:
6
- metadata.gz: ef3c1cf8cdc5b46b9a97ce6cea4527cd24bb069790dcf06359cab9d371484da55d397b38b0ec87653fc76cf51f92c567ba2daf4dcd1c5253f1e000c4d1148a6e
7
- data.tar.gz: 4fe030566efa78a7845657c95dda4e2c0eddc8799b449343cb00995227f9a5183da5340bb37100ebc7835b51a70450b4310512e133b4ebdbee31687ebd31d12d
6
+ metadata.gz: a4c51ba32a2bd745ac6902f6ae53f0cfdb7f9f19d44fa0c35b615ba61e3d87ace7009bf5aad7cb06b16abd0a5e1c58e383210910cc186c9616dcba491a884848
7
+ data.tar.gz: b1ebbf900ae993a785ed432d514033c0b86d108fa3b9b94ca1ac1096cddfaf4952843bd4a21e291f934e54898efead2fd9b9f4bc88bfad8b496cd58247bbff43
data/lib/a9n.rb CHANGED
@@ -19,7 +19,7 @@ module A9n
19
19
 
20
20
  class << self
21
21
  def env
22
- @env ||= ::A9n::StringInquirer.new(app_env || env_var('RAILS_ENV') || env_var('RACK_ENV') || env_var('APP_ENV'))
22
+ @env ||= ::A9n::StringInquirer.new(app_env || env_var('RAILS_ENV') || env_var('RACK_ENV') || env_var('APP_ENV') || fail(UnknownEnvError))
23
23
  end
24
24
 
25
25
  def env=(value)
@@ -50,6 +50,10 @@ module A9n
50
50
  @root = path.to_s.empty? ? nil : Pathname.new(path.to_s)
51
51
  end
52
52
 
53
+ def groups
54
+ ['default', env].compact
55
+ end
56
+
53
57
  def rails_app
54
58
  defined?(Rails) ? Rails : nil
55
59
  end
@@ -4,4 +4,5 @@ module A9n
4
4
  class MissingConfigurationVariablesError < StandardError; end
5
5
  class NoSuchConfigurationVariableError < StandardError; end
6
6
  class MissingEnvVariableError < StandardError; end
7
+ class UnknownEnvError < StandardError; end
7
8
  end
@@ -1,3 +1,3 @@
1
1
  module A9n
2
- VERSION = '0.8.2'.freeze
2
+ VERSION = '0.8.3'.freeze
3
3
  end
@@ -37,6 +37,22 @@ RSpec.describe A9n do
37
37
  expect(subject.env.production?).to eq(false)
38
38
  end
39
39
  end
40
+
41
+ context 'unknown env' do
42
+ it do
43
+ expect { subject.env }.to raise_error(A9n::UnknownEnvError)
44
+ end
45
+ end
46
+ end
47
+
48
+ describe '.groups' do
49
+ before do
50
+ subject.env = 'development'
51
+ end
52
+
53
+ it do
54
+ expect(subject.groups).to eq(['default', 'development'])
55
+ end
40
56
  end
41
57
 
42
58
  describe '.app' do
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.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2019-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codeclimate-test-reporter
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.0.3
160
+ rubygems_version: 3.0.6
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: a9n is a tool to keep ruby/rails apps extra configuration easily maintainable