rivet 3.1.0 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17ff849c874e6617d87fde0075138cbb9dac7b76
4
- data.tar.gz: 5ec8ea590f2a3ddba72425a40223d63e67cec0de
3
+ metadata.gz: fa12652cc297ce7aff30bd474dd41e8dddcbcce7
4
+ data.tar.gz: 3276611cd502b7a0927b8261dfd3706de6f27fad
5
5
  SHA512:
6
- metadata.gz: 8861836069232f57ba7db9c660d9d8efeeb061ea5e19e19b7d5a52428f3dce600ff8b3d2d09d1ee6126c06c95cc0f755efde8ffdf78f7f0f9b4457885ce2b7c2
7
- data.tar.gz: 3e5a12874b5e1ae0216706eb5e5382092d6749d1db5dae6a4059e0d824be6d6213b12d6f6918d0cd035d5cdbe122a198af674a5308ef48eb7c8f9381c231c91c
6
+ metadata.gz: 4353e43ef7b544efb5cd092b60390a50e265fac315394198a6df9d6e9dc3bb72c472419bd183309e0d8b92046f35ff62b414a3e17d5822cd26b32968981f1341
7
+ data.tar.gz: 3dfc0fb8fef331344f88b90119eaf2b486a230706dc485f81ef0fb3906cc1ddeba1dbd412c81426af83e45941c1a5a8df94f16871c563e5b7758064b1e6deb58
@@ -2,6 +2,7 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.1.5
5
+ - 2.2.3
5
6
  - rbx-2
6
7
  - jruby-head
7
8
  before_install:
@@ -1,6 +1,10 @@
1
1
  Rivet CHANGELOG
2
2
  ===
3
3
 
4
+ 3.2.0 -
5
+ ---
6
+ * Adds post instance creation hooks
7
+
4
8
  3.1.0 -
5
9
  ---
6
10
  * Rivet will now use ~/.aws/config if $AWS_CONFIG_FILE isn't set
data/README.md CHANGED
@@ -72,24 +72,52 @@ You can execute any arbitrary ruby you please inside of a rivet configuration.
72
72
 
73
73
  Rivets built in commands:
74
74
 
75
- path()
75
+ **path()**
76
76
 
77
77
  - A function that returns the configuration directory path.
78
78
  - optionally takes any number of strings as arguments and will return the configuration
79
79
  path with those strings joined to it.
80
80
 
81
- import(PATH)
81
+ **import(PATH)**
82
82
 
83
83
  - A function that allows you to import other rivet configuration files
84
84
 
85
- bootstrap
85
+ **bootstrap**
86
86
 
87
87
  - provide this with a template file and a set of variables. The variables will
88
88
  be made available to the template file provided. Rendered, and injected as EC2
89
89
  user-data.
90
90
 
91
- Rivet will only use the following attributes.
91
+ **post**
92
+
93
+ provides a mechansim for you to pass a ruby block to be executed after a sync
94
+ has completed. Behavior is different for autoscale and ec2
95
+
96
+ * EC2
97
+
98
+ After instances have been successfully created block will be called.
99
+ Instances method will be available inside the block and will contain an
100
+ array of instance id's.
101
+
102
+ ```
103
+ post do
104
+ instances.each do |x|
105
+ puts x
106
+ end
107
+ end
108
+ ```
109
+
110
+ * Autoscale
92
111
 
112
+ After the autoscaling group is synced the block will fire. No information is
113
+ currently passed in.
114
+ ```
115
+ post do
116
+ puts "You gotta get schwifty in here"
117
+ end
118
+ ```
119
+
120
+ Rivet will only use the following attributes.
93
121
 
94
122
  Autoscale Options
95
123
  ```
@@ -157,6 +185,9 @@ Block device mappings should be an array of Hashes with the format:
157
185
  no_device: String
158
186
  }
159
187
  ```
188
+
189
+
190
+
160
191
  Using the bootstrap functionality
161
192
  ---------------------------------
162
193
 
@@ -28,11 +28,13 @@ module Rivet
28
28
  ]
29
29
 
30
30
  attr_reader :name
31
+ attr_reader :post
31
32
 
32
33
  def initialize(config)
33
34
  @name = config.name
34
35
  @remote_group = AwsAutoscaleWrapper.new(@name)
35
36
  @launch_config = LaunchConfig.new(config)
37
+ @post = config.post
36
38
 
37
39
  OPTIONS.each do |o|
38
40
  if config.respond_to?(o)
@@ -106,6 +108,11 @@ module Rivet
106
108
  else
107
109
  Rivet::Log.info "No autoscale differences to sync to AWS for #{@name}."
108
110
  end
111
+ # Post processing hooks
112
+ unless post.nil?
113
+ post_processing = OpenStruct.new
114
+ post_processing.instance_eval(&post)
115
+ end
109
116
  end
110
117
 
111
118
  protected
@@ -27,6 +27,11 @@ module Rivet
27
27
  end
28
28
  end
29
29
 
30
+ def post(&block)
31
+ return @block if block.nil?
32
+ @block = block
33
+ end
34
+
30
35
  def normalize_security_groups
31
36
  security_groups.sort
32
37
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Rivet
4
- VERSION = '3.1.0'
4
+ VERSION = '3.2.0'
5
5
  end
@@ -31,6 +31,25 @@ shared_examples_for "a config" do
31
31
  end
32
32
  end
33
33
 
34
+ describe '#post' do
35
+ context 'with no arguments' do
36
+ it 'returns nil' do
37
+ default_config.post.should == nil
38
+ end
39
+ end
40
+ context 'with arguments' do
41
+ it 'returns a callable proc' do
42
+ msg = "Yehaw"
43
+ default_config.post do
44
+ raise msg
45
+ end
46
+ expect do
47
+ default_config.post.call
48
+ end.to raise_error msg
49
+ end
50
+ end
51
+ end
52
+
34
53
  describe '#normalize_security_groups' do
35
54
  before do
36
55
  default_config.security_groups %w(group2 group1 group3)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rivet
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Bianco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2016-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-v1
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  version: 1.3.6
169
169
  requirements: []
170
170
  rubyforge_project:
171
- rubygems_version: 2.4.3
171
+ rubygems_version: 2.4.8
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: A tool for managing autoscaling groups and launching ec2 servers