sequoia 0.1.0 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/lib/sequoia/configurable.rb +5 -4
- data/lib/sequoia/entity.rb +7 -1
- data/lib/sequoia/version.rb +1 -1
- data/spec/integration/configurator_spec.rb +11 -3
- data/spec/unit/sequoia/builder/attrs_spec.rb +2 -2
- data/spec/unit/sequoia/builder/respond_to_predicate_spec.rb +1 -1
- data/spec/unit/sequoia/configurable/{build_spec.rb → build_configuration_spec.rb} +5 -5
- data/spec/unit/sequoia/entity/method_missing_spec.rb +10 -0
- data/spec/unit/sequoia/entity/pretty_inspect_spec.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2151eec515f5ae1b80cebf1cd551e0721047bd82
|
4
|
+
data.tar.gz: 4c119fa7403b3ee39777b32211c779416706fecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 399fba4c292726a60d081c876ca709d5abda6c723e148588f9a30f969aeeae4e6c3745c47f91c6b64112fb3b711f612ea2ba69195b5fbe731e39dd9aa56ba198
|
7
|
+
data.tar.gz: 76b4de751abdf51287854a4370ca59781905737c7e9e429e8125188294711df47ebfc04d1ac8a4a1a66305d64df5d633cb5b9aa2162235ef713535da8efe47b8
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
data/lib/sequoia/configurable.rb
CHANGED
@@ -17,7 +17,7 @@ module Sequoia
|
|
17
17
|
# Returns: {Sequoia::Builder} builder instance
|
18
18
|
#
|
19
19
|
def configure(env=:default, &block)
|
20
|
-
environment = config_attributes[env.to_sym]
|
20
|
+
environment = config_attributes[env.to_sym]
|
21
21
|
|
22
22
|
Builder.new(environment, &block)
|
23
23
|
end
|
@@ -30,11 +30,12 @@ module Sequoia
|
|
30
30
|
#
|
31
31
|
# Returns: {Sequoia::Entity} builded configuration object
|
32
32
|
#
|
33
|
-
def
|
33
|
+
def build_configuration(env=nil)
|
34
34
|
result = config_attributes[:default]
|
35
35
|
result.deep_merge!(config_attributes[env.to_sym]) if env
|
36
36
|
Entity.create(result)
|
37
37
|
end
|
38
|
+
alias :build_config :build_configuration
|
38
39
|
|
39
40
|
protected
|
40
41
|
|
@@ -42,8 +43,8 @@ module Sequoia
|
|
42
43
|
# Config environments storage
|
43
44
|
#
|
44
45
|
def config_attributes
|
45
|
-
@config_attributes ||= {
|
46
|
+
@config_attributes ||= Hash.new { |hash, key| hash[key] = Store.new }
|
46
47
|
end
|
47
48
|
|
48
49
|
end
|
49
|
-
end
|
50
|
+
end
|
data/lib/sequoia/entity.rb
CHANGED
data/lib/sequoia/version.rb
CHANGED
@@ -34,7 +34,7 @@ describe Sequoia::Configurator do
|
|
34
34
|
instance
|
35
35
|
end
|
36
36
|
|
37
|
-
let(:result) { config.
|
37
|
+
let(:result) { config.build_config(env) }
|
38
38
|
|
39
39
|
context 'without env' do
|
40
40
|
let(:env) { nil }
|
@@ -52,7 +52,7 @@ describe Sequoia::Configurator do
|
|
52
52
|
it 'should merge config' do
|
53
53
|
expect(result.working_folder).to eql('/srv')
|
54
54
|
expect(result.timeout).to eql(60)
|
55
|
-
expect(result.cache).to
|
55
|
+
expect(result.cache).to be(false)
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should merge namespaces' do
|
@@ -60,4 +60,12 @@ describe Sequoia::Configurator do
|
|
60
60
|
expect(result.database.user).to eql('dev')
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
|
+
context 'without configured env' do
|
65
|
+
let(:env) { :staging }
|
66
|
+
|
67
|
+
it 'should not raise exception' do
|
68
|
+
expect { result }.to_not raise_error
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -19,7 +19,7 @@ describe Sequoia::Builder, '#attrs' do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should handle booleans' do
|
22
|
-
expect(subject[:async]).to
|
22
|
+
expect(subject[:async]).to be(false)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should store hashes as hashes' do
|
@@ -81,4 +81,4 @@ describe Sequoia::Builder, '#attrs' do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
end
|
84
|
+
end
|
@@ -4,7 +4,7 @@ describe Sequoia::Configurable, '#build' do
|
|
4
4
|
let(:instance) { Class.new.send(:include, Sequoia::Configurable).new }
|
5
5
|
|
6
6
|
it 'should return object if empty' do
|
7
|
-
expect(instance.
|
7
|
+
expect(instance.build_configuration).to be_an(Object)
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should return entity if not empty' do
|
@@ -12,7 +12,7 @@ describe Sequoia::Configurable, '#build' do
|
|
12
12
|
path '/home'
|
13
13
|
end
|
14
14
|
|
15
|
-
expect(instance.
|
15
|
+
expect(instance.build_configuration).to be_a(Sequoia::Entity)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'should merge envs' do
|
@@ -24,7 +24,7 @@ describe Sequoia::Configurable, '#build' do
|
|
24
24
|
log_level :info
|
25
25
|
end
|
26
26
|
|
27
|
-
expect(instance.
|
28
|
-
expect(instance.
|
27
|
+
expect(instance.build_configuration('test').path).to eq('/home')
|
28
|
+
expect(instance.build_configuration(:test).log_level).to eq(:info)
|
29
29
|
end
|
30
|
-
end
|
30
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Sequoia::Entity, '#method_missing' do
|
4
|
+
let(:instance) { Sequoia::Entity.create(hash) }
|
5
|
+
let(:hash) { Sequoia::Store.new(working_folder: '/srv') }
|
6
|
+
|
7
|
+
it 'should not raise exception' do
|
8
|
+
expect { instance.nonexist }.to_not raise_error
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequoia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Savchenko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- .gitignore
|
80
80
|
- .rspec
|
81
81
|
- .travis.yml
|
82
|
+
- CHANGELOG.md
|
82
83
|
- Gemfile
|
83
84
|
- LICENSE.txt
|
84
85
|
- README.md
|
@@ -97,9 +98,10 @@ files:
|
|
97
98
|
- spec/unit/sequoia/builder/class_spec.rb
|
98
99
|
- spec/unit/sequoia/builder/respond_to_predicate_spec.rb
|
99
100
|
- spec/unit/sequoia/builder/to_s_spec.rb
|
100
|
-
- spec/unit/sequoia/configurable/
|
101
|
+
- spec/unit/sequoia/configurable/build_configuration_spec.rb
|
101
102
|
- spec/unit/sequoia/configurable/configure_spec.rb
|
102
103
|
- spec/unit/sequoia/entity/class_methods/create_spec.rb
|
104
|
+
- spec/unit/sequoia/entity/method_missing_spec.rb
|
103
105
|
- spec/unit/sequoia/entity/pretty_inspect_spec.rb
|
104
106
|
- spec/unit/sequoia/entity/to_hash_spec.rb
|
105
107
|
- spec/unit/sequoia/entity/to_s_spec.rb
|
@@ -136,9 +138,10 @@ test_files:
|
|
136
138
|
- spec/unit/sequoia/builder/class_spec.rb
|
137
139
|
- spec/unit/sequoia/builder/respond_to_predicate_spec.rb
|
138
140
|
- spec/unit/sequoia/builder/to_s_spec.rb
|
139
|
-
- spec/unit/sequoia/configurable/
|
141
|
+
- spec/unit/sequoia/configurable/build_configuration_spec.rb
|
140
142
|
- spec/unit/sequoia/configurable/configure_spec.rb
|
141
143
|
- spec/unit/sequoia/entity/class_methods/create_spec.rb
|
144
|
+
- spec/unit/sequoia/entity/method_missing_spec.rb
|
142
145
|
- spec/unit/sequoia/entity/pretty_inspect_spec.rb
|
143
146
|
- spec/unit/sequoia/entity/to_hash_spec.rb
|
144
147
|
- spec/unit/sequoia/entity/to_s_spec.rb
|