kiel 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/kiel.rb +22 -2
  2. metadata +2 -2
@@ -14,6 +14,8 @@ require 'kiel/cloud/aws'
14
14
  #
15
15
  # Currently there are two different ways to access the AWS API: RightAWS and the aws-sdk gem.
16
16
  #
17
+ # For an introduction in german please visit http://robitzki.de/blog/Continuous_Deployment_Part_1
18
+ #
17
19
  # License:: Distributes under the MIT license
18
20
 
19
21
  module Kiel
@@ -33,7 +35,16 @@ module Kiel
33
35
  end
34
36
 
35
37
  def cloud
36
- @defaults[ :cloud ] ||= Cloud::AWS.new
38
+ @cloud = @cloud || begin
39
+ default = @defaults[ :cloud ]
40
+ if default.nil?
41
+ Cloud::AWS.new
42
+ else
43
+ default.respond_to?( :call ) ? default.call() : default
44
+ end
45
+ end
46
+
47
+ @cloud
37
48
  end
38
49
 
39
50
  def setup
@@ -196,7 +207,16 @@ module Kiel
196
207
  # be an instance of +Kiel::Setup::Capistrano+.
197
208
  #
198
209
  # :cloud:: An instance of the cloud provider to lookup images and to access cloud instances. By default this will
199
- # be an instance of +Kiel::Cloud::AWS+
210
+ # be an instance of +Kiel::Cloud::AWS+. If the given object respond_to?( :call ), the construction can be
211
+ # further deferred until the first time, a call to AWS is issued.
212
+ #
213
+ # Example:
214
+ # Kiel::image [ 'a', 'b', 'c' ], cloud: Kiel::Cloud::RightAWS.new( credentials: secrets )
215
+ # Kiel::image [ 'a', 'b', 'c' ], cloud: lambda{ Kiel::Cloud::RightAWS.new credentials: secrets }
216
+ #
217
+ # The first version constructs the cloud provider before calling the image(), the second version just passes a
218
+ # lambda that will defer the construction until the cloud provider is actual needed. The later version is especial
219
+ # useful in rakefiles.
200
220
  #
201
221
  # :base_image:: A cloud image id that is used as base for the very first step. This is the right most argument in
202
222
  # the list of +steps+.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiel
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  segments:
67
67
  - 0
68
- hash: 2193310327288113027
68
+ hash: 984900516554466752
69
69
  required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements: