auser-poolparty 1.2.2 → 1.2.3

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.
Files changed (247) hide show
  1. data/VERSION.yml +1 -1
  2. data/bin/cloud +37 -48
  3. data/bin/cloud-bootstrap +33 -23
  4. data/bin/cloud-configure +33 -34
  5. data/bin/cloud-console +31 -9
  6. data/bin/cloud-contract +27 -11
  7. data/bin/cloud-expand +32 -19
  8. data/bin/cloud-list +31 -15
  9. data/bin/cloud-osxcopy +22 -12
  10. data/bin/cloud-provision +35 -24
  11. data/bin/cloud-setup-dev +31 -20
  12. data/bin/cloud-show +40 -21
  13. data/bin/cloud-ssh +24 -15
  14. data/bin/cloud-start +33 -19
  15. data/bin/cloud-terminate +33 -20
  16. data/bin/cloud-verify +38 -29
  17. data/bin/install-poolparty +4 -198
  18. data/bin/server-cloud-elections +1 -1
  19. data/examples/basic.rb +9 -9
  20. data/examples/fairchild.rb +1 -1
  21. data/examples/metavirt_cloud.rb +21 -0
  22. data/lib/poolparty/aska.rb +3 -0
  23. data/lib/poolparty/base_packages/haproxy.rb +19 -18
  24. data/lib/poolparty/base_packages/poolparty.rb +1 -1
  25. data/lib/poolparty/core/hash.rb +46 -0
  26. data/lib/poolparty/core/object.rb +21 -15
  27. data/lib/poolparty/core/string.rb +16 -0
  28. data/lib/poolparty/dependency_resolver/chef_resolver.rb +23 -6
  29. data/lib/poolparty/dependency_resolver/dependency_resolver.rb +1 -1
  30. data/lib/poolparty/dependency_resolver/dependency_resolver_cloud_extensions.rb +2 -2
  31. data/lib/poolparty/dependency_resolver/puppet_resolver.rb +10 -32
  32. data/lib/poolparty/helpers/optioner.rb +19 -14
  33. data/lib/poolparty/installers/base_installer.rb +113 -0
  34. data/lib/poolparty/installers/ec2.rb +141 -0
  35. data/lib/poolparty/installers/vmrun.rb +144 -0
  36. data/lib/poolparty/modules/callbacks.rb +6 -2
  37. data/lib/poolparty/modules/cloud_dsl.rb +2 -2
  38. data/lib/poolparty/modules/cloud_resourcer.rb +10 -50
  39. data/lib/poolparty/modules/file_writer.rb +2 -2
  40. data/lib/poolparty/modules/pinger.rb +4 -1
  41. data/lib/poolparty/modules/resourcing_dsl.rb +1 -29
  42. data/lib/poolparty/modules/searchable_paths.rb +3 -3
  43. data/lib/poolparty/monitors/monitor_rack.rb +1 -1
  44. data/lib/poolparty/net/remote_bases.rb +2 -0
  45. data/lib/poolparty/net/remote_instance.rb +6 -4
  46. data/lib/poolparty/net/remoter/interactive.rb +2 -3
  47. data/lib/poolparty/net/remoter_base.rb +54 -31
  48. data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +49 -26
  49. data/lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb +6 -19
  50. data/lib/poolparty/net/remoter_bases/ec2/ec2_response_object.rb +4 -3
  51. data/lib/poolparty/net/remoter_bases/metavirt/metavirt.rb +99 -0
  52. data/lib/poolparty/net/remoter_bases/metavirt/metavirt_instance.rb +52 -0
  53. data/lib/poolparty/net/remoter_bases/vmrun/utilities/vm_disk.rb +1 -1
  54. data/lib/poolparty/net/remoter_bases/vmrun/utilities/vmx.rb +1 -1
  55. data/lib/poolparty/net/remoter_bases/vmrun/utilities/vmx_file.rb +117 -117
  56. data/lib/poolparty/net/remoter_bases/vmrun/vmrun.rb +36 -31
  57. data/lib/poolparty/net/remoter_bases/vmrun/vmrun_instance.rb +9 -5
  58. data/lib/poolparty/plugins/apache2/apache.rb +118 -73
  59. data/lib/poolparty/plugins/chef.rb +15 -17
  60. data/lib/poolparty/plugins/chef_deploy.rb +18 -4
  61. data/lib/poolparty/plugins/deploy_directory.rb +25 -16
  62. data/lib/poolparty/plugins/gem_package.rb +15 -5
  63. data/lib/poolparty/plugins/git.rb +44 -30
  64. data/lib/poolparty/plugins/line_in_file.rb +5 -1
  65. data/lib/poolparty/plugins/rails_deploy.rb +79 -26
  66. data/lib/poolparty/plugins/svn.rb +2 -2
  67. data/lib/poolparty/poolparty/cloud.rb +101 -47
  68. data/lib/poolparty/poolparty/default.rb +25 -23
  69. data/lib/poolparty/poolparty/key.rb +18 -27
  70. data/lib/poolparty/poolparty/neighborhoods.rb +1 -1
  71. data/lib/poolparty/poolparty/plugin.rb +17 -7
  72. data/lib/poolparty/poolparty/pool.rb +3 -3
  73. data/lib/poolparty/poolparty/poolparty_base_class.rb +41 -35
  74. data/lib/poolparty/poolparty/resource.rb +18 -44
  75. data/lib/poolparty/poolparty/service.rb +1 -5
  76. data/lib/poolparty/provision/boot_strapper.rb +24 -19
  77. data/lib/poolparty/provision/configurations/chef.rb +4 -4
  78. data/lib/poolparty/provision/dr_configure.rb +11 -10
  79. data/lib/poolparty/resources/cron.rb +7 -3
  80. data/lib/poolparty/resources/directory.rb +7 -0
  81. data/lib/poolparty/resources/exec.rb +2 -1
  82. data/lib/poolparty/resources/file.rb +23 -9
  83. data/lib/poolparty/resources/group.rb +21 -0
  84. data/lib/poolparty/resources/host.rb +2 -1
  85. data/lib/poolparty/resources/mount.rb +0 -4
  86. data/lib/poolparty/resources/remote_file.rb +1 -1
  87. data/lib/poolparty/resources/service.rb +2 -1
  88. data/lib/poolparty/resources/sshkey.rb +10 -12
  89. data/lib/poolparty/resources/symlink.rb +3 -5
  90. data/lib/poolparty/resources/user.rb +5 -0
  91. data/lib/poolparty/resources/variable.rb +1 -1
  92. data/lib/poolparty/templates/haproxy.conf +1 -1
  93. data/lib/poolparty/verification/verify.rb +4 -0
  94. data/lib/poolparty.rb +9 -4
  95. data/lib/poolpartycl.rb +1 -52
  96. data/spec/bin/bin_spec_helper.rb +1 -0
  97. data/spec/bin/server-list-active_spec.rb +3 -3
  98. data/spec/poolparty/core/object_spec.rb +9 -46
  99. data/spec/poolparty/dependency_resolver/dependency_resolver_cloud_extensions_spec.rb +18 -12
  100. data/spec/poolparty/fixtures/clouds.json +1 -1
  101. data/spec/poolparty/helpers/optioner_spec.rb +4 -11
  102. data/spec/poolparty/modules/cloud_resourcer_spec.rb +1 -1
  103. data/spec/poolparty/net/remote_instance_spec.rb +0 -1
  104. data/spec/poolparty/net/remoter_base_spec.rb +7 -11
  105. data/spec/poolparty/net/remoter_bases/ec2_mocks_and_stubs.rb +9 -11
  106. data/spec/poolparty/net/remoter_bases/ec2_remote_instance_spec.rb +6 -44
  107. data/spec/poolparty/net/remoter_bases/ec2_spec.rb +2 -3
  108. data/spec/poolparty/net/remoter_spec.rb +2 -3
  109. data/spec/poolparty/plugins/git_spec.rb +5 -8
  110. data/spec/poolparty/poolparty/cloud_spec.rb +17 -24
  111. data/spec/poolparty/poolparty/configurers/files/ruby_basic.rb +1 -3
  112. data/spec/poolparty/poolparty/configurers/ruby_spec.rb +1 -6
  113. data/spec/poolparty/poolparty/default_spec.rb +23 -22
  114. data/spec/poolparty/poolparty/example_spec.rb +6 -5
  115. data/spec/poolparty/poolparty/plugin_model_spec.rb +7 -4
  116. data/spec/poolparty/poolparty/pool_spec.rb +2 -9
  117. data/spec/poolparty/poolparty/resource_spec.rb +10 -24
  118. data/spec/poolparty/poolparty/script_spec.rb +1 -4
  119. data/spec/poolparty/poolparty/test_plugins/webserver.rb +0 -2
  120. data/spec/poolparty/resources/file_spec.rb +4 -4
  121. data/spec/poolparty/resources/service_spec.rb +1 -1
  122. data/spec/poolparty/spec_helper.rb +9 -38
  123. data/tasks/spec.rake +6 -2
  124. data/test/fixtures/test_key +1 -0
  125. data/test/poolparty/core/object_test.rb +29 -0
  126. data/test/poolparty/dependency_resolver/puppet_resolver_test.rb +1 -1
  127. data/test/poolparty/modules/cloud_dsl_test.rb +4 -4
  128. data/test/poolparty/net/remoter_bases/metavirt/metavirt_test.rb +55 -0
  129. data/test/poolparty/net/remoter_bases/vmrun/vmrun_test.rb +41 -14
  130. data/test/poolparty/plugins/chef_deploy_test.rb +37 -0
  131. data/test/poolparty/plugins/rails_deploy_test.rb +50 -0
  132. data/test/poolparty/poolparty/plugin_test.rb +18 -0
  133. data/test/poolparty/poolparty/poolparty_base_class_test.rb +41 -3
  134. data/test/test_helper.rb +5 -1
  135. data/vendor/gems/dslify/LICENSE +20 -0
  136. data/vendor/gems/dslify/README.rdoc +33 -0
  137. data/vendor/gems/dslify/Rakefile +56 -56
  138. data/vendor/gems/dslify/lib/dslify.rb +76 -5
  139. data/vendor/gems/dslify/test/dslify_test.rb +197 -0
  140. data/vendor/gems/dslify/test/test_helper.rb +7 -0
  141. data/vendor/gems/git-style-binaries/README.markdown +274 -0
  142. data/vendor/gems/{butterfly → git-style-binaries}/Rakefile +64 -62
  143. data/vendor/gems/git-style-binaries/VERSION.yml +4 -0
  144. data/vendor/gems/git-style-binaries/doc/EXAMPLES +1 -0
  145. data/vendor/gems/git-style-binaries/doc/poolparty-binaries.screenplay +45 -0
  146. data/vendor/gems/git-style-binaries/git-style-binaries.gemspec +69 -0
  147. data/vendor/gems/git-style-binaries/lib/ext/colorize.rb +198 -0
  148. data/vendor/gems/git-style-binaries/lib/ext/core.rb +16 -0
  149. data/vendor/gems/git-style-binaries/lib/git-style-binary/autorunner.rb +21 -0
  150. data/vendor/gems/git-style-binaries/lib/git-style-binary/command.rb +204 -0
  151. data/vendor/gems/git-style-binaries/lib/git-style-binary/commands/help.rb +32 -0
  152. data/vendor/gems/git-style-binaries/lib/git-style-binary/helpers/name_resolver.rb +78 -0
  153. data/vendor/gems/git-style-binaries/lib/git-style-binary/helpers/pager.rb +37 -0
  154. data/vendor/gems/git-style-binaries/lib/git-style-binary/parser.rb +223 -0
  155. data/vendor/gems/git-style-binaries/lib/git-style-binary.rb +74 -0
  156. data/vendor/gems/git-style-binaries/test/fixtures/flickr +4 -0
  157. data/vendor/gems/git-style-binaries/test/fixtures/flickr-download +17 -0
  158. data/vendor/gems/git-style-binaries/test/fixtures/wordpress +42 -0
  159. data/vendor/gems/git-style-binaries/test/fixtures/wordpress-categories +18 -0
  160. data/vendor/gems/git-style-binaries/test/fixtures/wordpress-list +18 -0
  161. data/vendor/gems/git-style-binaries/test/fixtures/wordpress-post +26 -0
  162. data/vendor/gems/git-style-binaries/test/git-style-binary/command_test.rb +17 -0
  163. data/vendor/gems/git-style-binaries/test/git_style_binary_test.rb +21 -0
  164. data/vendor/gems/git-style-binaries/test/running_binaries_test.rb +224 -0
  165. data/vendor/gems/git-style-binaries/test/shoulda_macros/matching_stdio.rb +13 -0
  166. data/vendor/gems/git-style-binaries/test/test_helper.rb +28 -0
  167. data/vendor/gems/parenting/lib/parenting/parenting.rb +13 -4
  168. data/vendor/gems/rest-client/README.rdoc +151 -0
  169. data/vendor/gems/rest-client/Rakefile +85 -0
  170. data/vendor/gems/rest-client/bin/restclient +87 -0
  171. data/vendor/gems/rest-client/lib/rest_client.rb +2 -0
  172. data/vendor/gems/rest-client/lib/restclient/exceptions.rb +84 -0
  173. data/vendor/gems/rest-client/lib/restclient/mixin/response.rb +43 -0
  174. data/vendor/gems/rest-client/lib/restclient/raw_response.rb +30 -0
  175. data/vendor/gems/rest-client/lib/restclient/request.rb +232 -0
  176. data/vendor/gems/rest-client/lib/restclient/resource.rb +146 -0
  177. data/vendor/gems/rest-client/lib/restclient/response.rb +20 -0
  178. data/vendor/gems/rest-client/lib/restclient.rb +93 -0
  179. data/vendor/gems/rest-client/rest-client.gemspec +21 -0
  180. data/vendor/gems/rest-client/spec/base.rb +4 -0
  181. data/vendor/gems/rest-client/spec/exceptions_spec.rb +54 -0
  182. data/vendor/gems/rest-client/spec/mixin/response_spec.rb +46 -0
  183. data/vendor/gems/rest-client/spec/raw_response_spec.rb +17 -0
  184. data/vendor/gems/rest-client/spec/request_spec.rb +442 -0
  185. data/vendor/gems/rest-client/spec/resource_spec.rb +75 -0
  186. data/vendor/gems/rest-client/spec/response_spec.rb +16 -0
  187. data/vendor/gems/rest-client/spec/restclient_spec.rb +53 -0
  188. data/vendor/gems/trollop/FAQ.txt +35 -0
  189. data/vendor/gems/trollop/History.txt +97 -0
  190. data/vendor/gems/trollop/Manifest.txt +7 -0
  191. data/vendor/gems/trollop/README.txt +40 -0
  192. data/vendor/gems/trollop/Rakefile +36 -0
  193. data/vendor/gems/trollop/lib/trollop.rb +735 -0
  194. data/vendor/gems/trollop/release-script.txt +13 -0
  195. data/vendor/gems/trollop/test/test_trollop.rb +1042 -0
  196. data/vendor/gems/trollop/www/index.html +167 -0
  197. metadata +100 -70
  198. data/bin/cloud-describe +0 -28
  199. data/bin/cloud-handle-load +0 -27
  200. data/bin/cloud-rsync +0 -28
  201. data/bin/cloud-spec +0 -40
  202. data/lib/poolparty/plugins/nanite.rb +0 -41
  203. data/lib/poolparty/plugins/runit.rb +0 -96
  204. data/vendor/gems/butterfly/History.txt +0 -4
  205. data/vendor/gems/butterfly/PostInstall.txt +0 -2
  206. data/vendor/gems/butterfly/README.rdoc +0 -48
  207. data/vendor/gems/butterfly/VERSION.yml +0 -4
  208. data/vendor/gems/butterfly/bin/flutter +0 -4
  209. data/vendor/gems/butterfly/butterfly.gemspec +0 -37
  210. data/vendor/gems/butterfly/examples/config.ru +0 -15
  211. data/vendor/gems/butterfly/examples/my_app.rb +0 -12
  212. data/vendor/gems/butterfly/lib/butterfly.rb +0 -14
  213. data/vendor/gems/butterfly/lib/handler.rb +0 -48
  214. data/vendor/gems/butterfly/lib/request.rb +0 -29
  215. data/vendor/gems/butterfly/lib/response.rb +0 -49
  216. data/vendor/gems/butterfly/script/console +0 -10
  217. data/vendor/gems/butterfly/script/destroy +0 -14
  218. data/vendor/gems/butterfly/script/generate +0 -14
  219. data/vendor/gems/butterfly/test/test_adapter_base.rb +0 -23
  220. data/vendor/gems/butterfly/test/test_butterfly_request.rb +0 -46
  221. data/vendor/gems/butterfly/test/test_butterfly_response.rb +0 -43
  222. data/vendor/gems/butterfly/test/test_butterfly_server.rb +0 -16
  223. data/vendor/gems/butterfly/test/test_default.rb +0 -12
  224. data/vendor/gems/butterfly/test/test_helper.rb +0 -6
  225. data/vendor/gems/dslify/History.txt +0 -4
  226. data/vendor/gems/dslify/Manifest.txt +0 -25
  227. data/vendor/gems/dslify/PostInstall.txt +0 -5
  228. data/vendor/gems/dslify/README.txt +0 -60
  229. data/vendor/gems/dslify/config/hoe.rb +0 -73
  230. data/vendor/gems/dslify/config/requirements.rb +0 -15
  231. data/vendor/gems/dslify/dslify.gemspec +0 -40
  232. data/vendor/gems/dslify/lib/dslify/dslify.rb +0 -76
  233. data/vendor/gems/dslify/lib/dslify/version.rb +0 -10
  234. data/vendor/gems/dslify/script/console +0 -10
  235. data/vendor/gems/dslify/script/destroy +0 -14
  236. data/vendor/gems/dslify/script/generate +0 -14
  237. data/vendor/gems/dslify/script/txt2html +0 -82
  238. data/vendor/gems/dslify/setup.rb +0 -1585
  239. data/vendor/gems/dslify/tasks/deployment.rake +0 -34
  240. data/vendor/gems/dslify/tasks/environment.rake +0 -7
  241. data/vendor/gems/dslify/tasks/website.rake +0 -17
  242. data/vendor/gems/dslify/test/test_dslify.rb +0 -138
  243. data/vendor/gems/dslify/website/index.html +0 -86
  244. data/vendor/gems/dslify/website/index.txt +0 -83
  245. data/vendor/gems/dslify/website/javascripts/rounded_corners_lite.inc.js +0 -285
  246. data/vendor/gems/dslify/website/stylesheets/screen.css +0 -138
  247. data/vendor/gems/dslify/website/template.html.erb +0 -48
@@ -12,10 +12,6 @@ class TestService
12
12
  end
13
13
 
14
14
  describe "Cloud" do
15
- before(:each) do
16
- setup
17
- #
18
- end
19
15
  describe "wrapped" do
20
16
  before(:each) do
21
17
  @obj = Object.new
@@ -35,10 +31,10 @@ describe "Cloud" do
35
31
  @obj.cloud(:pop).should == @cloud1
36
32
  end
37
33
  it "should have set the using base on intantiation to ec2" do
38
- @cloud1.using_remoter?.should_not == nil
34
+ @cloud1.remoter_base.should_not == nil
39
35
  end
40
36
  it "should say the remoter_base is ec2 (by default)" do
41
- @cloud1.remote_base.class.should == Kernel::Ec2
37
+ @cloud1.remoter_base.should == :ec2
42
38
  end
43
39
  end
44
40
  it "should return the cloud if the cloud key is already in the clouds list" do
@@ -48,10 +44,8 @@ describe "Cloud" do
48
44
  describe "options" do
49
45
  before(:each) do
50
46
  reset!
51
- setup
52
47
  pool :options do
53
48
  user "bob"
54
- pop_stick true
55
49
  minimum_instances 100
56
50
  access_key "pool_access_key"
57
51
  cloud :apple do
@@ -68,9 +62,6 @@ describe "Cloud" do
68
62
  it "should take the access_key option set from the cloud" do
69
63
  clouds[:apple].access_key.should == "cloud_access_key"
70
64
  end
71
- it "should take the option pop_stick from the superclass" do
72
- clouds[:apple].pop_stick.should == true
73
- end
74
65
  it "should take the option testing true from the superclass" do
75
66
  pools[:options].user.should == "bob"
76
67
  clouds[:apple].user.should == "bob"
@@ -100,8 +91,8 @@ describe "Cloud" do
100
91
  end
101
92
  cloud(:paddy_wack).parent.should == pool(:knick_knack)
102
93
  end
103
- it "should respond to a options method (from Dslify)" do
104
- @cloud.respond_to?(:options).should == true
94
+ it "should respond to a dsl_options method (from Dslify)" do
95
+ @cloud.respond_to?(:dsl_options).should == true
105
96
  end
106
97
  describe "configuration" do
107
98
  before(:each) do
@@ -143,6 +134,9 @@ describe "Cloud" do
143
134
  end
144
135
  @cloud = @pool.cloud(:app)
145
136
  end
137
+ it "should set it's own cloud.tmp_path" do
138
+ @cloud.tmp_path.should == "/tmp/poolparty/just_pool/app"
139
+ end
146
140
  it "should set the minimum based on the range" do
147
141
  @cloud.minimum_instances.should == 8
148
142
  end
@@ -158,24 +152,26 @@ describe "Cloud" do
158
152
  @c = cloud :app do
159
153
  keypair "hotdog"
160
154
  end
161
- @c.keypairs.first.filepath.should == "hotdog"
155
+ @c._keypairs.map {|a| a.basename }.include?("hotdog")
162
156
  end
163
157
  it "should take the pool parent's keypair if it's defined on the pool" do
164
- pool :pool do
165
- keypair "ney"
158
+ pool :pool do
166
159
  cloud :app do
160
+ keypair "ney"
167
161
  end
168
162
  end
169
163
  clouds[:app]._keypairs.first.stub!(:exists?).and_return true
170
164
  clouds[:app]._keypairs.size.should == 2
171
165
  end
172
166
  it "should default to ~/.ssh/id_rsa if none are defined" do
173
- File.stub!(:exists?).with("#{ENV["HOME"]}/.ssh/id_rsa").and_return(true)
167
+ ::File.stub!(:exists?).and_return(false)
168
+ ::File.stub!(:exists?).with(File.expand_path("#{ENV["HOME"]}/.ssh/id_jokes")).and_return(true)
174
169
  pool :pool do
175
170
  cloud :app do
171
+ keypair "id_jokes"
176
172
  end
177
173
  end
178
- clouds[:app].keypair.full_filepath.should match(/\.ssh\/id_rsa/)
174
+ clouds[:app].keypair.full_filepath.should match(/\.ssh\/id_jokes/)
179
175
  end
180
176
  end
181
177
  describe "Manifest" do
@@ -189,7 +185,7 @@ describe "Cloud" do
189
185
  EOE
190
186
  end
191
187
  enable :haproxy
192
- has_gempackage(:name => "poolparty")
188
+ has_gem_package(:name => "poolparty")
193
189
  has_package(:name => "dummy")
194
190
  end
195
191
  context_stack.push @cloud
@@ -220,9 +216,6 @@ describe "Cloud" do
220
216
  end
221
217
  @hb = PoolpartyBaseHeartbeatClass.new
222
218
  end
223
- it "should call heartbeat on the cloud" do
224
- pending
225
- end
226
219
  it "should call enable on the plugin call" do
227
220
  @hb = PoolpartyBaseHeartbeatClass.new
228
221
  PoolpartyBaseHeartbeatClass.stub!(:new).and_return @hb
@@ -263,7 +256,7 @@ describe "Cloud" do
263
256
  str = "master 192.168.0.1
264
257
  node1 192.168.0.2"
265
258
  @sample_instances_list = [{:ip => "192.168.0.1", :name => "master"}, {:ip => "192.168.0.2", :name => "node1"}]
266
- @ris = @sample_instances_list.map {|h| PoolParty::Remote::RemoteInstance.new(h, @cloud) }
259
+ @ris = @sample_instances_list.map {|h| PoolParty::Remote::RemoteInstance.new(h) }
267
260
 
268
261
  stub_remoter_for(@cloud)
269
262
 
@@ -319,4 +312,4 @@ describe "Cloud" do
319
312
  # end
320
313
  end
321
314
  end
322
- end
315
+ end
@@ -1,6 +1,4 @@
1
- pool :poolpartyrb do
2
- plugin_directory "docs_plugins"
3
-
1
+ pool :poolpartyrb do
4
2
  cloud :app do
5
3
 
6
4
  # Configuration
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../test_plugins/webserver'
4
4
  describe "Configurer" do
5
5
  before(:each) do
6
6
  reset!
7
- @basic = File.join(File.dirname(__FILE__), "files", "ruby_basic.rb")
7
+ $pool_specfile = @basic = File.join(File.dirname(__FILE__), "files", "ruby_basic.rb")
8
8
  PoolParty::Pool::Pool.load_from_file @basic
9
9
  @conf = Object.new
10
10
  end
@@ -13,11 +13,6 @@ describe "Configurer" do
13
13
  end
14
14
 
15
15
  describe "with a spec file" do
16
- before(:each) do
17
- @s = Script.new
18
- Script.stub!(:new).and_return(@s)
19
- @basic = File.join(File.dirname(__FILE__), "files", "ruby_basic.rb")
20
- end
21
16
  describe "clouds" do
22
17
  before(:each) do
23
18
  reset!
@@ -30,12 +30,13 @@ describe "Default" do
30
30
  it "should set the remote storage path to /var/poolparty" do
31
31
  Default.remote_storage_path.should == "/var/poolparty"
32
32
  end
33
- it "should have an access key" do
34
- Default.access_key.should == "KEY"
35
- end
36
- it "should have a secret access key" do
37
- Default.secret_access_key.should == "SECRET"
38
- end
33
+ # TODO: WTF?!
34
+ # it "should have an access key" do
35
+ # Default.access_key.should == "KEY"
36
+ # end
37
+ # it "should have a secret access key" do
38
+ # Default.secret_access_key.should == "SECRET"
39
+ # end
39
40
  describe "keys" do
40
41
  it "should have an array of key_file_locations" do
41
42
  Default.key_file_locations.class.should == Array
@@ -94,22 +95,22 @@ describe "Default" do
94
95
  Default.secret_access_key.should == nil
95
96
  end
96
97
  end
97
- describe "store_keys_in_file_for" do
98
- before(:each) do
99
- @obj = Class.new
100
- @obj.stub!(:access_key).and_return "MYACCESSKEY"
101
- @obj.stub!(:secret_access_key).and_return "MYSECRETACCESSKEY"
102
- Default.stub!(:store_keys_in_file).and_return true
103
-
104
- Default.store_keys_in_file_for(@obj)
105
- end
106
- it "should take the access key from the object" do
107
- Default.access_key.should == "MYACCESSKEY"
108
- end
109
- it "should take the secret_access_key from the object" do
110
- Default.secret_access_key.should == "MYSECRETACCESSKEY"
111
- end
112
- end
98
+ # describe "store_keys_in_file_for" do
99
+ # before(:each) do
100
+ # @obj = Class.new
101
+ # @obj.stub!(:access_key).and_return "MYACCESSKEY"
102
+ # @obj.stub!(:secret_access_key).and_return "MYSECRETACCESSKEY"
103
+ # Default.stub!(:store_keys_in_file).and_return true
104
+ #
105
+ # Default.store_keys_in_file_for(@obj)
106
+ # end
107
+ # it "should take the access key from the object" do
108
+ # Default.access_key.should == "MYACCESSKEY"
109
+ # end
110
+ # it "should take the secret_access_key from the object" do
111
+ # Default.secret_access_key.should == "MYSECRETACCESSKEY"
112
+ # end
113
+ # end
113
114
  end
114
115
  describe "storing keyfile" do
115
116
  before(:each) do
@@ -5,10 +5,15 @@ describe "basic" do
5
5
  before(:each) do
6
6
  PoolParty.reset!
7
7
  @example_spec_file = ::File.join(::File.dirname(__FILE__), "..", "..", "..", "examples", 'basic.rb')
8
+ set_pool_specfile @example_spec_file
8
9
  PoolParty::Pool::Pool.load_from_file(@example_spec_file)
9
10
  @db = clouds[:basic_db]
10
11
  @app = clouds[:basic_app]
11
12
  end
13
+ it "should have a remote base" do
14
+ clouds[:basic_app].remoter_base.should == :ec2
15
+ clouds[:basic_app].remote_base.class.should == Ec2
16
+ end
12
17
  it "should have one pool called :app" do
13
18
  pool(:application).should_not == nil
14
19
  pools[:application].should_not == nil
@@ -31,10 +36,6 @@ describe "basic" do
31
36
  clouds[:basic_app].minimum_instances.should == 12
32
37
  pools[:application].minimum_instances.should ==3
33
38
  end
34
- it "should set ambiguous methods on the cloud" do
35
- clouds[:basic_app].junk_yard_dogs.should == "pains"
36
- clouds[:basic_db].junk_yard_dogs.should == "are bad"
37
- end
38
39
  it "should set the parent to the pool" do
39
40
  clouds[:basic_app].parent.should == pools[:application]
40
41
  clouds[:basic_db].parent.should == pools[:application]
@@ -44,7 +45,7 @@ describe "basic" do
44
45
  clouds[:basic_db]._keypairs.select{|a| a.filepath.match(/auser/)}
45
46
  end
46
47
  it "cloud should know what remoter base it is using" do
47
- clouds[:basic_db].remote_base.class.should == PoolParty::Remote::Ec2
48
+ clouds[:basic_db].remote_base.class.should == PoolParty::Remote::Vmrun
48
49
  end
49
50
  it "cloud should have methods from the remoter base available" do
50
51
  clouds[:basic_db].remote_base.should_receive(:describe_instances).and_return({})
@@ -2,10 +2,10 @@ require File.dirname(__FILE__) + '/../spec_helper'
2
2
  require File.dirname(__FILE__) + '/test_plugins/webserver'
3
3
 
4
4
  describe "Plugin" do
5
- before(:each) do
5
+ before(:each) do
6
+ reset!
6
7
  @c = cloud :test_plugin_model_cloud do
7
8
  apachetest do
8
- enable_php
9
9
  site("heady", {
10
10
  :document_root => "/root"
11
11
  })
@@ -19,6 +19,7 @@ describe "Plugin" do
19
19
  before(:each) do
20
20
  @plugin = @c.apachetest
21
21
  end
22
+
22
23
  describe "storage" do
23
24
  it "should be able to retrieve the plugin as a name" do
24
25
  @c.plugin("apachetest").should_not be_nil
@@ -33,15 +34,17 @@ describe "Plugin" do
33
34
  it "should have the plugin name as a method on the cloud " do
34
35
  @c.respond_to?(:apachetest).should == true
35
36
  end
37
+
36
38
  describe "methods" do
37
39
  it "should call the enable_php method when in the defininition of the cloud" do
38
40
  @plugin.respond_to?(:enable_php).should == true
39
41
  end
40
42
  it "should call php = true in the enable_php" do
41
- @plugin.php?.should == false
43
+ @plugin.php.should == false
42
44
  @plugin.enable_php
43
45
  @plugin.php.should == true
44
46
  end
47
+
45
48
  it "should call the site method when in the defininition of the cloud" do
46
49
  @plugin.respond_to?(:site).should == true
47
50
  end
@@ -51,4 +54,4 @@ describe "Plugin" do
51
54
  end
52
55
  end
53
56
  end
54
- end
57
+ end
@@ -46,15 +46,11 @@ describe "Pool" do
46
46
  before(:each) do
47
47
  reset!
48
48
  @pool = Pool.new :test do
49
- nick_nack "nails"
50
- rocky_shores "ranger"
49
+ expand_when "nails"
51
50
  end
52
51
  end
53
52
  it "should set the plugin_directory to nails" do
54
- @pool.nick_nack.should == "nails"
55
- end
56
- it "should set the rocky_shores to ranger" do
57
- @pool.rocky_shores.should == "ranger"
53
+ @pool.expand_when.should == "nails"
58
54
  end
59
55
  describe "range for min/max instances" do
60
56
  it "should be able to respond to instances" do
@@ -92,9 +88,6 @@ describe "Pool" do
92
88
  it "should have 2 clouds in the pool when there are 2 described" do
93
89
  @pool.clouds.size.should == 2
94
90
  end
95
- it "should be able to tel the other clouds from within one cloud" do
96
- cloud(:app).other_clouds.should == [cloud(:db)]
97
- end
98
91
  end
99
92
  end
100
93
  end
@@ -9,9 +9,7 @@ class MyResource < PoolParty::Resources::Resource
9
9
  default_options(:a => 1,:b => 2,:c => 3)
10
10
  end
11
11
  describe "Resource" do
12
- before(:each) do
13
- setup
14
- end
12
+
15
13
  describe "wrapped" do
16
14
  before(:each) do
17
15
  @resource = MyResource.new({:a => 10}) do
@@ -39,41 +37,29 @@ describe "Resource" do
39
37
  before(:each) do
40
38
  @resource = MyResource.new
41
39
  end
42
- %w(requires ensures is_present is_absent ifnot).each do |method|
40
+ %w(ensures is_present is_absent).each do |method|
43
41
  eval <<-EOE
44
42
  it "should have the method #{method} available" do; @resource.respond_to?(:#{method}).should == true; end
45
43
  EOE
46
44
  end
47
- it "should be able to take requires method" do
48
- @resource.respond_to?(:requires).should == true
49
- end
50
- it "should push require onto the options" do
51
- @resource.options.has_key?(:require).should == false
52
- @resource.requires("nibbles")
53
- @resource.options.has_key?(:require).should == true
54
- end
45
+
55
46
  it "should be able to call ensures method on the resource" do
56
47
  @resource.respond_to?(:ensures).should == true
57
48
  end
58
49
  it "should push the option ensure onto the options" do
59
- @resource.options.has_key?(:ensures).should == false
50
+ @resource.dsl_options.has_key?(:ensures).should == false
60
51
  @resource.ensures :absent
61
- @resource.options.has_key?(:ensures).should == true
52
+ @resource.dsl_options.has_key?(:ensures).should == true
62
53
  end
63
54
  it "should write the option ensures as present with is_present" do
64
- @resource.options.has_key?(:ensures).should == false
55
+ @resource.dsl_options.has_key?(:ensures).should == false
65
56
  @resource.is_present
66
- @resource.options.has_key?(:ensures).should == true
57
+ @resource.dsl_options.has_key?(:ensures).should == true
67
58
  end
68
59
  it "should write the option ensures as absent with is_absent" do
69
- @resource.options.has_key?(:ensures).should == false
60
+ @resource.dsl_options.has_key?(:ensures).should == false
70
61
  @resource.is_absent
71
- @resource.options.has_key?(:ensures).should == true
72
- end
73
- it "should write the option unless for ifnot" do
74
- @resource.options.has_key?(:unless).should == false
75
- @resource.ifnot "str"
76
- @resource.options[:unless].should == "str"
62
+ @resource.dsl_options.has_key?(:ensures).should == true
77
63
  end
78
64
  end
79
65
  describe "command" do
@@ -200,7 +186,7 @@ describe "Resource" do
200
186
  @file = @tc.resource(:file).first
201
187
  end
202
188
  it "should return the file preiously created" do
203
- @tc.resource(:file).first.options.keys.sort.should == @file.options.keys.sort
189
+ @tc.resource(:file).first.dsl_options.keys.sort.should == @file.dsl_options.keys.sort
204
190
  end
205
191
  end
206
192
  end
@@ -3,10 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  include PoolParty::Resources
4
4
 
5
5
  describe "Script" do
6
- before(:each) do
7
-
8
- setup
9
- end
6
+
10
7
  describe "wrapped" do
11
8
  it "should have inflate as a class method" do
12
9
  Script.respond_to?(:inflate).should == true
@@ -1,7 +1,5 @@
1
1
  class WebServers
2
2
  plugin :apachetest do
3
- attr_accessor :php
4
-
5
3
  def loaded(o={}, &block)
6
4
  @loaded ||= true
7
5
  end
@@ -22,16 +22,16 @@ describe "File" do
22
22
  describe "template" do
23
23
  before(:each) do
24
24
  ::File.stub!(:basename).and_return "template"
25
- @file = "<%= friends %> <%= runner %>"
25
+ @file = "<%= friends %> <%= mode %>"
26
26
  @file.stub!(:read).and_return @file
27
27
  Template.stub!(:open).and_return @file
28
28
 
29
29
  @tc = TestBaseClass.new do
30
30
  has_file({:name => "/etc/apache2/puppetmaster.conf", :owner => "herman"}) do
31
31
  template "/absolute/path/to/template"
32
- runner "is super fast"
33
- friends "bob"
34
32
  render_as :erb
33
+ variable :mode, "is super fast"
34
+ variable :friends, "bob"
35
35
  end
36
36
  end
37
37
  @file = @tc.resource(:file).first
@@ -43,7 +43,7 @@ describe "File" do
43
43
  @file.content.should == "bob is super fast"
44
44
  end
45
45
  it "should remove the template from the options" do
46
- @file.template?.should == false
46
+ @file.template.nil?.should == true
47
47
  end
48
48
  end
49
49
  describe "into PuppetResolver" do
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe "Service" do
4
4
  describe "instances" do
5
5
  before(:each) do
6
- @tc = TestBaseClass.new :test_base_class_cloud do
6
+ @tc = TestBaseClass.new do
7
7
  has_service("apache2", {:hasrestart => true})
8
8
  end
9
9
  @service = @tc.resource(:service).first
@@ -1,17 +1,5 @@
1
- $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
- require 'poolparty'
3
-
4
- # TODO: FIX THE STUBS
5
- # %w(context matchy).each do |library|
6
- %w(spec).each do |library|
7
- begin
8
- require library
9
- rescue
10
- STDERR.puts "== Cannot run test without #{library}"
11
- end
12
- end
13
-
14
- # Dir["#{File.dirname(__FILE__)}/helpers/**"].each {|a| require a}
1
+ require 'spec'
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../lib/poolparty')
15
3
 
16
4
  ENV["POOL_SPEC"] = nil
17
5
  ENV["AWS_ACCESS_KEY"] = 'fake_access_key'
@@ -29,14 +17,8 @@ include Remote
29
17
  require File.dirname(__FILE__)+'/net/remoter_bases/ec2_mocks_and_stubs.rb'
30
18
 
31
19
  # Append this directory - which contains a mock key named id_rsa - to the list of searchable locations
32
- class Key
33
- class << self
34
- alias :keypair_paths_without_spec_dir :keypair_paths unless method_defined?(:keypair_paths_without_spec_dir)
35
- def keypair_paths
36
- [keypair_paths_without_spec_dir, File.dirname(__FILE__)].flatten
37
- end
38
- end
39
-
20
+ class PoolParty::Key
21
+ has_searchable_paths(:dirs => ["/", "keys"], :prepend_paths => [File.dirname(__FILE__), "#{ENV["HOME"]}/.ssh"])
40
22
  end
41
23
 
42
24
  class TestRemoterClass < ::PoolParty::Remote::Ec2
@@ -47,7 +29,7 @@ class TestRemoterClass < ::PoolParty::Remote::Ec2
47
29
  def size; "small";end
48
30
  def security_group; "default";end
49
31
  def ebs_volume_id; "ebs_volume_id";end
50
- def availabilty_zone; "us-east-1a";end
32
+ def availability_zone; "us-east-1a";end
51
33
  def verbose; false; end
52
34
  def debugging; false; end
53
35
  def ec2
@@ -73,9 +55,9 @@ class TestCloud < TestClass
73
55
  end
74
56
 
75
57
  class TestBaseClass < PoolParty::PoolPartyBaseClass
76
- end
77
-
78
- def setup
58
+ def name
59
+ "box"
60
+ end
79
61
  end
80
62
 
81
63
  def new_test_cloud(force_new=false)
@@ -87,10 +69,6 @@ def new_test_cloud(force_new=false)
87
69
  @test_cloud
88
70
  end
89
71
 
90
- def setup_cl
91
- require 'poolpartycl'
92
- end
93
-
94
72
  def stub_option_load
95
73
  @str=<<-EOS
96
74
  :access_key:
@@ -105,12 +83,6 @@ def stub_option_load
105
83
  Base.reset!
106
84
  end
107
85
 
108
- def wait_launch(time=5)
109
- pid = fork {yield}
110
- wait time
111
- Process.kill("INT", pid)
112
- Process.wait(pid, 0)
113
- end
114
86
  def reset_all!
115
87
  $cloud = nil
116
88
  end
@@ -204,7 +176,6 @@ def running_remote_instances
204
176
  end
205
177
 
206
178
  def reset_response!
207
- setup
208
179
  @ris = nil
209
180
  end
210
181
 
@@ -259,4 +230,4 @@ class Array
259
230
  }.join(' ')
