awsborn 0.3.8 → 0.3.9

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.8
1
+ 0.3.9
@@ -247,24 +247,18 @@ module Awsborn
247
247
  @describe_instance ||= ec2.describe_instance
248
248
  end
249
249
  end
250
-
250
+
251
+ AVAILABILITY_ZONES = %w[
252
+ us-east-1a us-east-1b us-east-1c us-east-1d
253
+ us-west-1a us-west-1b
254
+ eu-west-1a eu-west-1b
255
+ ap-southeast-1a ap-southeast-1b
256
+ ]
257
+ INSTANCE_TYPES = %w[m1.small m1.large m1.xlarge m2.xlarge m2.2xlarge m2.4xlarge c1.medium c1.xlarge]
258
+ SYMBOL_CONSTANT_MAP = (AVAILABILITY_ZONES + INSTANCE_TYPES).inject({}) { |memo,str| memo[str.tr('-.','_').to_sym] = str; memo }
259
+
251
260
  def constant (symbol)
252
- {
253
- :us_east_1a => "us-east-1a",
254
- :us_east_1b => "us-east-1b",
255
- :us_east_1c => "us-east-1c",
256
- :us_west_1a => "us-west-1a",
257
- :us_west_1b => "us-west-1b",
258
- :eu_west_1a => "eu-west-1a",
259
- :eu_west_1b => "eu-west-1b",
260
- :m1_small => "m1.small",
261
- :m1_large => "m1.large" ,
262
- :m1_xlarge => "m1.xlarge",
263
- :m2_2xlarge => "m2.2xlarge",
264
- :m2_4xlarge => "m2.4xlarge",
265
- :c1_medium => "c1.medium",
266
- :c1_xlarge => "c1.xlarge"
267
- }[symbol]
261
+ SYMBOL_CONSTANT_MAP[symbol]
268
262
  end
269
263
 
270
264
  def logger
@@ -273,3 +267,4 @@ module Awsborn
273
267
 
274
268
  end
275
269
  end
270
+
data/spec/server_spec.rb CHANGED
@@ -10,6 +10,17 @@ describe Awsborn::Server do
10
10
  before(:each) do
11
11
  @server = SampleServer.new :sample, :zone => :eu_west_1a, :disk => {:sdf => "vol-aaaaaaaa"}
12
12
  end
13
+
14
+ context "constants" do
15
+ it "should look up an availability zone" do
16
+ @server.constant(:eu_west_1a).should == "eu-west-1a"
17
+ end
18
+ it "should look up an instance type" do
19
+ @server.constant(:m1_large).should == "m1.large"
20
+ end
21
+ end
22
+
23
+ # TODO
13
24
  context "first of all" do
14
25
  it "should have a connection to the EU service point"
15
26
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 8
9
- version: 0.3.8
8
+ - 9
9
+ version: 0.3.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Vrensk
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-04 00:00:00 +02:00
17
+ date: 2010-06-09 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -112,7 +112,6 @@ files:
112
112
  - lib/awsborn/rake.rb
113
113
  - lib/awsborn/server.rb
114
114
  - lib/awsborn/server_cluster.rb
115
- - spec/awsborn_spec.rb
116
115
  - spec/server_spec.rb
117
116
  - spec/spec.opts
118
117
  - spec/spec_helper.rb
@@ -147,6 +146,5 @@ signing_key:
147
146
  specification_version: 3
148
147
  summary: Awsborn defines servers as instances with a certain disk volume, which makes it easy to restart missing servers.
149
148
  test_files:
150
- - spec/awsborn_spec.rb
151
149
  - spec/server_spec.rb
152
150
  - spec/spec_helper.rb
data/spec/awsborn_spec.rb DELETED
@@ -1,7 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "Awsborn" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
6
- end
7
- end