dew 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  describe FogModel do
4
4
  let (:fog_object) { double('Fog Object', :id => 'i-12345') }
@@ -21,4 +21,4 @@ describe FogModel do
21
21
  @model.wibble('hello').should == 'goodbye'
22
22
  end
23
23
  end
24
-
24
+
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  describe Profile do
4
4
 
@@ -46,18 +46,18 @@ describe Profile do
46
46
 
47
47
  it "should have a to_s" do
48
48
  subject.to_s.should == <<EOF
49
- +-----------------+----------------------------------------------------------------------------------------------------+
50
- | 2 instances | "c1.medium" (1.7 GB memory, 5 ECUs processor, 350 GB storage, 32-bit platform, ?? I/O performance) |
51
- | disk image | "ami-ccf405a5" |
52
- | security groups | ["non_default"] |
53
- | keypair | "id_revo" |
54
- +-----------------+----------------------------------------------------------------------------------------------------+
49
+ +-----------------+--------------------------------------------------------------------------------+
50
+ | 2 instances | "c1.medium" (1.7 GB memory, 5 ECUs processor, 350 GB storage, 32-bit platform) |
51
+ | disk image | "ami-ccf405a5" |
52
+ | security groups | ["non_default"] |
53
+ | keypair | "id_revo" |
54
+ +-----------------+--------------------------------------------------------------------------------+
55
55
  EOF
56
56
  end
57
57
  end
58
58
 
59
59
  context "defaults" do
60
- its(:username) { should == 'ubuntu' }
60
+ its(:username) { should == Profile::DEFAULT_USERNAME }
61
61
  end
62
62
 
63
63
  describe "without an elb or RDS section" do
@@ -109,4 +109,28 @@ EOF
109
109
  its(:rds_storage_size) { should == storage_size }
110
110
  end
111
111
  end
112
+
113
+ describe "#populate_from_yaml" do
114
+
115
+ subject { x = Profile.new('blah'); x.populate_from_yaml('region', yaml); x }
116
+
117
+ describe "instance_disk_size" do
118
+
119
+ context "with" do
120
+ let(:instance_disk_size) { rand(235) }
121
+ let(:yaml) { { 'instances' => { 'disk-size' => instance_disk_size } } }
122
+
123
+ it { should be_instance_disk_size }
124
+ its(:instance_disk_size) { should == instance_disk_size }
125
+ end
126
+
127
+ context "without" do
128
+ let(:yaml) { { 'instances' => { } } }
129
+
130
+ it { should_not be_instance_disk_size }
131
+ its(:instance_disk_size) { should == nil }
132
+ end
133
+
134
+ end
135
+ end
112
136
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  describe Server do
4
4
 
@@ -14,14 +14,60 @@ describe Server do
14
14
  end
15
15
 
16
16
  describe ".create!" do
17
- it "should ask Fog to create a new server with the provided AMI, size and keypair" do
18
- compute.servers.should_receive(:create).with(:image_id => 'ami', :flavor_id => 'size', :key_name => key_name, :groups => %(non_default))
19
- Server.create!('ami', 'size', key_name, %(non_default))
17
+ let(:ami_name) { 'ami' }
18
+ let(:image_size) { 'size' }
19
+ let(:groups) { %w(non_default) }
20
+
21
+ subject do
22
+ Server.create!(
23
+ :ami => ami_name,
24
+ :size => image_size,
25
+ :keypair => key_name,
26
+ :groups => groups,
27
+ :disk_size => disk_size
28
+ )
20
29
  end
30
+
31
+ context "with a disk size" do
32
+ let(:disk_size) { rand(2345) }
33
+
34
+ it "should ask Fog to create a new server with the provided AMI, size and keypair and disk size" do
35
+ compute.servers.should_receive(:create).with(
36
+ :image_id => ami_name,
37
+ :flavor_id => image_size,
38
+ :key_name => key_name,
39
+ :groups => groups,
40
+ :block_device_mapping => [
41
+ {
42
+ 'DeviceName' => '/dev/sda1',
43
+ 'Ebs.VolumeSize' => disk_size.to_s
44
+ }
45
+ ]
46
+ )
47
+
48
+ subject
49
+ end
50
+
51
+ its(:id) { should == id }
52
+
53
+ end
54
+
55
+ context "without a disk size" do
56
+ let(:disk_size) { nil }
57
+
58
+ it "should ask Fog to create a new server with the provided AMI, size and keypair" do
59
+ compute.servers.should_receive(:create).with(
60
+ :image_id => ami_name,
61
+ :flavor_id => image_size,
62
+ :key_name => key_name,
63
+ :groups => groups
64
+ )
65
+
66
+ subject
67
+ end
21
68
 
22
- it "should return a new server object with an ID" do
23
- server = Server.create!('ami', 'size', key_name, %(non_default))
24
- server.id.should == id
69
+ its(:id) { should == id }
70
+
25
71
  end
26
72
  end
27
73
 
@@ -44,7 +90,7 @@ describe Server do
44
90
  let (:ssh) { double('SSH') }
45
91
 
46
92
  before :each do
47
- @server = Server.create!('ami', 'size', key_name, %(non_default))
93
+ @server = Server.new(fog_server)
48
94
  Gofer::Host.stub(:new => ssh)
49
95
  Cloud.stub(:keyfile_path => '')
50
96
  File.stub(:read => nil)
@@ -108,7 +154,7 @@ describe Server do
108
154
  File.should_receive(:stat).with(@path).and_raise(Errno::ENOENT)
109
155
  end
110
156
 
111
- it { lambda { @server.credentials }.should raise_error %r{Can't find keyfile} }
157
+ it { lambda { @server.credentials }.should raise_error /Can't find keyfile/ }
112
158
  end
113
159
  end
114
160
  end
@@ -197,4 +243,23 @@ describe Server do
197
243
 
198
244
  end
199
245
  end
246
+
247
+ describe "#resize_disk" do
248
+
249
+ let(:cloud_server) { mock(:public_ip_address => '33.33.33.33', :tags => {}) }
250
+ let(:server) { Server.new(cloud_server) }
251
+ let(:ssh) { mock }
252
+
253
+ before do
254
+ server.stub(:ssh => ssh)
255
+ end
256
+
257
+ subject { server.resize_disk }
258
+
259
+ it "should run resize2fs on the box" do
260
+ server.ssh.should_receive(:run).with('sudo resize2fs -p /dev/sda1')
261
+ subject
262
+ end
263
+
264
+ end
200
265
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  describe Password do
4
4
 
@@ -8,4 +8,4 @@ describe Password do
8
8
  end
9
9
  end
10
10
  end
11
-
11
+
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  describe String do
4
4
  describe :indent do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-25 00:00:00.000000000Z
12
+ date: 2011-11-03 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: inform
16
- requirement: &21769520 !ruby/object:Gem::Requirement
16
+ requirement: &14142760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.0.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *21769520
24
+ version_requirements: *14142760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: clamp
27
- requirement: &21768760 !ruby/object:Gem::Requirement
27
+ requirement: &14142140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.2.3
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *21768760
35
+ version_requirements: *14142140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fog
38
- requirement: &21768040 !ruby/object:Gem::Requirement
38
+ requirement: &14141560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.0.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *21768040
46
+ version_requirements: *14141560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: gofer
49
- requirement: &21767520 !ruby/object:Gem::Requirement
49
+ requirement: &14140980 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.2.5
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *21767520
57
+ version_requirements: *14140980
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: highline
60
- requirement: &21767040 !ruby/object:Gem::Requirement
60
+ requirement: &14140400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *21767040
68
+ version_requirements: *14140400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: terminal-table
71
- requirement: &21766320 !ruby/object:Gem::Requirement
71
+ requirement: &14139820 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.4.3
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *21766320
79
+ version_requirements: *14139820
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: opensrs
82
- requirement: &21765720 !ruby/object:Gem::Requirement
82
+ requirement: &14139320 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *21765720
90
+ version_requirements: *14139320
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: nokogiri
93
- requirement: &21765240 !ruby/object:Gem::Requirement
93
+ requirement: &14138740 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *21765240
101
+ version_requirements: *14138740
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rake
104
- requirement: &21764700 !ruby/object:Gem::Requirement
104
+ requirement: &14138120 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 0.8.7
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *21764700
112
+ version_requirements: *14138120
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec
115
- requirement: &21764160 !ruby/object:Gem::Requirement
115
+ requirement: &14137460 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 2.6.0
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *21764160
123
+ version_requirements: *14137460
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: cucumber
126
- requirement: &21763680 !ruby/object:Gem::Requirement
126
+ requirement: &14136980 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 0.10.3
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *21763680
134
+ version_requirements: *14136980
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: simplecov
137
- requirement: &21763200 !ruby/object:Gem::Requirement
137
+ requirement: &14136500 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 0.4.0
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *21763200
145
+ version_requirements: *14136500
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: flay
148
- requirement: &21762700 !ruby/object:Gem::Requirement
148
+ requirement: &14136000 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ~>
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: 1.4.2
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *21762700
156
+ version_requirements: *14136000
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: geminabox
159
- requirement: &21762320 !ruby/object:Gem::Requirement
159
+ requirement: &14135500 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *21762320
167
+ version_requirements: *14135500
168
168
  description: ! 'Dew is a layer between fog and the ground
169
169
 
170
170
  '
@@ -216,6 +216,7 @@ files:
216
216
  - example/dew/profiles/test-full.yaml
217
217
  - example/dew/accounts/development.yaml
218
218
  - Rakefile
219
+ - spec/spec_helper.rb
219
220
  - spec/dew/view_spec.rb
220
221
  - spec/dew/models/fog_model_spec.rb
221
222
  - spec/dew/models/server_spec.rb
@@ -229,7 +230,6 @@ files:
229
230
  - spec/dew/controllers/amis_controller_spec.rb
230
231
  - spec/dew/controllers/environments_controller_spec.rb
231
232
  - spec/dew/password_spec.rb
232
- - spec/dew/spec_helper.rb
233
233
  - spec/dew/cloud_spec.rb
234
234
  - features/deploy-puge.feature
235
235
  - features/create-ami.feature
@@ -266,6 +266,7 @@ specification_version: 3
266
266
  summary: Uses fog to access the cloud
267
267
  test_files:
268
268
  - Rakefile
269
+ - spec/spec_helper.rb
269
270
  - spec/dew/view_spec.rb
270
271
  - spec/dew/models/fog_model_spec.rb
271
272
  - spec/dew/models/server_spec.rb
@@ -279,7 +280,6 @@ test_files:
279
280
  - spec/dew/controllers/amis_controller_spec.rb
280
281
  - spec/dew/controllers/environments_controller_spec.rb
281
282
  - spec/dew/password_spec.rb
282
- - spec/dew/spec_helper.rb
283
283
  - spec/dew/cloud_spec.rb
284
284
  - features/deploy-puge.feature
285
285
  - features/create-ami.feature