260
231
  str<<"</ul>"
261
232
  end
262
- end
233
+ end
data/tasks/spec.rake CHANGED
@@ -3,9 +3,13 @@ require 'spec/rake/spectask'
3
3
  require 'rake/testtask'
4
4
  require 'rake/rdoctask'
5
5
 
6
- task :default => [:spec, :test]
6
+ task :default => [:spec, :test, :cleanup_test]
7
7
  desc "Update vendor directory and run tests"
8
- task :ci => ["poolparty:vendor:update", :spec, :test]
8
+ task :ci => ["poolparty:vendor:setup", "poolparty:vendor:update", :spec, :test]
9
+
10
+ task :cleanup_test do
11
+ ::FileUtils.rm_rf "/tmp/poolparty"
12
+ end
9
13
 
10
14
  Spec::Rake::SpecTask.new(:spec) do |t|
11
15
  t.warning = t.rcov = false
@@ -0,0 +1 @@
1
+ TEST KEY
@@ -0,0 +1,29 @@
1
+ require "#{::File.dirname(__FILE__)}/../../test_helper"
2
+
3
+ class RunOnceClass
4
+ attr_reader :apples, :count
5
+ def initialize
6
+ @count = 1
7
+ end
8
+ def run_me
9
+ do_once do
10
+ @count += 1
11
+ @apples = "to apples"
12
+ end
13
+ end
14
+ end
15
+
16
+ class RunOnceTest < Test::Unit::TestCase
17
+ def setup
18
+ @ro = RunOnceClass.new
19
+ end
20
+ def test_apples_should_be_nil
21
+ assert_nil @ro.apples
22
+ assert_equal @ro.count, 1
23
+ end
24
+ def test_apples_should_not_be_nil_when_run
25
+ @ro.run_me
26
+ assert_equal @ro.apples, "to apples"
27
+ assert_equal @ro.count, 2
28
+ end
29
+ end
@@ -57,7 +57,7 @@ class TestPuppetResolver < Test::Unit::TestCase
57
57
  has_directory :name => "/var/www"
58
58
  has_file :name => "/var/www/index.html", :content => "profile info", :requires => get_directory("/var/www")
59
59
 
60
- dependency_resolver "puppet"
60
+ set_dependency_resolver "puppet"
61
61
  # has_package :name => "bash"
62
62
  # parent == cloud
63
63
  apache do
@@ -22,12 +22,12 @@ class TestCloudDsl < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  should "be able to check if they are enabled" do
25
- @cloud.enable :hyper_drive
26
- @cloud.enabled?(:hyper_drive).should == true
25
+ @cloud.enable :hyper_slam
26
+ @cloud.enabled?(:hyper_slam).should == true
27
27
  end
28
28
  should "be able to check that they are disabled" do
29
- @cloud.disable :hyper_drive
30
- @cloud.enabled?(:hyper_drive).should == false
29
+ @cloud.disable :hyper_slam
30
+ @cloud.enabled?(:hyper_slam).should == false
31
31
  end
32
32
  end
33
33
  context "calling add_optional_enabled_services" do