a9n 0.10.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +4 -5
- data/Gemfile.lock +67 -0
- data/README.md +1 -1
- data/Rakefile +3 -8
- data/a9n.gemspec +26 -20
- data/lib/a9n/version.rb +1 -1
- metadata +11 -34
- data/.rspec.example +0 -2
- data/.rubocop.yml +0 -45
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/bin/console +0 -8
- data/spec/integration/a9n_spec.rb +0 -150
- data/spec/spec_helper.rb +0 -96
- data/spec/unit/a9n_spec.rb +0 -268
- data/spec/unit/loader_spec.rb +0 -207
- data/spec/unit/scope_spec.rb +0 -27
- data/spec/unit/struct_spec.rb +0 -168
- data/test_app/benchmark.rb +0 -31
- data/test_app/config/a9n.yml +0 -25
- data/test_app/config/a9n.yml.example +0 -23
- data/test_app/config/a9n/aws.yml +0 -3
- data/test_app/config/a9n/cloud.yml.erb +0 -3
- data/test_app/config/a9n/emails.yml +0 -2
- data/test_app/config/a9n/mailer.yml.example +0 -2
- data/test_app/config/no_defaults.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a77715c45124cd831c118cd5d0ff571a4efd4b8a7e7bafd371d4bf88a6e0545
|
4
|
+
data.tar.gz: 0ca92c1356056471aec28b75191cf1d7e7d17841e52106ec74e48a8c1f28a497
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9fcee2acbd6c52f226161736bd57e40937229732100eae8350f33f84563807bb5ef0a782143cb229641ff99904fed73e0838616e3293a5d441c70a2d9a98c2
|
7
|
+
data.tar.gz: 3e419258aeda7f5d588c150db0d9171b5bf8065e0e32414045ff9dae7844298118c923fc10ca3d74357dc842427ebcb154c9a4da6f3e5024a0cb0206280929e1
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -3,12 +3,11 @@ sudo: false
|
|
3
3
|
language: ruby
|
4
4
|
cache: bundler
|
5
5
|
rvm:
|
6
|
-
- 2.5
|
7
|
-
- 2.6
|
8
|
-
before_install: gem install bundler
|
6
|
+
- 2.5
|
7
|
+
- 2.6
|
8
|
+
before_install: gem install bundler
|
9
9
|
script:
|
10
|
-
- bundle exec
|
11
|
-
- bundle exec rubocop
|
10
|
+
- bundle exec rake
|
12
11
|
addons:
|
13
12
|
code_climate:
|
14
13
|
repo_token: 9aa2aa2432639c57772b6917ad9da468709e5536b75617575b02b35201a2eaf8
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
a9n (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.0)
|
10
|
+
codeclimate-test-reporter (1.0.9)
|
11
|
+
simplecov (<= 0.13)
|
12
|
+
coderay (1.1.2)
|
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)
|
20
|
+
ast (~> 2.4.0)
|
21
|
+
pry (0.12.2)
|
22
|
+
coderay (~> 1.1.0)
|
23
|
+
method_source (~> 0.9.0)
|
24
|
+
rainbow (3.0.0)
|
25
|
+
rake (13.0.0)
|
26
|
+
rspec (3.9.0)
|
27
|
+
rspec-core (~> 3.9.0)
|
28
|
+
rspec-expectations (~> 3.9.0)
|
29
|
+
rspec-mocks (~> 3.9.0)
|
30
|
+
rspec-core (3.9.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-expectations (3.9.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-mocks (3.9.0)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.9.0)
|
38
|
+
rspec-support (3.9.0)
|
39
|
+
rubocop (0.75.1)
|
40
|
+
jaro_winkler (~> 1.5.1)
|
41
|
+
parallel (~> 1.10)
|
42
|
+
parser (>= 2.6)
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
44
|
+
ruby-progressbar (~> 1.7)
|
45
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
46
|
+
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)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
a9n!
|
59
|
+
codeclimate-test-reporter
|
60
|
+
pry
|
61
|
+
rake
|
62
|
+
rspec
|
63
|
+
rubocop
|
64
|
+
simplecov
|
65
|
+
|
66
|
+
BUNDLED WITH
|
67
|
+
2.0.2
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
[codeclimate]: https://codeclimate.com/github/knapo/a9n
|
11
11
|
[coverage]: https://codeclimate.com/github/knapo/a9n
|
12
12
|
|
13
|
-
A9n is a simple tool to keep ruby/rails apps configuration maintanable and verifiable. It supports Rails 4+ and Ruby 2.
|
13
|
+
A9n is a simple tool to keep ruby/rails apps configuration maintanable and verifiable. It supports Rails 4+ and Ruby 2.5+.
|
14
14
|
|
15
15
|
Why it's named a9n? It's a numeronym for application (where 9 stands for the number of letters between the first **a** and last **n**, similar to i18n or l10n).
|
16
16
|
|
data/Rakefile
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
|
-
|
4
3
|
require 'rubocop/rake_task'
|
5
|
-
RuboCop::RakeTask.new
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
t.pattern = './spec/**/*_spec.rb'
|
10
|
-
t.rspec_opts = ['--profile', '--color']
|
11
|
-
end
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
RuboCop::RakeTask.new
|
12
7
|
|
13
|
-
task default: [
|
8
|
+
task default: %i[rubocop spec]
|
data/a9n.gemspec
CHANGED
@@ -1,25 +1,31 @@
|
|
1
1
|
require File.expand_path('lib/a9n/version', __dir__)
|
2
2
|
|
3
|
-
Gem::Specification.new do |
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
gem.homepage = 'https://github.com/knapo/a9n'
|
9
|
-
gem.license = 'MIT'
|
10
|
-
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
11
|
-
gem.executables = gem.files.grep(%r{^exe/}).map { |f| File.basename(f) }
|
12
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
-
gem.name = 'a9n'
|
14
|
-
gem.require_paths = ['lib']
|
15
|
-
gem.version = A9n::VERSION
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'a9n'
|
5
|
+
spec.version = A9n::VERSION
|
6
|
+
spec.authors = ['Krzysztof Knapik']
|
7
|
+
spec.email = ['knapo@knapo.net']
|
16
8
|
|
17
|
-
|
9
|
+
spec.summary = 'a9n - ruby/rails apps configuration manager'
|
10
|
+
spec.homepage = 'https://github.com/knapo/a9n'
|
11
|
+
spec.license = 'MIT'
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
spec.metadata['homepage_uri'] = 'https://github.com/RenoFi/rack-graphql'
|
14
|
+
spec.metadata['source_code_uri'] = 'https://github.com/RenoFi/rack-graphql'
|
15
|
+
|
16
|
+
spec.files = Dir.chdir(__dir__) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin/|spec/|test_app/|\.rub)}) }
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.required_ruby_version = '>= 2.5'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rspec'
|
29
|
+
spec.add_development_dependency 'rubocop'
|
30
|
+
spec.add_development_dependency 'simplecov'
|
25
31
|
end
|
data/lib/a9n/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Knapik
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
97
|
+
description:
|
98
98
|
email:
|
99
99
|
- knapo@knapo.net
|
100
100
|
executables: []
|
@@ -103,17 +103,13 @@ extra_rdoc_files: []
|
|
103
103
|
files:
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
|
-
- ".rspec.example"
|
107
|
-
- ".rubocop.yml"
|
108
|
-
- ".ruby-gemset"
|
109
|
-
- ".ruby-version"
|
110
106
|
- ".travis.yml"
|
111
107
|
- Gemfile
|
108
|
+
- Gemfile.lock
|
112
109
|
- LICENSE
|
113
110
|
- README.md
|
114
111
|
- Rakefile
|
115
112
|
- a9n.gemspec
|
116
|
-
- bin/console
|
117
113
|
- lib/a9n.rb
|
118
114
|
- lib/a9n/capistrano.rb
|
119
115
|
- lib/a9n/capistrano/tasks.cap
|
@@ -125,24 +121,12 @@ files:
|
|
125
121
|
- lib/a9n/scope.rb
|
126
122
|
- lib/a9n/struct.rb
|
127
123
|
- lib/a9n/version.rb
|
128
|
-
- spec/integration/a9n_spec.rb
|
129
|
-
- spec/spec_helper.rb
|
130
|
-
- spec/unit/a9n_spec.rb
|
131
|
-
- spec/unit/loader_spec.rb
|
132
|
-
- spec/unit/scope_spec.rb
|
133
|
-
- spec/unit/struct_spec.rb
|
134
|
-
- test_app/benchmark.rb
|
135
|
-
- test_app/config/a9n.yml
|
136
|
-
- test_app/config/a9n.yml.example
|
137
|
-
- test_app/config/a9n/aws.yml
|
138
|
-
- test_app/config/a9n/cloud.yml.erb
|
139
|
-
- test_app/config/a9n/emails.yml
|
140
|
-
- test_app/config/a9n/mailer.yml.example
|
141
|
-
- test_app/config/no_defaults.yml
|
142
124
|
homepage: https://github.com/knapo/a9n
|
143
125
|
licenses:
|
144
126
|
- MIT
|
145
|
-
metadata:
|
127
|
+
metadata:
|
128
|
+
homepage_uri: https://github.com/RenoFi/rack-graphql
|
129
|
+
source_code_uri: https://github.com/RenoFi/rack-graphql
|
146
130
|
post_install_message:
|
147
131
|
rdoc_options: []
|
148
132
|
require_paths:
|
@@ -151,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
135
|
requirements:
|
152
136
|
- - ">="
|
153
137
|
- !ruby/object:Gem::Version
|
154
|
-
version: '2.
|
138
|
+
version: '2.5'
|
155
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
140
|
requirements:
|
157
141
|
- - ">="
|
@@ -161,12 +145,5 @@ requirements: []
|
|
161
145
|
rubygems_version: 3.0.6
|
162
146
|
signing_key:
|
163
147
|
specification_version: 4
|
164
|
-
summary: a9n
|
165
|
-
|
166
|
-
test_files:
|
167
|
-
- spec/integration/a9n_spec.rb
|
168
|
-
- spec/spec_helper.rb
|
169
|
-
- spec/unit/a9n_spec.rb
|
170
|
-
- spec/unit/loader_spec.rb
|
171
|
-
- spec/unit/scope_spec.rb
|
172
|
-
- spec/unit/struct_spec.rb
|
148
|
+
summary: a9n - ruby/rails apps configuration manager
|
149
|
+
test_files: []
|
data/.rspec.example
DELETED
data/.rubocop.yml
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
Gemspec/RequiredRubyVersion:
|
2
|
-
Include:
|
3
|
-
- 2.5
|
4
|
-
- 2.6
|
5
|
-
|
6
|
-
Metrics/BlockLength:
|
7
|
-
Max: 30
|
8
|
-
Exclude:
|
9
|
-
- '**/*_spec.rb'
|
10
|
-
|
11
|
-
Metrics/LineLength:
|
12
|
-
Max: 140
|
13
|
-
|
14
|
-
Metrics/ModuleLength:
|
15
|
-
Max: 120
|
16
|
-
|
17
|
-
Security/YAMLLoad:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Style/BlockDelimiters:
|
21
|
-
EnforcedStyle: braces_for_chaining
|
22
|
-
|
23
|
-
Style/Documentation:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Style/GuardClause:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Style/EachWithObject:
|
30
|
-
Enabled: false
|
31
|
-
|
32
|
-
Style/MethodMissingSuper:
|
33
|
-
Enabled: false
|
34
|
-
|
35
|
-
Style/MissingRespondToMissing:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
Style/FrozenStringLiteralComment:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Style/SymbolArray:
|
42
|
-
EnforcedStyle: brackets
|
43
|
-
|
44
|
-
Style/TrivialAccessors:
|
45
|
-
Enabled: false
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
a9n
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.6.5
|
data/bin/console
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
RSpec.describe A9n do
|
2
|
-
subject { described_class }
|
3
|
-
|
4
|
-
let(:env) { 'test' }
|
5
|
-
|
6
|
-
before do
|
7
|
-
clean_singleton(subject)
|
8
|
-
ENV['ERB_FOO'] = 'erbized foo'
|
9
|
-
ENV['FOO_PASSWORD'] = 'foo123'
|
10
|
-
ENV['FOO_KEY'] = 'key123'
|
11
|
-
ENV['AWS_API_KEY'] = 'ASDF1234'
|
12
|
-
ENV['API_KEY'] = 'XYZ999'
|
13
|
-
subject.app = double(env: env)
|
14
|
-
subject.root = File.expand_path('../../test_app', __dir__)
|
15
|
-
subject.load
|
16
|
-
end
|
17
|
-
|
18
|
-
after do
|
19
|
-
clean_singleton(subject)
|
20
|
-
ENV.delete('ERB_FOO')
|
21
|
-
ENV.delete('FOO_PASSWORD')
|
22
|
-
ENV.delete('FOO_KEY')
|
23
|
-
ENV.delete('AWS_API_KEY')
|
24
|
-
ENV.delete('API_KEY')
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'base config file' do
|
28
|
-
it do
|
29
|
-
expect(subject.storage).to be_kind_of(A9n::Struct)
|
30
|
-
end
|
31
|
-
|
32
|
-
it do
|
33
|
-
expect(subject.default_foo).to eq('default foo')
|
34
|
-
expect(subject.overriden_foo).to eq('already overriden foo')
|
35
|
-
subject.set(:default_foo, 'lazy foo')
|
36
|
-
subject.set(:overriden_foo, 'hard working foo')
|
37
|
-
expect(subject.default_foo).to eq('lazy foo')
|
38
|
-
expect(subject.overriden_foo).to eq('hard working foo')
|
39
|
-
subject.load
|
40
|
-
expect(subject.default_foo).to eq('default foo')
|
41
|
-
expect(subject.overriden_foo).to eq('already overriden foo')
|
42
|
-
end
|
43
|
-
|
44
|
-
it do
|
45
|
-
expect(subject.fetch(:default_foo)).to eq('default foo')
|
46
|
-
expect(subject.fetch(:overriden_foo)).to eq('already overriden foo')
|
47
|
-
end
|
48
|
-
|
49
|
-
it do
|
50
|
-
expect { subject.invalid }.to raise_error(A9n::NoSuchConfigurationVariableError)
|
51
|
-
end
|
52
|
-
|
53
|
-
it do
|
54
|
-
expect { subject.fetch(:invalid) }.to raise_error(::KeyError)
|
55
|
-
end
|
56
|
-
|
57
|
-
it do
|
58
|
-
expect { subject.fetch(:invalid, 'Hello').to eq('Hello') }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'undefined env' do
|
63
|
-
let(:env) { 'tropical' }
|
64
|
-
|
65
|
-
it do
|
66
|
-
expect(subject.default_foo).to eq('default foo')
|
67
|
-
expect(subject.overriden_foo).to eq('not yet overriden foo')
|
68
|
-
end
|
69
|
-
|
70
|
-
it do
|
71
|
-
expect(subject.fetch(:default_foo)).to eq('default foo')
|
72
|
-
expect(subject.fetch(:overriden_foo)).to eq('not yet overriden foo')
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'extra config file' do
|
77
|
-
before do
|
78
|
-
expect(subject.aws).to be_kind_of(A9n::Struct)
|
79
|
-
end
|
80
|
-
|
81
|
-
it do
|
82
|
-
expect(subject.aws.username).to eq('joe')
|
83
|
-
expect(subject.aws.api_key).to eq('ASDF1234')
|
84
|
-
end
|
85
|
-
|
86
|
-
it do
|
87
|
-
expect(subject.aws.fetch(:username)).to eq('joe')
|
88
|
-
expect(subject.aws.fetch(:api_key)).to eq('ASDF1234')
|
89
|
-
end
|
90
|
-
|
91
|
-
it do
|
92
|
-
expect(subject.fetch(:aws)).to eq(subject.aws)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
context 'extra config file with erb' do
|
97
|
-
before do
|
98
|
-
expect(subject.cloud).to be_kind_of(A9n::Struct)
|
99
|
-
end
|
100
|
-
|
101
|
-
it do
|
102
|
-
expect(subject.cloud.username).to eq('testuser')
|
103
|
-
expect(subject.cloud.password).to eq('qwerty')
|
104
|
-
end
|
105
|
-
|
106
|
-
it do
|
107
|
-
expect(subject.cloud.fetch(:username)).to eq('testuser')
|
108
|
-
expect(subject.cloud.fetch(:password)).to eq('qwerty')
|
109
|
-
end
|
110
|
-
|
111
|
-
it do
|
112
|
-
expect(subject.fetch(:cloud)).to eq(subject.cloud)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
context 'extra config file with example' do
|
117
|
-
before do
|
118
|
-
expect(subject.mailer).to be_kind_of(A9n::Struct)
|
119
|
-
end
|
120
|
-
|
121
|
-
it do
|
122
|
-
expect(subject.mailer.delivery_method).to eq('test')
|
123
|
-
end
|
124
|
-
|
125
|
-
it do
|
126
|
-
expect(subject.mailer.fetch(:delivery_method)).to eq('test')
|
127
|
-
end
|
128
|
-
|
129
|
-
it do
|
130
|
-
expect(subject.fetch(:mailer)).to eq(subject.mailer)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
context 'extra config file without known namspaces' do
|
135
|
-
before do
|
136
|
-
expect(subject.emails).to be_kind_of(A9n::Struct)
|
137
|
-
end
|
138
|
-
|
139
|
-
it do
|
140
|
-
expect(subject.emails.knapo).to eq('knapo@a9n.local')
|
141
|
-
expect(subject.emails.admin).to eq('admin@a9n.local')
|
142
|
-
expect { subject.emails.foo }.to raise_error(A9n::NoSuchConfigurationVariableError)
|
143
|
-
end
|
144
|
-
|
145
|
-
it do
|
146
|
-
expect(subject.emails.fetch(:knapo)).to eq('knapo@a9n.local')
|
147
|
-
expect(subject.emails.fetch(:admin)).to eq('admin@a9n.local')
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|