a9n 1.0.0 → 1.2.2

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: 2a77715c45124cd831c118cd5d0ff571a4efd4b8a7e7bafd371d4bf88a6e0545
4
- data.tar.gz: 0ca92c1356056471aec28b75191cf1d7e7d17841e52106ec74e48a8c1f28a497
3
+ metadata.gz: c7f7b8ebfc25a26c798539d1b4ec99285fcd88024d9439c3246c0a8816be3085
4
+ data.tar.gz: 1e9b04d982e0339fd0fbbe99d8e4dc50890884489b929aab95982bf102697f0b
5
5
  SHA512:
6
- metadata.gz: fe9fcee2acbd6c52f226161736bd57e40937229732100eae8350f33f84563807bb5ef0a782143cb229641ff99904fed73e0838616e3293a5d441c70a2d9a98c2
7
- data.tar.gz: 3e419258aeda7f5d588c150db0d9171b5bf8065e0e32414045ff9dae7844298118c923fc10ca3d74357dc842427ebcb154c9a4da6f3e5024a0cb0206280929e1
6
+ metadata.gz: 9d24148fc5d1d9599e77b63aa115b59b6e02d6a65043df4dc33bc20222a6812e7fa0580f7067768ca9a3930a89013dd1bf1d9f5d38f26be28d1545911c8abcef
7
+ data.tar.gz: 32d0d0304f301e25bca12fcfc7afa29f44144a6323f9cfaec4de1652eac7c0dfd04d49c43939f91aa0b160f9d32521089dd68c06bd0031636129b5c24526c2de
@@ -5,9 +5,10 @@ cache: bundler
5
5
  rvm:
6
6
  - 2.5
7
7
  - 2.6
8
+ - 2.7
8
9
  before_install: gem install bundler
9
10
  script:
10
11
  - bundle exec rake
11
12
  addons:
12
13
  code_climate:
13
- repo_token: 9aa2aa2432639c57772b6917ad9da468709e5536b75617575b02b35201a2eaf8
14
+ repo_token: 42ad3aef34fcfd740fc41ae4cf16723fb11d6535
@@ -1,55 +1,58 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- a9n (1.0.0)
4
+ a9n (1.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- codeclimate-test-reporter (1.0.9)
11
- simplecov (<= 0.13)
12
- coderay (1.1.2)
9
+ ast (2.4.1)
10
+ codeclimate-test-reporter (1.0.7)
11
+ simplecov
12
+ coderay (1.1.3)
13
13
  diff-lcs (1.3)
14
- docile (1.1.5)
15
- jaro_winkler (1.5.3)
16
- json (2.2.0)
17
- method_source (0.9.2)
18
- parallel (1.18.0)
19
- parser (2.6.5.0)
14
+ docile (1.3.2)
15
+ method_source (1.0.0)
16
+ parallel (1.19.1)
17
+ parser (2.7.1.3)
20
18
  ast (~> 2.4.0)
21
- pry (0.12.2)
22
- coderay (~> 1.1.0)
23
- method_source (~> 0.9.0)
19
+ pry (0.13.1)
20
+ coderay (~> 1.1)
21
+ method_source (~> 1.0)
24
22
  rainbow (3.0.0)
25
- rake (13.0.0)
23
+ rake (13.0.1)
24
+ regexp_parser (1.7.1)
25
+ rexml (3.2.4)
26
26
  rspec (3.9.0)
27
27
  rspec-core (~> 3.9.0)
28
28
  rspec-expectations (~> 3.9.0)
29
29
  rspec-mocks (~> 3.9.0)
30
- rspec-core (3.9.0)
31
- rspec-support (~> 3.9.0)
32
- rspec-expectations (3.9.0)
30
+ rspec-core (3.9.2)
31
+ rspec-support (~> 3.9.3)
32
+ rspec-expectations (3.9.2)
33
33
  diff-lcs (>= 1.2.0, < 2.0)
34
34
  rspec-support (~> 3.9.0)
35
- rspec-mocks (3.9.0)
35
+ rspec-mocks (3.9.1)
36
36
  diff-lcs (>= 1.2.0, < 2.0)
37
37
  rspec-support (~> 3.9.0)
38
- rspec-support (3.9.0)
39
- rubocop (0.75.1)
40
- jaro_winkler (~> 1.5.1)
38
+ rspec-support (3.9.3)
39
+ rubocop (0.85.1)
41
40
  parallel (~> 1.10)
42
- parser (>= 2.6)
41
+ parser (>= 2.7.0.1)
43
42
  rainbow (>= 2.2.2, < 4.0)
43
+ regexp_parser (>= 1.7)
44
+ rexml
45
+ rubocop-ast (>= 0.0.3)
44
46
  ruby-progressbar (~> 1.7)
45
- unicode-display_width (>= 1.4.0, < 1.7)
47
+ unicode-display_width (>= 1.4.0, < 2.0)
48
+ rubocop-ast (0.0.3)
49
+ parser (>= 2.7.0.1)
46
50
  ruby-progressbar (1.10.1)
47
- simplecov (0.13.0)
48
- docile (~> 1.1.0)
49
- json (>= 1.8, < 3)
50
- simplecov-html (~> 0.10.0)
51
- simplecov-html (0.10.2)
52
- unicode-display_width (1.6.0)
51
+ simplecov (0.18.5)
52
+ docile (~> 1.1)
53
+ simplecov-html (~> 0.11)
54
+ simplecov-html (0.12.2)
55
+ unicode-display_width (1.7.0)
53
56
 
54
57
  PLATFORMS
55
58
  ruby
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # A9n
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/a9n.png)][gem_version]
4
- [![Build status](https://secure.travis-ci.org/knapo/a9n.png)][travis]
5
- [![Maintainability](https://api.codeclimate.com/v1/badges/4deae86e0cb581aae0e3/maintainability)](https://codeclimate.com/github/kknapik/a9n/maintainability)
6
- [![Test Coverage](https://api.codeclimate.com/v1/badges/4deae86e0cb581aae0e3/test_coverage)](https://codeclimate.com/github/kknapik/a9n/test_coverage)
3
+ [![Gem Version](https://badge.fury.io/rb/a9n.svg)][gem_version]
4
+ [![Build status](https://secure.travis-ci.org/knapo/a9n.svg)][travis]
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/566c2c51f1a383d18be8/maintainability)](https://codeclimate.com/github/knapo/a9n/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/566c2c51f1a383d18be8/test_coverage)](https://codeclimate.com/github/knapo/a9n/test_coverage)
7
7
 
8
8
  [gem_version]: https://rubygems.org/gems/a9n
9
9
  [travis]: http://travis-ci.org/knapo/a9n
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
10
10
  spec.homepage = 'https://github.com/knapo/a9n'
11
11
  spec.license = 'MIT'
12
12
 
13
- spec.metadata['homepage_uri'] = 'https://github.com/RenoFi/rack-graphql'
14
- spec.metadata['source_code_uri'] = 'https://github.com/RenoFi/rack-graphql'
13
+ spec.metadata['homepage_uri'] = 'https://github.com/knapo/a9n'
14
+ spec.metadata['source_code_uri'] = 'https://github.com/knapo/a9n'
15
15
 
16
16
  spec.files = Dir.chdir(__dir__) do
17
17
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin/|spec/|test_app/|\.rub)}) }
data/lib/a9n.rb CHANGED
@@ -3,6 +3,7 @@ require 'pathname'
3
3
  require 'ostruct'
4
4
  require 'yaml'
5
5
  require 'erb'
6
+ require 'logger'
6
7
  require 'a9n/version'
7
8
  require 'a9n/exceptions'
8
9
  require 'a9n/struct'
@@ -16,8 +17,11 @@ module A9n
16
17
 
17
18
  EXTENSION_LIST = '{yml,yml.erb,yml.example,yml.erb.example}'.freeze
18
19
  STRICT_MODE = 'strict'.freeze
20
+ DEFAULT_LOG_LEVEL = 'info'.freeze
19
21
 
20
22
  class << self
23
+ attr_writer :logger
24
+
21
25
  def env
22
26
  @env ||= ::A9n::StringInquirer.new(
23
27
  app_env ||
@@ -108,6 +112,10 @@ module A9n
108
112
  mode == STRICT_MODE
109
113
  end
110
114
 
115
+ def logger
116
+ @logger ||= ::Logger.new(STDOUT, level: fetch(:log_level, DEFAULT_LOG_LEVEL))
117
+ end
118
+
111
119
  def method_missing(name, *args)
112
120
  load if storage.empty?
113
121
  storage.send(name, *args)
@@ -1,9 +1,11 @@
1
1
  module A9n
2
- class ConfigurationNotLoadedError < StandardError; end
3
- class MissingConfigurationDataError < StandardError; end
4
- class MissingConfigurationVariablesError < StandardError; end
5
- class NoSuchConfigurationVariableError < StandardError; end
6
- class MissingEnvVariableError < StandardError; end
7
- class UnknownEnvError < StandardError; end
8
- class RootNotSetError < StandardError; end
2
+ Error = Class.new(StandardError)
3
+ ConfigurationNotLoadedError = Class.new(Error)
4
+ MissingConfigurationDataError = Class.new(Error)
5
+ MissingConfigurationVariablesError = Class.new(Error)
6
+ NoSuchConfigurationVariableError = Class.new(Error)
7
+ KeyNotFoundError = Class.new(NoSuchConfigurationVariableError)
8
+ MissingEnvVariableError = Class.new(Error)
9
+ UnknownEnvError = Class.new(Error)
10
+ RootNotSetError = Class.new(Error)
9
11
  end
@@ -17,14 +17,18 @@ module A9n
17
17
  data.merge!(another_data)
18
18
  end
19
19
 
20
- def method_missing(name, *_args)
21
- if data.key?(name)
22
- fetch(name)
20
+ def find(key)
21
+ if key && data.key?(key.to_sym)
22
+ fetch(key.to_sym)
23
23
  else
24
- raise NoSuchConfigurationVariableError.new, name
24
+ raise KeyNotFoundError.new, "Could not find #{key} in #{data.keys.inspect}"
25
25
  end
26
26
  end
27
27
 
28
+ def method_missing(key, *_args)
29
+ find(key)
30
+ end
31
+
28
32
  def set(key, value)
29
33
  data[key.to_sym] = value
30
34
  end
@@ -1,3 +1,3 @@
1
1
  module A9n
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
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: 1.0.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Knapik
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-20 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codeclimate-test-reporter
@@ -125,8 +125,8 @@ homepage: https://github.com/knapo/a9n
125
125
  licenses:
126
126
  - MIT
127
127
  metadata:
128
- homepage_uri: https://github.com/RenoFi/rack-graphql
129
- source_code_uri: https://github.com/RenoFi/rack-graphql
128
+ homepage_uri: https://github.com/knapo/a9n
129
+ source_code_uri: https://github.com/knapo/a9n
130
130
  post_install_message:
131
131
  rdoc_options: []
132
132
  require_paths: