rivet 2.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -4
- data/.travis.yml +5 -5
- data/CHANGELOG.md +7 -0
- data/Gemfile +4 -2
- data/Gemfile.lock +42 -26
- data/README.md +61 -10
- data/bin/rivet +14 -9
- data/example/ec2/defaults.rb +6 -0
- data/example/ec2/example.rb +8 -0
- data/example/ec2/user_data.erb +2 -0
- data/lib/rivet/{autoscale.rb → as/autoscale.rb} +33 -4
- data/lib/rivet/{config.rb → as/autoscale_config.rb} +3 -33
- data/lib/rivet/{launch_config.rb → as/launch_config.rb} +8 -11
- data/lib/rivet/{aws_utils.rb → common/aws_utils.rb} +27 -29
- data/lib/rivet/common/base_aws_attributes.rb +15 -0
- data/lib/rivet/common/base_config.rb +40 -0
- data/lib/rivet/{client.rb → common/client.rb} +11 -10
- data/lib/rivet/ec2/ec2.rb +163 -0
- data/lib/rivet/ec2/ec2_config.rb +19 -0
- data/lib/rivet/utils.rb +4 -3
- data/lib/rivet/version.rb +1 -1
- data/lib/rivet.rb +16 -11
- data/rivet.gemspec +6 -5
- data/spec/as/autoscale_config_spec.rb +65 -0
- data/spec/{aws_autoscale_wrapper_spec.rb → as/aws_autoscale_wrapper_spec.rb} +1 -1
- data/spec/aws_utils_spec.rb +44 -0
- data/spec/base_config_spec.rb +31 -0
- data/spec/bootstrap_spec.rb +1 -1
- data/spec/ec2/ec2_config_spec.rb +29 -0
- data/spec/launch_config_spec.rb +1 -1
- data/spec/shared_examples/a_config.rb +98 -0
- data/spec/shared_examples/a_config_util.rb +33 -0
- data/spec/spec_setup.rb +63 -39
- data/spec/util_spec.rb +16 -23
- metadata +63 -43
- data/lib/rivet/deep_merge.rb +0 -29
- data/spec/config_spec.rb +0 -168
- /data/lib/rivet/{aws_autoscale_wrapper.rb → as/aws_autoscale_wrapper.rb} +0 -0
- /data/lib/rivet/{bootstrap.rb → common/bootstrap.rb} +0 -0
- /data/lib/rivet/{config_proxy.rb → common/config_proxy.rb} +0 -0
- /data/lib/rivet/{logger.rb → common/logger.rb} +0 -0
- /data/lib/rivet/{open_state.rb → common/open_state.rb} +0 -0
data/spec/config_spec.rb
DELETED
@@ -1,168 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require_relative './spec_setup'
|
3
|
-
|
4
|
-
include SpecHelpers
|
5
|
-
|
6
|
-
|
7
|
-
describe 'rivet config' do
|
8
|
-
let(:default_config) { Rivet::Config.new('default_unit_test_config') }
|
9
|
-
let(:config) { Rivet::Config.new('unit_test_config') { eval(DSL_CONFIG_CONTENT) } }
|
10
|
-
|
11
|
-
context 'without DSL content' do
|
12
|
-
describe '#new' do
|
13
|
-
it 'returns a Rivet::Config object' do
|
14
|
-
default_config.should be_an_instance_of Rivet::Config
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#name' do
|
19
|
-
it 'returns the name' do
|
20
|
-
default_config.name.should == 'default_unit_test_config'
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#bootstrap' do
|
25
|
-
before do
|
26
|
-
default_config.bootstrap.unit_test 'goat simulator'
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'should allow you to set an arbitrary bootstrap value' do
|
30
|
-
default_config.bootstrap.unit_test.should == 'goat simulator'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#path' do
|
35
|
-
context 'with no arguments' do
|
36
|
-
it 'returns the default . path' do
|
37
|
-
default_config.path.should == '.'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
context 'with an argument' do
|
41
|
-
it 'returns the set path joined with the argument' do
|
42
|
-
default_config.path('test').should == './test'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#normalize_availability_zones' do
|
48
|
-
before do
|
49
|
-
default_config.region 'us-west-2'
|
50
|
-
default_config.availability_zones %w(c a b)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should return a sorted array of zones with the region prepended' do
|
54
|
-
default_config.normalize_availability_zones.should == %w(us-west-2a us-west-2b us-west-2c)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe '#normalize_security_groups' do
|
59
|
-
before do
|
60
|
-
default_config.security_groups %w(group2 group1 group3)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should return a sorted array of security groups' do
|
64
|
-
default_config.normalize_security_groups.should == %w(group1 group2 group3)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#normalize_load_balancers' do
|
69
|
-
before do
|
70
|
-
default_config.load_balancers %w(balancer2 balancer1)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'should return a sorted array of load balancers' do
|
74
|
-
default_config.normalize_load_balancers.should == %w(balancer1 balancer2)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#normalize_subnets' do
|
79
|
-
before do
|
80
|
-
default_config.subnets %w(192.168.1.2 192.168.1.3 192.168.1.1)
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'should return a sorted array of subnets' do
|
84
|
-
default_config.normalize_subnets.should == %w(192.168.1.1 192.168.1.2 192.168.1.3)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe '#normalize_tags' do
|
89
|
-
before do
|
90
|
-
default_config.tags [
|
91
|
-
{ key: 'Name', value: 'unit test' },
|
92
|
-
{ key: 'Other', value: 'sasquatch', propagate_at_launch: false }
|
93
|
-
]
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'should return a normalized array of hashes' do
|
97
|
-
expected_result = [
|
98
|
-
{ propagate_at_launch: true, key: 'Name', value: 'unit test' },
|
99
|
-
{ propagate_at_launch: false, key: 'Other', value: 'sasquatch' }
|
100
|
-
]
|
101
|
-
default_config.normalize_tags.should == expected_result
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'with DSL content' do
|
107
|
-
|
108
|
-
describe '#new' do
|
109
|
-
it 'returns a Rivet::Config object' do
|
110
|
-
config.should be_an_instance_of Rivet::Config
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#name' do
|
115
|
-
it 'returns the name' do
|
116
|
-
config.name.should == 'unit_test_config'
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'generated attributes' do
|
121
|
-
it 'should contain all the attributes defined in the DSL CONTENT' do
|
122
|
-
DSL_VALUES.each_pair do |k, v|
|
123
|
-
# bootstrap is an attribute of the Config class, not a generated one
|
124
|
-
unless k == :bootstrap
|
125
|
-
config.generated_attributes.should include(k)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
it 'should have all values properly set according to the DSL CONTENT' do
|
131
|
-
DSL_VALUES.each_pair do |k, v|
|
132
|
-
unless k == :bootstrap
|
133
|
-
config.send(k).should == eval(v)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
DSL_VALUES[:bootstrap].each_pair do |k, v|
|
137
|
-
config.bootstrap.send(k).should == eval(v)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
tempdir_context 'with DSL content inside of a file on disk' do
|
144
|
-
let(:config_from_file) { Rivet::Config.from_file(File.join('.', 'unit_test.rb')) }
|
145
|
-
|
146
|
-
before do
|
147
|
-
File.open('unit_test.rb', 'w') { |f| f.write(DSL_CONFIG_CONTENT) }
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '::from_file' do
|
151
|
-
it 'returns an instance of Rivet::Config' do
|
152
|
-
config_from_file.should be_an_instance_of Rivet::Config
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'should have all values properly set according to the DSL CONTENT' do
|
156
|
-
DSL_VALUES.each_pair do |k, v|
|
157
|
-
unless k == :bootstrap
|
158
|
-
config_from_file.send(k).should == eval(v)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
DSL_VALUES[:bootstrap].each_pair do |k, v|
|
162
|
-
config_from_file.bootstrap.send(k).should == eval(v)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|