eb_deployer 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef615dab849a7606f603bd42350de60ac0a3f14f
4
- data.tar.gz: 4a00f6d08956d9cabf4fb5ce8771a82ac5e9f616
3
+ metadata.gz: a339b19fefcb73b8a72dc75be71acdd5c687e51d
4
+ data.tar.gz: 20ab402493ce588c41f77193d65ff54bad160f05
5
5
  SHA512:
6
- metadata.gz: f881ddebf33bd167315214a9cd940e0a531d4fa17f28aa5c096f67eda764392ce36cb53f8555e9957e74312953e7ffd43fe4db15f31f8996ae220b8c39a37c4c
7
- data.tar.gz: f79a4f4d394d8f0f81e72c0b5b245047abd1226417135268b0353cf4349a310c1e21ef90490df7935135fcc9b1bb76e5ce018c8528e73a2a97644ab3a87018c1
6
+ metadata.gz: 029d124d285bcf266aa87313399ad9eb6badcf08a4f305b89ae0811dbbe7ec9dc29c8896f8965108fca94aea22b028cba32f175c80f93f9b276f86a0fee38a50
7
+ data.tar.gz: 75e13ca3c1f39f06a81b0db7be58b1d2da79852aeceb4d06af9ad5d5379d90696534c0168e6382cf2ecdd320ce00a210c7d5bd26876492a5ae27ea19b5bd941d
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # EbDeployer [![Build Status](https://snap-ci.com/ThoughtWorksStudios/eb_deployer/branch/master/build_image)](https://snap-ci.com/ThoughtWorksStudios/eb_deployer/branch/master) [![Build Status](https://travis-ci.org/ThoughtWorksStudios/eb_deployer.png?branch=master)](https://travis-ci.org/ThoughtWorksStudios/eb_deployer)
1
+ # EbDeployer [![Build Status](https://snap-ci.com/ThoughtWorksStudios/eb_deployer/branch/master/build_image)](https://snap-ci.com/ThoughtWorksStudios/eb_deployer/branch/master) [![Build Status](https://travis-ci.org/ThoughtWorksStudios/eb_deployer.png?branch=master)](https://travis-ci.org/ThoughtWorksStudios/eb_deployer) [![Gem Version](https://badge.fury.io/rb/eb_deployer.svg)](http://badge.fury.io/rb/eb_deployer)
2
2
 
3
3
  [Built with :yellow_heart: and :coffee: in San Francisco](http://www.thoughtworks.com/mingle/team/)
4
4
 
@@ -91,6 +91,16 @@ Later tutorials coming soon will cover
91
91
 
92
92
  Take a look at code if you can not wait for the documentation.
93
93
 
94
+ ### eb_deploy.yml configuration file
95
+
96
+ Like Rails database.yml file, EbDeployer will read eb_deploy.yml file as ERB template file. So you can trade it as standard ERB template file, and substitute Ruby script.
97
+
98
+ By default, EbDeployer provides the following methods:
99
+
100
+ 1. random_hash: it basically is `SecureRandom.hex[0..9]`
101
+ 2. package_digest: it is your eb package file digest
102
+ 3. environment: environment name you passed in when executing eb_deploy script.
103
+
94
104
  ## More
95
105
 
96
106
  [Automated zero downtime deployment to AWS Elastic Beanstalk for Rails with EbDeployer](http://helabs.com/blog/2015/05/19/automated-zero-downtime-deployment-to-aws-elastic-beanstalk-for-rails-with-eb-deployer/?utm_content=buffer12098&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer)
@@ -117,4 +127,3 @@ AWS re:Invent 2013: [slideshare](http://www.slideshare.net/AmazonWebServices/aws
117
127
 
118
128
 
119
129
  [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ThoughtWorksStudios/eb_deployer/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
120
-
@@ -7,24 +7,24 @@ module EbDeployer
7
7
  include Utils
8
8
 
9
9
  class EvalBinding
10
- def initialize(package_digest)
10
+ attr_reader :environment, :package_digest
11
+ def initialize(package_digest, env)
11
12
  @package_digest = package_digest
13
+ @environment = env
12
14
  end
13
15
 
14
16
  def random_hash
15
17
  SecureRandom.hex[0..9]
16
18
  end
17
-
18
- def package_digest
19
- @package_digest
20
- end
21
19
  end
22
20
 
23
21
  def load(options)
24
22
  options = options.dup
25
23
  package_digest = package_digest(options[:package])
26
24
  config_file = options.delete(:config_file)
27
- config_settings = load_config_settings(config_file, package_digest)
25
+
26
+ env = options[:environment]
27
+ config_settings = load_config_settings(config_file, package_digest, env)
28
28
 
29
29
  app_name = config_settings[:application]
30
30
 
@@ -32,7 +32,6 @@ module EbDeployer
32
32
  common_settings[:version_label] ||= package_digest
33
33
 
34
34
  envs = config_settings[:environments]
35
- env = options[:environment]
36
35
  raise "Environment #{env} is not defined in #{config_file}" unless envs.has_key?(env)
37
36
  env_settings = symbolize_keys(envs[env] || {})
38
37
  env_option_settings = env_settings.delete(:option_settings) || []
@@ -46,13 +45,14 @@ module EbDeployer
46
45
 
47
46
  private
48
47
 
49
- def load_config_settings(config_file, package_digest)
50
- yaml = ERB.new(File.read(config_file)).result(eval_binding(package_digest))
48
+ def load_config_settings(config_file, package_digest, env)
49
+ yaml = ERB.new(File.read(config_file)).
50
+ result(eval_binding(package_digest, env))
51
51
  symbolize_keys(YAML.load(yaml))
52
52
  end
53
53
 
54
- def eval_binding(package_digest)
55
- EvalBinding.new(package_digest).instance_eval { binding }
54
+ def eval_binding(package_digest, env)
55
+ EvalBinding.new(package_digest, env).instance_eval { binding }
56
56
  end
57
57
 
58
58
  def package_digest(package)
@@ -1,3 +1,3 @@
1
1
  module EbDeployer
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -173,6 +173,19 @@ YAML
173
173
  'value' => '0'}], config[:inactive_settings])
174
174
  end
175
175
 
176
+ def test_access_environment_name_in_config_yml_file
177
+ config = @loader.load(generate_input(<<-YAML, :environment => 'dev'))
178
+ application: myapp
179
+ common:
180
+ resources:
181
+ inputs:
182
+ env: <%= environment %>
183
+ environments:
184
+ dev:
185
+ production:
186
+ YAML
187
+ assert_equal('dev', config[:resources]['inputs']['env'])
188
+ end
176
189
 
177
190
  private
178
191
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eb_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - wpc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-22 00:00:00.000000000 Z
12
+ date: 2015-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk