rivet 2.0.0 → 3.0.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 +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
@@ -0,0 +1,98 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
shared_examples_for "a config" do
|
4
|
+
context 'without DSL content' do
|
5
|
+
describe '#name' do
|
6
|
+
it 'returns the name' do
|
7
|
+
default_config.name.should == 'default_unit_test_config'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#bootstrap' do
|
12
|
+
before do
|
13
|
+
default_config.bootstrap.unit_test 'goat simulator'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should allow you to set an arbitrary bootstrap value' do
|
17
|
+
default_config.bootstrap.unit_test.should == 'goat simulator'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#path' do
|
22
|
+
context 'with no arguments' do
|
23
|
+
it 'returns the default . path' do
|
24
|
+
default_config.path.should == '.'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
context 'with an argument' do
|
28
|
+
it 'returns the set path joined with the argument' do
|
29
|
+
default_config.path('test').should == './test'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#normalize_security_groups' do
|
35
|
+
before do
|
36
|
+
default_config.security_groups %w(group2 group1 group3)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should return a sorted array of security groups' do
|
40
|
+
default_config.normalize_security_groups.should == %w(group1 group2 group3)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with DSL content' do
|
46
|
+
describe '#name' do
|
47
|
+
it 'returns the name' do
|
48
|
+
config.name.should == 'unit_test_config'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'generated attributes' do
|
53
|
+
it 'should contain all the attributes defined in the DSL CONTENT' do
|
54
|
+
dsl_values.each_pair do |k, v|
|
55
|
+
# bootstrap is an attribute of the BaseConfig class, not a generated one
|
56
|
+
unless k == :bootstrap
|
57
|
+
config.generated_attributes.should include(k)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'should have all values properly set according to the DSL CONTENT' do
|
63
|
+
dsl_values.each_pair do |k, v|
|
64
|
+
unless k == :bootstrap
|
65
|
+
config.send(k).should == eval(v)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
if dsl_values.key? :bootstrap
|
69
|
+
dsl_values[:bootstrap].each_pair do |k, v|
|
70
|
+
config.bootstrap.send(k).should == eval(v)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
tempdir_context 'with DSL content inside of a file on disk' do
|
78
|
+
before do
|
79
|
+
File.open('unit_test.rb', 'w') { |f| f.write(config_content) }
|
80
|
+
end
|
81
|
+
|
82
|
+
describe '::from_file' do
|
83
|
+
it 'should have all values properly set according to the DSL CONTENT' do
|
84
|
+
dsl_values.each_pair do |k, v|
|
85
|
+
unless k == :bootstrap
|
86
|
+
config_from_file.send(k).should == eval(v)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
if dsl_values.key? :bootstrap
|
90
|
+
dsl_values[:bootstrap].each_pair do |k, v|
|
91
|
+
config_from_file.bootstrap.send(k).should == eval(v)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
shared_examples 'a config util' do
|
4
|
+
tempdir_context 'with an existing config directory' do
|
5
|
+
|
6
|
+
before do
|
7
|
+
FileUtils.mkdir_p config_dir
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'without an existing configuration' do
|
11
|
+
describe '#get_config' do
|
12
|
+
it 'should return false' do
|
13
|
+
Rivet::Utils.get_config('autoscale','unit_test', config_dir).should be_false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'with a configuration file' do
|
19
|
+
before do
|
20
|
+
File.open(config_file, 'w') { |f| f.write(config_content) }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#get_config' do
|
24
|
+
it 'should return a valid configuration' do
|
25
|
+
config = Rivet::Utils.get_config('autoscale', 'unit_test', config_dir)
|
26
|
+
valid_config?(config, dsl_values)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
data/spec/spec_setup.rb
CHANGED
@@ -9,62 +9,91 @@ require_relative '../lib/rivet'
|
|
9
9
|
Rivet::Log.level(Logger::FATAL)
|
10
10
|
|
11
11
|
module SpecHelpers
|
12
|
+
|
13
|
+
def self.generate_config_content(values)
|
14
|
+
values.inject(String.new) do |a, (k, v)|
|
15
|
+
if k == :bootstrap
|
16
|
+
v.each_pair do |bootstrap_attr, bootstrap_value|
|
17
|
+
a << "bootstrap.#{bootstrap_attr} #{bootstrap_value}\n"
|
18
|
+
end
|
19
|
+
else
|
20
|
+
a << "#{k} #{v}\n"
|
21
|
+
end
|
22
|
+
a
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
12
26
|
AUTOSCALE_DIR = File.join('.', 'autoscale')
|
13
|
-
|
27
|
+
ASG_CONFIG_FILE = File.join(AUTOSCALE_DIR, 'unit_test.rb')
|
28
|
+
EC2_DIR = File.join('.', 'ec2')
|
29
|
+
EC2_CONFIG_FILE = File.join(EC2_DIR, 'unit_test.rb')
|
30
|
+
|
14
31
|
TEMPLATE_FILE = File.join(AUTOSCALE_DIR, 'default.erb')
|
15
32
|
BOOTSTRAP_TEMPLATE = '<%= "bar" %>'\
|
16
33
|
|
17
|
-
|
34
|
+
COMMON_DSL_VALUES = {
|
35
|
+
:iam_instance_profile => "'ec2_unit_test_profile'",
|
36
|
+
:block_device_mappings => "[{:device_name => '/dev/sda1', :virtual_name => 'ephemeral0'}]",
|
37
|
+
:placement_group => "'unit test placement group'",
|
38
|
+
:image_id => "'ami-12345678'",
|
39
|
+
:key_name => "'UnitTests'",
|
40
|
+
:security_groups => '%w(unit_test3 unit_tests1 unit_tests2)',
|
41
|
+
:instance_type => "'m1.large'",
|
42
|
+
:kernel_id => "'aki-12345678'",
|
43
|
+
:ramdisk_id => "'ari-12345678'",
|
44
|
+
:associate_public_ip_address => 'false'
|
45
|
+
}
|
46
|
+
|
47
|
+
EC2_DSL_VALUES = {
|
48
|
+
:count => '1',
|
49
|
+
:monitoring_enabled => 'true',
|
50
|
+
:availability_zone => "'a'",
|
51
|
+
:placement_group => "'unit test placement group'",
|
52
|
+
:key_pair => "''",
|
53
|
+
:security_group_ids => '%w(sg-12345678 sg-01234567 sg-801234567)',
|
54
|
+
:user_data => "'ec2 user data'",
|
55
|
+
:disable_api_termination => 'false',
|
56
|
+
:instance_initiated_shutdown_behavior => "'Stop'",
|
57
|
+
:subnet => "'subnet-4292a736'",
|
58
|
+
:private_ip_address => "'10.129.64.2'",
|
59
|
+
:dedicated_tenancy => 'false',
|
60
|
+
:ebs_optimized => 'false',
|
61
|
+
}.merge(COMMON_DSL_VALUES)
|
62
|
+
|
63
|
+
ASG_DSL_VALUES = {
|
18
64
|
:min_size => '1',
|
19
65
|
:desired_capacity => '1',
|
20
66
|
:max_size => '3',
|
21
67
|
:region => "'us-west-2'",
|
22
68
|
:availability_zones => '%w(b c a)',
|
23
|
-
:key_name => "'UnitTests'",
|
24
|
-
:instance_type => "'m1.large'",
|
25
|
-
:security_groups => '%w(unit_test3 unit_tests1 unit_tests2)',
|
26
|
-
:image_id => "'ami-12345678'",
|
27
|
-
:iam_instance_profile => "'unit_test_profile'",
|
28
69
|
:default_cooldown => '300',
|
29
|
-
:placement_group => "'unit test placement group'",
|
30
70
|
:health_check_type => ':ec2',
|
31
71
|
:termination_policies => '%w(policy2 policy1)',
|
32
72
|
:load_balancers => '%w(balancer2 balancer1)',
|
33
73
|
:health_check_grace_period => '100',
|
34
|
-
:associate_public_ip_address => 'true',
|
35
74
|
:detailed_instance_monitoring => 'true',
|
36
|
-
:block_device_mappings => "[{:device_name => '/dev/sda1', :virtual_name => 'ephemeral0'}]",
|
37
|
-
:kernel_id => "'aki-12345678'",
|
38
|
-
:ramdisk_id => "'ari-12345678'",
|
39
75
|
:spot_price => "'0.01'",
|
40
76
|
:bootstrap => {
|
41
77
|
:template => "'#{TEMPLATE_FILE}'",
|
42
78
|
:foo => "'bar'"
|
43
79
|
}
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
a << "bootstrap.#{bootstrap_attr} #{bootstrap_value}\n"
|
49
|
-
end
|
50
|
-
else
|
51
|
-
a << "#{k} #{v}\n"
|
52
|
-
end
|
53
|
-
a
|
54
|
-
end
|
80
|
+
}.merge(COMMON_DSL_VALUES)
|
81
|
+
|
82
|
+
ASG_CONFIG_CONTENT = generate_config_content ASG_DSL_VALUES
|
83
|
+
EC2_CONFIG_CONTENT = generate_config_content EC2_DSL_VALUES
|
55
84
|
|
56
85
|
AUTOSCALE_IDENTITY_STRING = "bootstrap#{Base64.encode64('unit_test_user_data')}"\
|
57
|
-
"
|
58
|
-
"
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"
|
65
|
-
"kernel_id#{Base64.encode64(eval(
|
66
|
-
"ramdisk_id#{Base64.encode64(eval(
|
67
|
-
"
|
86
|
+
"detailed_instance_monitoring#{Base64.encode64(eval(ASG_DSL_VALUES[:detailed_instance_monitoring]).to_s)}"\
|
87
|
+
"spot_price#{Base64.encode64(eval(ASG_DSL_VALUES[:spot_price]))}" \
|
88
|
+
"iam_instance_profile#{Base64.encode64(eval(ASG_DSL_VALUES[:iam_instance_profile]))}"\
|
89
|
+
"block_device_mappings#{Base64.encode64(eval(ASG_DSL_VALUES[:block_device_mappings]).join("\t"))}"\
|
90
|
+
"image_id#{Base64.encode64(eval(ASG_DSL_VALUES[:image_id]))}"\
|
91
|
+
"key_name#{Base64.encode64(eval(ASG_DSL_VALUES[:key_name]))}"\
|
92
|
+
"security_groups#{Base64.encode64(eval(ASG_DSL_VALUES[:security_groups]).join("\t"))}"\
|
93
|
+
"instance_type#{Base64.encode64(eval(ASG_DSL_VALUES[:instance_type]))}"\
|
94
|
+
"kernel_id#{Base64.encode64(eval(ASG_DSL_VALUES[:kernel_id]))}"\
|
95
|
+
"ramdisk_id#{Base64.encode64(eval(ASG_DSL_VALUES[:ramdisk_id]))}"\
|
96
|
+
"associate_public_ip_address#{Base64.encode64(eval(ASG_DSL_VALUES[:associate_public_ip_address]).to_s)}"
|
68
97
|
|
69
98
|
def tempdir_context(name, &block)
|
70
99
|
context name do
|
@@ -83,11 +112,6 @@ module SpecHelpers
|
|
83
112
|
end
|
84
113
|
end
|
85
114
|
|
86
|
-
def dsl_from_hash(hash)
|
87
|
-
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
115
|
def generate_config_mock(mock, attrs)
|
92
116
|
attrs.each_pair do |a, v|
|
93
117
|
if v.respond_to? :each_pair
|
data/spec/util_spec.rb
CHANGED
@@ -1,34 +1,27 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require_relative './spec_setup'
|
3
|
+
require_relative './shared_examples/a_config_util'
|
3
4
|
|
4
5
|
include SpecHelpers
|
5
6
|
|
6
|
-
describe
|
7
|
-
|
8
|
-
before do
|
9
|
-
FileUtils.mkdir_p AUTOSCALE_DIR
|
10
|
-
end
|
7
|
+
describe "rivet utils" do
|
8
|
+
context "with client_type set to autoscale" do
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
10
|
+
let(:config_dir) { AUTOSCALE_DIR }
|
11
|
+
let(:config_content) { ASG_CONFIG_CONTENT }
|
12
|
+
let(:config_file) { ASG_CONFIG_FILE }
|
13
|
+
let(:dsl_values) { ASG_DSL_VALUES }
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
File.open(CONFIG_FILE, 'w') { |f| f.write(DSL_CONFIG_CONTENT) }
|
23
|
-
end
|
15
|
+
it_behaves_like "a config util"
|
16
|
+
end
|
24
17
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
18
|
+
context "with client_type set to ec2" do
|
19
|
+
let(:config_dir) { EC2_DIR }
|
20
|
+
let(:config_content) { EC2_CONFIG_CONTENT }
|
21
|
+
let(:config_file) { EC2_CONFIG_FILE }
|
22
|
+
let(:dsl_values) { EC2_DSL_VALUES }
|
32
23
|
|
24
|
+
it_behaves_like "a config util"
|
33
25
|
end
|
26
|
+
|
34
27
|
end
|
metadata
CHANGED
@@ -1,78 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rivet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Bianco
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: aws-sdk
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.11.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.11.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: diff-lcs
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.2.5
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: pry
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
|
-
- - ~>
|
45
|
+
- - "~>"
|
36
46
|
- !ruby/object:Gem::Version
|
37
47
|
version: 0.9.12
|
38
48
|
type: :development
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
|
-
- - ~>
|
52
|
+
- - "~>"
|
44
53
|
- !ruby/object:Gem::Version
|
45
54
|
version: 0.9.12
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: rake
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
|
-
- -
|
59
|
+
- - ">="
|
52
60
|
- !ruby/object:Gem::Version
|
53
61
|
version: 10.1.0
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
|
-
- -
|
66
|
+
- - ">="
|
60
67
|
- !ruby/object:Gem::Version
|
61
68
|
version: 10.1.0
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: rspec
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- - ~>
|
73
|
+
- - "~>"
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: 2.14.1
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- - ~>
|
80
|
+
- - "~>"
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: 2.14.1
|
78
83
|
description: Rivet allows you to define autoscaling groups and launch configurations
|
@@ -84,9 +89,9 @@ executables:
|
|
84
89
|
extensions: []
|
85
90
|
extra_rdoc_files: []
|
86
91
|
files:
|
87
|
-
- .gitignore
|
88
|
-
- .rubocop.yml
|
89
|
-
- .travis.yml
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rubocop.yml"
|
94
|
+
- ".travis.yml"
|
90
95
|
- CHANGELOG.md
|
91
96
|
- Gemfile
|
92
97
|
- Gemfile.lock
|
@@ -97,60 +102,75 @@ files:
|
|
97
102
|
- bin/rivet
|
98
103
|
- example/autoscale/defaults.rb
|
99
104
|
- example/autoscale/example_group.rb
|
105
|
+
- example/ec2/defaults.rb
|
106
|
+
- example/ec2/example.rb
|
107
|
+
- example/ec2/user_data.erb
|
100
108
|
- lib/rivet.rb
|
101
|
-
- lib/rivet/autoscale.rb
|
102
|
-
- lib/rivet/
|
103
|
-
- lib/rivet/
|
104
|
-
- lib/rivet/
|
105
|
-
- lib/rivet/
|
106
|
-
- lib/rivet/
|
107
|
-
- lib/rivet/
|
108
|
-
- lib/rivet/
|
109
|
-
- lib/rivet/
|
110
|
-
- lib/rivet/
|
111
|
-
- lib/rivet/
|
109
|
+
- lib/rivet/as/autoscale.rb
|
110
|
+
- lib/rivet/as/autoscale_config.rb
|
111
|
+
- lib/rivet/as/aws_autoscale_wrapper.rb
|
112
|
+
- lib/rivet/as/launch_config.rb
|
113
|
+
- lib/rivet/common/aws_utils.rb
|
114
|
+
- lib/rivet/common/base_aws_attributes.rb
|
115
|
+
- lib/rivet/common/base_config.rb
|
116
|
+
- lib/rivet/common/bootstrap.rb
|
117
|
+
- lib/rivet/common/client.rb
|
118
|
+
- lib/rivet/common/config_proxy.rb
|
119
|
+
- lib/rivet/common/logger.rb
|
120
|
+
- lib/rivet/common/open_state.rb
|
121
|
+
- lib/rivet/ec2/ec2.rb
|
122
|
+
- lib/rivet/ec2/ec2_config.rb
|
112
123
|
- lib/rivet/utils.rb
|
113
124
|
- lib/rivet/version.rb
|
114
125
|
- rivet.gemspec
|
115
|
-
- spec/
|
126
|
+
- spec/as/autoscale_config_spec.rb
|
127
|
+
- spec/as/aws_autoscale_wrapper_spec.rb
|
128
|
+
- spec/aws_utils_spec.rb
|
129
|
+
- spec/base_config_spec.rb
|
116
130
|
- spec/bootstrap_spec.rb
|
117
131
|
- spec/config_proxy_spec.rb
|
118
|
-
- spec/
|
132
|
+
- spec/ec2/ec2_config_spec.rb
|
119
133
|
- spec/launch_config_spec.rb
|
120
134
|
- spec/open_state_spec.rb
|
135
|
+
- spec/shared_examples/a_config.rb
|
136
|
+
- spec/shared_examples/a_config_util.rb
|
121
137
|
- spec/spec_setup.rb
|
122
138
|
- spec/util_spec.rb
|
123
139
|
homepage: http://www.github.com/brianbianco/rivet
|
124
140
|
licenses:
|
125
141
|
- Apache2
|
142
|
+
metadata: {}
|
126
143
|
post_install_message:
|
127
144
|
rdoc_options: []
|
128
145
|
require_paths:
|
129
146
|
- lib
|
130
147
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
148
|
requirements:
|
133
|
-
- -
|
149
|
+
- - ">="
|
134
150
|
- !ruby/object:Gem::Version
|
135
151
|
version: 1.9.1
|
136
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
153
|
requirements:
|
139
|
-
- -
|
154
|
+
- - ">="
|
140
155
|
- !ruby/object:Gem::Version
|
141
156
|
version: 1.3.6
|
142
157
|
requirements: []
|
143
158
|
rubyforge_project:
|
144
|
-
rubygems_version:
|
159
|
+
rubygems_version: 2.4.2
|
145
160
|
signing_key:
|
146
|
-
specification_version:
|
161
|
+
specification_version: 4
|
147
162
|
summary: A tool for managing autoscaling groups
|
148
163
|
test_files:
|
149
|
-
- spec/
|
164
|
+
- spec/as/autoscale_config_spec.rb
|
165
|
+
- spec/as/aws_autoscale_wrapper_spec.rb
|
166
|
+
- spec/aws_utils_spec.rb
|
167
|
+
- spec/base_config_spec.rb
|
150
168
|
- spec/bootstrap_spec.rb
|
151
169
|
- spec/config_proxy_spec.rb
|
152
|
-
- spec/
|
170
|
+
- spec/ec2/ec2_config_spec.rb
|
153
171
|
- spec/launch_config_spec.rb
|
154
172
|
- spec/open_state_spec.rb
|
173
|
+
- spec/shared_examples/a_config.rb
|
174
|
+
- spec/shared_examples/a_config_util.rb
|
155
175
|
- spec/spec_setup.rb
|
156
176
|
- spec/util_spec.rb
|
data/lib/rivet/deep_merge.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
class Hash
|
4
|
-
# Returns a new hash with +self+ and +other_hash+ merged recursively.
|
5
|
-
#
|
6
|
-
# h1 = { x: { y: [4,5,6] }, z: [7,8,9] }
|
7
|
-
# h2 = { x: { y: [7,8,9] }, z: 'xyz' }
|
8
|
-
#
|
9
|
-
# h1.deep_merge(h2) #=> {x: {y: [7, 8, 9]}, z: "xyz"}
|
10
|
-
# h2.deep_merge(h1) #=> {x: {y: [4, 5, 6]}, z: [7, 8, 9]}
|
11
|
-
# h1.deep_merge(h2) { |key, old, new| Array.wrap(old) + Array.wrap(new) }
|
12
|
-
# #=> {:x=>{:y=>[4, 5, 6, 7, 8, 9]}, :z=>[7, 8, 9, "xyz"]}
|
13
|
-
def deep_merge(other_hash, &block)
|
14
|
-
dup.deep_merge!(other_hash, &block)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Same as +deep_merge+, but modifies +self+.
|
18
|
-
def deep_merge!(other_hash, &block)
|
19
|
-
other_hash.each_pair do |k, v|
|
20
|
-
tv = self[k]
|
21
|
-
if tv.is_a?(Hash) && v.is_a?(Hash)
|
22
|
-
self[k] = tv.deep_merge(v, &block)
|
23
|
-
else
|
24
|
-
self[k] = block && tv ? block.call(k, tv, v) : v
|
25
|
-
end
|
26
|
-
end
|
27
|
-
self
|
28
|
-
end
|
29
|
-
end
|