poolparty 0.2.18 → 0.2.69

Sign up to get free protection for your applications and to get access to all the features.
Files changed (335) hide show
  1. data/Manifest.txt +142 -47
  2. data/PostInstall.txt +5 -5
  3. data/README.txt +25 -4
  4. data/Rakefile +46 -2
  5. data/bin/cloud +12 -21
  6. data/bin/cloud-add-keypair +18 -13
  7. data/bin/cloud-configure +11 -18
  8. data/bin/cloud-contract +7 -17
  9. data/bin/cloud-ensure-provisioning +39 -0
  10. data/bin/cloud-expand +9 -17
  11. data/bin/cloud-handle-load +27 -0
  12. data/bin/cloud-list +3 -9
  13. data/bin/cloud-maintain +12 -18
  14. data/bin/cloud-osxcopy +3 -9
  15. data/bin/cloud-provision +20 -21
  16. data/bin/cloud-refresh +4 -13
  17. data/bin/cloud-run +3 -4
  18. data/bin/cloud-ssh +3 -2
  19. data/bin/cloud-start +18 -21
  20. data/bin/cloud-stats +17 -0
  21. data/bin/cloud-terminate +4 -7
  22. data/bin/messenger-get-current-nodes +14 -0
  23. data/bin/pool +12 -12
  24. data/bin/pool-describe +0 -1
  25. data/bin/{pool-spec → pool-generate} +1 -0
  26. data/bin/pool-init +28 -0
  27. data/bin/pool-list +14 -12
  28. data/bin/pool-start +11 -17
  29. data/bin/server-build-messenger +13 -6
  30. data/bin/server-fire-cmd +1 -1
  31. data/bin/server-get-load +5 -16
  32. data/bin/server-list-active +3 -10
  33. data/bin/server-rerun +4 -4
  34. data/bin/server-send-command +18 -0
  35. data/bin/server-show-stats +17 -0
  36. data/bin/server-start-client +29 -0
  37. data/bin/server-start-master +13 -14
  38. data/bin/server-start-node +14 -15
  39. data/bin/server-stop-client +3 -0
  40. data/bin/server-stop-master +3 -0
  41. data/bin/server-stop-node +3 -0
  42. data/bin/server-update-hosts +48 -0
  43. data/config/hoe.rb +4 -3
  44. data/examples/plugin_without_plugin_directory.rb +1 -2
  45. data/generators/poolspec/USAGE +2 -2
  46. data/generators/poolspec/poolspec_generator.rb +2 -1
  47. data/generators/poolspec/templates/pool_spec_template.erb +3 -2
  48. data/lib/erlang/messenger/Rakefile +12 -0
  49. data/lib/erlang/messenger/ebin/client.app +19 -0
  50. data/lib/erlang/messenger/ebin/master.app +1 -1
  51. data/lib/erlang/messenger/ebin/node.app +1 -1
  52. data/lib/erlang/messenger/ebin/pm_client_rel-0.1.rel +1 -0
  53. data/lib/erlang/messenger/ebin/pm_master_rel-0.1.rel +1 -1
  54. data/lib/erlang/messenger/ebin/pm_node_rel-0.1.rel +1 -1
  55. data/lib/erlang/messenger/include/defines.hrl +27 -0
  56. data/lib/erlang/messenger/lib/eunit/.svn/all-wcprops +53 -0
  57. data/lib/erlang/messenger/lib/eunit/.svn/entries +140 -0
  58. data/lib/erlang/messenger/lib/eunit/.svn/format +1 -0
  59. data/lib/erlang/messenger/lib/eunit/.svn/prop-base/NOTES.svn-base +5 -0
  60. data/lib/erlang/messenger/lib/eunit/.svn/text-base/AUTHORS.svn-base +2 -0
  61. data/lib/erlang/messenger/lib/eunit/.svn/text-base/CHANGELOG.svn-base +14 -0
  62. data/lib/erlang/messenger/lib/eunit/.svn/text-base/COPYING.svn-base +504 -0
  63. data/lib/erlang/messenger/lib/eunit/.svn/text-base/NOTES.svn-base +276 -0
  64. data/lib/erlang/messenger/lib/eunit/.svn/text-base/README.svn-base +3 -0
  65. data/lib/erlang/messenger/lib/eunit/.svn/text-base/sys.config.svn-base +9 -0
  66. data/lib/erlang/messenger/lib/eunit/.svn/text-base/vsn.mk.svn-base +1 -0
  67. data/lib/erlang/messenger/lib/eunit/doc/.svn/all-wcprops +59 -0
  68. data/lib/erlang/messenger/lib/eunit/doc/.svn/entries +142 -0
  69. data/lib/erlang/messenger/lib/eunit/doc/.svn/format +1 -0
  70. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/erlang.png.svn-base +5 -0
  71. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/eunit.html.svn-base +5 -0
  72. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/index.html.svn-base +5 -0
  73. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/modules-frame.html.svn-base +5 -0
  74. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/overview-summary.html.svn-base +5 -0
  75. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/packages-frame.html.svn-base +5 -0
  76. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/edoc-info.svn-base +3 -0
  77. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/erlang.png.svn-base +0 -0
  78. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/eunit.html.svn-base +172 -0
  79. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/index.html.svn-base +17 -0
  80. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/modules-frame.html.svn-base +12 -0
  81. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview-summary.html.svn-base +984 -0
  82. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview.edoc.svn-base +980 -0
  83. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/packages-frame.html.svn-base +11 -0
  84. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/stylesheet.css.svn-base +55 -0
  85. data/lib/erlang/messenger/lib/eunit/ebin/.svn/all-wcprops +5 -0
  86. data/lib/erlang/messenger/lib/eunit/ebin/.svn/dir-prop-base +8 -0
  87. data/lib/erlang/messenger/lib/eunit/ebin/.svn/entries +28 -0
  88. data/lib/erlang/messenger/lib/eunit/ebin/.svn/format +1 -0
  89. data/lib/erlang/messenger/lib/eunit/examples/.svn/all-wcprops +23 -0
  90. data/lib/erlang/messenger/lib/eunit/examples/.svn/entries +66 -0
  91. data/lib/erlang/messenger/lib/eunit/examples/.svn/format +1 -0
  92. data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/eunit_examples.erl.svn-base +5 -0
  93. data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/fib.erl.svn-base +5 -0
  94. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/eunit_examples.erl.svn-base +339 -0
  95. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/fib.erl.svn-base +19 -0
  96. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/tests.txt.svn-base +1 -0
  97. data/lib/erlang/messenger/lib/eunit/include/.svn/all-wcprops +11 -0
  98. data/lib/erlang/messenger/lib/eunit/include/.svn/entries +41 -0
  99. data/lib/erlang/messenger/lib/eunit/include/.svn/format +1 -0
  100. data/lib/erlang/messenger/lib/eunit/include/.svn/prop-base/eunit.hrl.svn-base +5 -0
  101. data/lib/erlang/messenger/lib/eunit/include/.svn/text-base/eunit.hrl.svn-base +313 -0
  102. data/lib/erlang/messenger/lib/eunit/src/.svn/all-wcprops +113 -0
  103. data/lib/erlang/messenger/lib/eunit/src/.svn/entries +259 -0
  104. data/lib/erlang/messenger/lib/eunit/src/.svn/format +1 -0
  105. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/autoload.erl.svn-base +5 -0
  106. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/code_monitor.erl.svn-base +5 -0
  107. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit.erl.svn-base +5 -0
  108. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_autoexport.erl.svn-base +5 -0
  109. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_data.erl.svn-base +5 -0
  110. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_internal.hrl.svn-base +5 -0
  111. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_lib.erl.svn-base +5 -0
  112. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_proc.erl.svn-base +5 -0
  113. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_serial.erl.svn-base +5 -0
  114. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_server.erl.svn-base +5 -0
  115. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_striptests.erl.svn-base +5 -0
  116. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_test.erl.svn-base +5 -0
  117. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tests.erl.svn-base +5 -0
  118. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tty.erl.svn-base +5 -0
  119. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/file_monitor.erl.svn-base +5 -0
  120. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/autoload.erl.svn-base +388 -0
  121. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/code_monitor.erl.svn-base +243 -0
  122. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.app.src.svn-base +21 -0
  123. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.appup.src.svn-base +1 -0
  124. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.erl.svn-base +196 -0
  125. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_autoexport.erl.svn-base +102 -0
  126. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_data.erl.svn-base +798 -0
  127. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_internal.hrl.svn-base +48 -0
  128. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_lib.erl.svn-base +682 -0
  129. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_proc.erl.svn-base +552 -0
  130. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_serial.erl.svn-base +157 -0
  131. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_server.erl.svn-base +340 -0
  132. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_striptests.erl.svn-base +64 -0
  133. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_test.erl.svn-base +334 -0
  134. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tests.erl.svn-base +45 -0
  135. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tty.erl.svn-base +272 -0
  136. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/file_monitor.erl.svn-base +409 -0
  137. data/lib/erlang/messenger/pm_client_rel-0.1.boot +0 -0
  138. data/lib/erlang/messenger/pm_client_rel-0.1.script +238 -0
  139. data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
  140. data/lib/erlang/messenger/pm_master_rel-0.1.script +82 -85
  141. data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
  142. data/lib/erlang/messenger/pm_node_rel-0.1.script +80 -85
  143. data/lib/erlang/messenger/src/client_app.erl +39 -0
  144. data/lib/erlang/messenger/src/client_server.erl +60 -0
  145. data/lib/erlang/messenger/src/pm_client.erl +48 -18
  146. data/lib/erlang/messenger/src/pm_client_old.erl +52 -0
  147. data/lib/erlang/messenger/src/pm_client_supervisor.erl +38 -0
  148. data/lib/erlang/messenger/src/pm_cluster.erl +20 -16
  149. data/lib/erlang/messenger/src/pm_event_manager.erl +27 -0
  150. data/lib/erlang/messenger/src/pm_master.erl +126 -34
  151. data/lib/erlang/messenger/src/pm_master_event_handler.erl +72 -0
  152. data/lib/erlang/messenger/src/pm_master_supervisor.erl +9 -10
  153. data/lib/erlang/messenger/src/pm_node.erl +107 -30
  154. data/lib/erlang/messenger/src/pm_node_supervisor.erl +13 -15
  155. data/lib/erlang/messenger/src/pm_packager.erl +5 -2
  156. data/lib/erlang/messenger/src/pm_strings.erl +11 -0
  157. data/lib/erlang/messenger/src/utils.erl +43 -8
  158. data/lib/erlang/messenger/useful_snippets +17 -0
  159. data/lib/poolparty/aska/aska.rb +150 -0
  160. data/lib/poolparty/base_packages/haproxy.rb +19 -26
  161. data/lib/poolparty/base_packages/heartbeat.rb +48 -47
  162. data/lib/poolparty/base_packages/poolparty.rb +88 -36
  163. data/lib/poolparty/base_packages/runit.rb +21 -0
  164. data/lib/poolparty/config/postlaunchmessage.txt +5 -0
  165. data/lib/poolparty/core/array.rb +4 -1
  166. data/lib/poolparty/core/class.rb +2 -0
  167. data/lib/poolparty/core/exception.rb +2 -1
  168. data/lib/poolparty/core/hash.rb +2 -2
  169. data/lib/poolparty/core/kernel.rb +3 -3
  170. data/lib/poolparty/core/metaid.rb +15 -0
  171. data/lib/poolparty/core/object.rb +42 -2
  172. data/lib/poolparty/core/string.rb +21 -6
  173. data/lib/poolparty/core/symbol.rb +9 -0
  174. data/lib/poolparty/dependency_resolutions/puppet.rb +20 -7
  175. data/lib/poolparty/exceptions/CloudNotFoundException.rb +7 -0
  176. data/lib/poolparty/exceptions/LoadRulesException.rb +7 -0
  177. data/lib/poolparty/exceptions/MasterException.rb +10 -0
  178. data/lib/poolparty/helpers/binary.rb +37 -4
  179. data/lib/poolparty/helpers/console.rb +25 -8
  180. data/lib/poolparty/helpers/nice_printer.rb +36 -0
  181. data/lib/poolparty/helpers/optioner.rb +51 -16
  182. data/lib/poolparty/helpers/provisioner_base.rb +117 -28
  183. data/lib/poolparty/helpers/provisioners/master.rb +102 -35
  184. data/lib/poolparty/helpers/provisioners/slave.rb +25 -9
  185. data/lib/poolparty/modules/cloud_dsl.rb +13 -0
  186. data/lib/poolparty/modules/cloud_resourcer.rb +51 -8
  187. data/lib/poolparty/modules/configurable.rb +1 -1
  188. data/lib/poolparty/modules/definable_resource.rb +2 -2
  189. data/lib/poolparty/modules/file_writer.rb +37 -6
  190. data/lib/poolparty/modules/method_missing_sugar.rb +8 -3
  191. data/lib/poolparty/modules/pretty_printer.rb +1 -0
  192. data/lib/poolparty/modules/resourcing_dsl.rb +4 -2
  193. data/lib/poolparty/modules/thread_pool.rb +106 -0
  194. data/lib/poolparty/monitors/base_monitor.rb +65 -6
  195. data/lib/poolparty/monitors/monitors/cpu_monitor.rb +1 -1
  196. data/lib/poolparty/monitors/monitors/memory_monitor.rb +28 -1
  197. data/lib/poolparty/monitors/monitors/web_monitor.rb +18 -0
  198. data/lib/poolparty/net/messenger.rb +72 -0
  199. data/lib/poolparty/net/remote.rb +5 -2
  200. data/lib/poolparty/net/remote_bases/ec2/ec2_response_object.rb +66 -0
  201. data/lib/poolparty/net/remote_bases/ec2.rb +133 -131
  202. data/lib/poolparty/net/remote_instance.rb +28 -6
  203. data/lib/poolparty/net/remoter.rb +117 -64
  204. data/lib/poolparty/net/remoter_base.rb +49 -11
  205. data/lib/poolparty/plugins/deploydirectory.rb +66 -0
  206. data/lib/poolparty/plugins/line.rb +5 -4
  207. data/lib/poolparty/plugins/rsyncmirror.rb +26 -0
  208. data/lib/poolparty/plugins/runit.rb +96 -0
  209. data/lib/poolparty/plugins/svn.rb +1 -1
  210. data/lib/poolparty/pool/base.rb +47 -18
  211. data/lib/poolparty/pool/cloud.rb +121 -65
  212. data/lib/poolparty/pool/custom_resource.rb +4 -20
  213. data/lib/poolparty/pool/loggable.rb +3 -8
  214. data/lib/poolparty/pool/plugin.rb +14 -19
  215. data/lib/poolparty/pool/plugin_model.rb +8 -8
  216. data/lib/poolparty/pool/pool.rb +28 -11
  217. data/lib/poolparty/pool/resource.rb +109 -40
  218. data/lib/poolparty/pool/resources/class_package.rb +74 -33
  219. data/lib/poolparty/pool/resources/conditional.rb +32 -10
  220. data/lib/poolparty/pool/resources/custom_service.rb +30 -0
  221. data/lib/poolparty/pool/resources/exec.rb +6 -5
  222. data/lib/poolparty/pool/resources/gem_package.rb +52 -0
  223. data/lib/poolparty/pool/resources/mount.rb +22 -0
  224. data/lib/poolparty/pool/resources/package.rb +13 -3
  225. data/lib/poolparty/pool/resources/sshkey.rb +1 -1
  226. data/lib/poolparty/pool/resources/variable.rb +4 -0
  227. data/lib/poolparty/pool/script.rb +8 -6
  228. data/lib/poolparty/templates/haproxy.conf +1 -1
  229. data/lib/poolparty/templates/messenger/client/log-run.erb +2 -0
  230. data/lib/poolparty/templates/messenger/client/run.erb +4 -0
  231. data/lib/poolparty/templates/messenger/master/log-run.erb +2 -0
  232. data/lib/poolparty/templates/messenger/master/run.erb +4 -0
  233. data/lib/poolparty/templates/messenger/node/log-run.erb +2 -0
  234. data/lib/poolparty/templates/messenger/node/run.erb +4 -0
  235. data/lib/poolparty/templates/poolparty.monitor +1 -1
  236. data/lib/poolparty/templates/puppet.conf +0 -0
  237. data/lib/poolparty/templates/puppetcleaner +6 -0
  238. data/lib/poolparty/templates/puppetrerun +9 -0
  239. data/lib/poolparty/templates/puppetrunner +8 -0
  240. data/lib/poolparty/templates/yaws.conf +19 -0
  241. data/lib/poolparty/version.rb +1 -1
  242. data/lib/poolparty.rb +35 -6
  243. data/lib/poolpartycl.rb +4 -0
  244. data/log/pool.logs +0 -0
  245. data/poolparty.gemspec +574 -61
  246. data/spec/poolparty/aska/aska_spec.rb +122 -0
  247. data/spec/poolparty/bin/console_spec.rb +18 -0
  248. data/spec/poolparty/core/hash_spec.rb +4 -4
  249. data/spec/poolparty/core/object_spec.rb +29 -0
  250. data/spec/poolparty/core/string_spec.rb +6 -0
  251. data/spec/poolparty/core/time_spec.rb +0 -3
  252. data/spec/poolparty/helpers/binary_spec.rb +2 -2
  253. data/spec/poolparty/helpers/optioner_spec.rb +1 -4
  254. data/spec/poolparty/helpers/provisioner_base_spec.rb +14 -1
  255. data/spec/poolparty/helpers/provisioners/master_spec.rb +3 -3
  256. data/spec/poolparty/modules/cloud_resourcer_spec.rb +3 -3
  257. data/spec/poolparty/modules/configurable_spec.rb +4 -1
  258. data/spec/poolparty/monitors/base_monitor_spec.rb +94 -2
  259. data/spec/poolparty/monitors/monitors/cpu_monitor_spec.rb +0 -1
  260. data/spec/poolparty/monitors/monitors/memory_monitor_spec.rb +47 -0
  261. data/spec/poolparty/{helpers → net}/messenger_spec.rb +3 -1
  262. data/spec/poolparty/net/remote_bases/ec2_spec.rb +46 -5
  263. data/spec/poolparty/net/remote_instance_spec.rb +2 -1
  264. data/spec/poolparty/net/remote_spec.rb +30 -8
  265. data/spec/poolparty/net/remoter_base_spec.rb +4 -1
  266. data/spec/poolparty/net/remoter_spec.rb +11 -108
  267. data/spec/poolparty/plugins/deploydirectory_spec.rb +51 -0
  268. data/spec/poolparty/pool/base_spec.rb +43 -33
  269. data/spec/poolparty/pool/cloud_spec.rb +299 -248
  270. data/spec/poolparty/pool/custom_resource_spec.rb +10 -5
  271. data/spec/poolparty/pool/example_spec.rb +0 -84
  272. data/spec/poolparty/pool/plugin_model_spec.rb +3 -2
  273. data/spec/poolparty/pool/plugin_spec.rb +89 -62
  274. data/spec/poolparty/pool/pool_spec.rb +17 -2
  275. data/spec/poolparty/pool/resource_spec.rb +341 -236
  276. data/spec/poolparty/pool/resources/class_package_spec.rb +102 -66
  277. data/spec/poolparty/pool/resources/conditional_spec.rb +65 -26
  278. data/spec/poolparty/pool/resources/cron_spec.rb +3 -2
  279. data/spec/poolparty/pool/resources/exec_spec.rb +1 -1
  280. data/spec/poolparty/pool/resources/gem_spec.rb +18 -14
  281. data/spec/poolparty/pool/resources/remote_file_spec.rb +1 -1
  282. data/spec/poolparty/pool/resources/variable_spec.rb +1 -1
  283. data/spec/poolparty/pool/script_spec.rb +58 -37
  284. data/spec/poolparty/pool/test_plugins/webserver.rb +1 -0
  285. data/spec/poolparty/spec_helper.rb +16 -5
  286. data/tasks/deployment.rake +19 -3
  287. data/tasks/development.rake +11 -2
  288. data/tasks/ec2.rake +9 -1
  289. data/website/index.html +2 -2
  290. metadata +167 -70
  291. data/bin/pool-provision +0 -34
  292. data/erl_crash.dump +0 -8409
  293. data/examples/with_apache_plugin.rb +0 -22
  294. data/lib/erlang/messenger/Makefile +0 -15
  295. data/lib/erlang/messenger/ebin/master_app.beam +0 -0
  296. data/lib/erlang/messenger/ebin/node_app.beam +0 -0
  297. data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
  298. data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
  299. data/lib/erlang/messenger/ebin/pm_event_handler.beam +0 -0
  300. data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
  301. data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
  302. data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
  303. data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
  304. data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
  305. data/lib/erlang/messenger/ebin/utils.beam +0 -0
  306. data/lib/erlang/messenger/lib/eunit/Makefile +0 -28
  307. data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
  308. data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
  309. data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
  310. data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
  311. data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
  312. data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
  313. data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
  314. data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
  315. data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
  316. data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
  317. data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
  318. data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
  319. data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
  320. data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
  321. data/lib/erlang/messenger/lib/eunit/src/Makefile +0 -46
  322. data/lib/erlang/messenger/src/pm_event_handler.erl +0 -21
  323. data/lib/poolparty/config/allowed_commands.yml +0 -1
  324. data/lib/poolparty/helpers/messenger.rb +0 -29
  325. data/lib/poolparty/plugins/git.rb +0 -39
  326. data/lib/poolparty/pool/resources/gem.rb +0 -28
  327. data/lib/poolparty/pool/tmp/.ppkeys +0 -3
  328. data/lib/poolparty/pool/tmp/happydayz +0 -1
  329. data/lib/poolparty/pool/tmp/install_master.sh +0 -33
  330. data/lib/poolparty/pool/tmp/pool.spec +0 -11
  331. data/lib/poolparty/pool/tmp/poolparty.pp +0 -600
  332. data/lib/poolparty/pool/tmp/tc-instances.list +0 -1
  333. data/lib/poolparty/templates/fileserver.conf +0 -4
  334. data/spec/poolparty/plugins/git_spec.rb +0 -33
  335. data/test_manifest.pp +0 -658
@@ -1,4 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ include PoolParty::Resources
4
+
2
5
  require File.dirname(__FILE__) + '/test_plugins/webserver'
3
6
 
4
7
  class MyResource < PoolParty::Resources::Resource
@@ -9,282 +12,384 @@ class MyResource < PoolParty::Resources::Resource
9
12
  end
10
13
  describe "Resource" do
11
14
  before(:each) do
12
- @resource = MyResource.new({:a => 10}) do
13
- b "90"
14
- end
15
- end
16
- it "should set a from the hash" do
17
- @resource.a.should == 10
18
- end
19
- it "should set b from within the block" do
20
- @resource.b.should == "90"
21
- end
22
- it "should not wipe out the rest of the default options" do
23
- @resource.c.should == 3
24
- end
25
- describe "to_s" do
26
- it "should be able to coalesce the instances" do
27
- @resource.to_string.should =~ /resource \{\n/
28
- end
29
- describe "with resources" do
30
- before(:each) do
31
- self.stub!(:options).and_return(:name => "cook")
32
-
33
- @obj = PoolParty::Resources::Resource.new
34
- @obj.stub!(:name).and_return "cook"
35
-
36
- @resource2 = MyResource.new do
37
- file(:name => "shulie")
38
- end
39
- end
40
- it "should call classpackage_with_self when it has resources" do
41
- @resource2.should_receive(:classpackage_with_self).and_return @obj
42
- @resource2.to_string
43
- end
44
- it "should call to_string on the class package" do
45
- @obj.should_receive(:to_string).and_return "wee"
46
- @resource2.should_receive(:classpackage_with_self).and_return @obj
47
- @resource2.to_string
48
- end
49
- end
50
- end
51
- describe "class methods" do
52
- it "should have an array of available resources" do
53
- PoolParty::Resources::Resource.available_resources.class.should == Array
54
- end
55
- it "should not be empty" do
56
- PoolParty::Resources::Resource.available_resources.should_not be_empty
57
- end
15
+ setup
58
16
  end
59
- describe "instance methods" do
17
+ describe "wrapped" do
60
18
  before(:each) do
61
- @resource = MyResource.new
62
- end
63
- %w(requires ensures is_present is_absent ifnot).each do |method|
64
- eval <<-EOE
65
- it "should have the method #{method} available" do; @resource.respond_to?(:#{method}).should == true; end
66
- EOE
67
- end
68
- it "should be able to take requires method" do
69
- @resource.respond_to?(:requires).should == true
70
- end
71
- it "should push require onto the options" do
72
- @resource.options.has_key?(:require).should == false
73
- @resource.requires("nibbles")
74
- @resource.options.has_key?(:require).should == true
75
- end
76
- it "should be able to call ensures method on the resource" do
77
- @resource.respond_to?(:ensures).should == true
78
- end
79
- it "should push the option ensure onto the options" do
80
- @resource.options.has_key?(:ensure).should == false
81
- @resource.ensures("nibbles")
82
- @resource.options.has_key?(:ensure).should == true
83
- end
84
- it "should write the option ensures as present with is_present" do
85
- @resource.options.has_key?(:ensure).should == false
86
- @resource.is_present
87
- @resource.options[:ensure].should == "present"
88
- end
89
- it "should write the option ensures as absent with is_absent" do
90
- @resource.options.has_key?(:ensure).should == false
91
- @resource.is_absent
92
- @resource.options[:ensure].should == "absent"
93
- end
94
- it "should write the option unless for ifnot" do
95
- @resource.options.has_key?(:unless).should == false
96
- @resource.ifnot "str"
97
- @resource.options[:unless].should == "str"
98
- end
99
- describe "templating" do
100
- before(:each) do
101
- FileUtils.stub!(:cp).and_return true
102
- end
103
- it "should have the method template" do
104
- @resource.respond_to?(:template).should == true
105
- end
106
- it "should raise an exception if no file is given" do
107
- lambda {
108
- @resource.template
109
- }.should raise_error
110
- end
111
- it "should raise an excepton if the file cannot be found" do
112
- lambda {
113
- @resource.template("radar")
114
- }.should raise_error
19
+ @resource = MyResource.new({:a => 10}) do
20
+ b "90"
115
21
  end
116
- it "should not raise an exception if there is a file passed and the file is found" do
117
- File.should_receive(:file?).with("radar").and_return true
118
- lambda {
119
- @resource.template("radar")
120
- }.should_not raise_error
121
- end
122
- # it "should push the template option on to the options" do
123
- # File.stub!(:file?).with("radar").and_return true
124
- # @resource.options.has_key?(:template).should == false
125
- # @resource.template("radar")
126
- # @resource.options.has_key?(:template).should == true
127
- # end
128
- end
129
- end
130
- describe "command" do
131
- include PoolParty::Resources
132
- before(:each) do
133
- reset_resources!
134
- @cloud = cloud :command_cloud do; end
135
22
  end
136
- it "should call add_resource when creating using the command: file" do
137
- @cloud.should_receive(:add_resource).with(:file, {:name => "frank"}, @cloud)
138
- @cloud.instance_eval do
139
- file(:name => "frank")
140
- end
23
+ it "should set a from the hash" do
24
+ @resource.a.should == 10
141
25
  end
142
- it "should create the new 'resource' as a resource" do
143
- resource(:file).class.should == Array
26
+ it "should set b from within the block" do
27
+ @resource.b.should == "90"
144
28
  end
145
- it "should receive << when adding a new one" do
146
- resource(:file).should_receive(:<<).once
147
- file({:name => "pop"})
29
+ it "should not wipe out the rest of the default options" do
30
+ @resource.c.should == 3
148
31
  end
149
- it "should contain 3 instances after calling resource 3 times" do
150
- file({:name => "red"})
151
- file({:name => "hot"})
152
- file({:name => "summer"})
153
- resource(:file).size.should == 3
32
+ describe "to_s" do
33
+ it "should be able to coalesce the instances" do
34
+ @resource.to_string.should =~ /resource \{/
35
+ end
154
36
  end
155
- describe "adding" do
156
- before(:each) do
157
- @a = file({:name => "red"})
158
- @b = file({:name => "hot"})
159
- @c = file({:name => "summer"})
37
+ describe "class methods" do
38
+ it "should have an array of available resources" do
39
+ PoolParty::Resources::Resource.available_resources.class.should == Array
160
40
  end
161
- it "should contain file named with 'red'" do
162
- resource(:file).include?(@a).should == true
41
+ it "should not be empty" do
42
+ PoolParty::Resources::Resource.available_resources.should_not be_empty
163
43
  end
164
44
  end
165
- describe "method_missing" do
45
+ describe "instance methods" do
166
46
  before(:each) do
167
- file({:name => "red"})
168
- file({:name => "hot"})
169
- file({:name => "summer"})
47
+ @resource = MyResource.new
170
48
  end
171
- it "should be able to pick out methods with the phrase has_" do
172
- lambda {
173
- has_file
174
- }.should_not raise_error
49
+ %w(requires ensures is_present is_absent ifnot).each do |method|
50
+ eval <<-EOE
51
+ it "should have the method #{method} available" do; @resource.respond_to?(:#{method}).should == true; end
52
+ EOE
175
53
  end
176
- it "should not have a method prepended with crabs_" do
177
- lambda {
178
- crabs_file
179
- }.should raise_error
54
+ it "should be able to take requires method" do
55
+ @resource.respond_to?(:requires).should == true
180
56
  end
181
- it "should pick out methods with the phrase does_not_" do
182
- lambda {
183
- does_not_have_file({:name => "red"})
184
- }.should_not raise_error
57
+ it "should push require onto the options" do
58
+ @resource.options.has_key?(:require).should == false
59
+ @resource.requires("nibbles")
60
+ @resource.options.has_key?(:require).should == true
185
61
  end
186
- it "should set the has_file to present ensure" do
187
- has_file({:name => "redface"})
188
- resource(:file).get_named("redface").first.options[:ensure].should == "present"
62
+ it "should be able to call ensures method on the resource" do
63
+ @resource.respond_to?(:ensures).should == true
189
64
  end
190
- it "should set the does_not_have_file to absent ensure" do
191
- does_not_have_file({:name => "net"})
192
- resource(:file).get_named("net").first.options[:ensure].should == "absent"
65
+ it "should push the option ensure onto the options" do
66
+ @resource.options.has_key?(:ensure).should == false
67
+ @resource.ensures("nibbles")
68
+ @resource.options.has_key?(:ensure).should == true
193
69
  end
194
- it "should be able to have_service as well" do
195
- has_service({:name => "apache"})
196
- resource(:service).get_named("apache").first.options[:ensure].should == "running"
197
- end
198
- end
199
- describe "get_resource" do
200
- before(:each) do
201
- @red = file(:name => "red")
202
- @hot = file(:name => "hot")
203
- @tamales = file(:name => "tamales")
70
+ it "should write the option ensures as present with is_present" do
71
+ @resource.options.has_key?(:ensure).should == false
72
+ @resource.is_present
73
+ @resource.options[:ensure].should == "present"
204
74
  end
205
- it "should return a type of resource when looking for a resource that exists" do
206
- get_resource(:file, "hot").class.should == PoolParty::Resources::File
75
+ it "should write the option ensures as absent with is_absent" do
76
+ @resource.options.has_key?(:ensure).should == false
77
+ @resource.is_absent
78
+ @resource.options[:ensure].should == "absent"
207
79
  end
208
- it "should return the resource of the name requested" do
209
- get_resource(:file, "hot").should == @hot
80
+ it "should write the option unless for ifnot" do
81
+ @resource.options.has_key?(:unless).should == false
82
+ @resource.ifnot "str"
83
+ @resource.options[:unless].should == "str"
210
84
  end
211
- it "should return nil if the resource requested is not there" do
212
- get_resource(:file, "smarties").should be_nil
213
- end
214
- end
215
- describe "parent" do
216
- before(:each) do
217
- @cloud = cloud :app do
218
- tangerine "orange"
219
- file(:name => "file.txt")
85
+ describe "templating" do
86
+ before(:each) do
87
+ FileUtils.stub!(:cp).and_return true
220
88
  end
221
- @file = @cloud.resources[:file].first
222
- end
223
- it "should take the options of the parent" do
224
- @file.parent.tangerine.should_not == nil
225
- end
226
- it "should set the option as the same from the parent" do
227
- @file.parent.tangerine.should == "orange"
89
+ it "should have the method template" do
90
+ @resource.respond_to?(:template).should == true
91
+ end
92
+ it "should raise an exception if no file is given" do
93
+ lambda {
94
+ @resource.template
95
+ }.should raise_error
96
+ end
97
+ it "should raise an excepton if the file cannot be found" do
98
+ lambda {
99
+ @resource.template("radar")
100
+ }.should raise_error
101
+ end
102
+ it "should not raise an exception if there is a file passed and the file is found" do
103
+ File.should_receive(:file?).with("radar").and_return true
104
+ lambda {
105
+ @resource.template("radar")
106
+ }.should_not raise_error
107
+ end
108
+ # it "should push the template option on to the options" do
109
+ # File.stub!(:file?).with("radar").and_return true
110
+ # @resource.options.has_key?(:template).should == false
111
+ # @resource.template("radar")
112
+ # @resource.options.has_key?(:template).should == true
113
+ # end
228
114
  end
229
115
  end
230
- describe "appending to resource" do
116
+ describe "command" do
117
+ include PoolParty::Resources
231
118
  before(:each) do
232
- @cloud1 = cloud :apples do
233
- directory(:name => "/var/www") do
234
- file(:name => "/var/www/file.html")
235
- end
236
- end
237
- @dir = @cloud1.get_resource(:directory, "/var/www")
238
- @file = @dir.get_resource(:file, "/var/www/file.html")
239
- end
240
- it "should say there is 1 resource because the lower-level resources should be contained on the parenting resource" do
241
- @cloud1.resources.size.should == 1
119
+ @cloud = cloud :command_cloud do; end
242
120
  end
243
- it "should say there is one resource on the outer resource" do
244
- @dir.resources.size.should == 1
121
+ describe "add_resource" do
122
+ it "should call add_resource when creating using the command: file" do
123
+ @cloud.should_receive(:add_resource).with(:file, {:name => "frank"}, @cloud)
124
+ @cloud.instance_eval do
125
+ file(:name => "frank")
126
+ end
127
+ end
128
+ it "should return a resource when the resource does not exist" do
129
+ file(:name => "/etc/frank.txt").class.should == PoolParty::Resources::File
130
+ end
131
+ it "should return a resource when the resource does exist" do
132
+ file(:name => "frank")
133
+ file(:name => "frank").class.should == PoolParty::Resources::File
134
+ end
245
135
  end
246
- it "should contain the file as a resource" do
247
- @dir.resource(:file)[0].to_s.should == @file.to_s
136
+ it "should create the new 'resource' as a resource" do
137
+ resource(:file).class.should == Array
248
138
  end
249
- it "should set the parent as the parenting resource" do
250
- @file.parent.to_s.should == @dir.to_s
139
+ it "should receive << when adding a new one" do
140
+ resource(:file).should_receive(:<<).once
141
+ has_file({:name => "pop"})
251
142
  end
252
- end
253
- describe "fetching" do
254
- before(:each) do
255
- @file = file(:name => "pancakes")
143
+ it "should contain 3 instances after calling resource 3 times" do
144
+ file({:name => "red"})
145
+ file({:name => "hot"})
146
+ file({:name => "summer"})
147
+ resource(:file).size.should == 3
256
148
  end
257
- it "should not create a new resource if the same resource exists" do
258
- PoolParty::Resources::File.should_not_receive(:new)
259
- file(:name => "pancakes")
149
+ describe "adding" do
150
+ before(:each) do
151
+ @a = file({:name => "red"})
152
+ @b = file({:name => "hot"})
153
+ @c = file({:name => "summer"})
154
+ end
155
+ it "should contain file named with 'red'" do
156
+ get_resource(:file, "red").nil?.should == false
157
+ end
260
158
  end
261
- it "should return the file preiously created" do
262
- get_resource(:file, "pancakes").should == @file
159
+ describe "method_missing" do
160
+ before(:each) do
161
+ file({:name => "red"})
162
+ file({:name => "hot"})
163
+ file({:name => "summer"})
164
+ end
165
+ it "should be able to pick out methods with the phrase has_" do
166
+ lambda {
167
+ has_file
168
+ }.should_not raise_error
169
+ end
170
+ it "should not have a method prepended with crabs_" do
171
+ lambda {
172
+ crabs_file
173
+ }.should raise_error
174
+ end
175
+ it "should pick out methods with the phrase does_not_" do
176
+ lambda {
177
+ does_not_have_file({:name => "red"})
178
+ }.should_not raise_error
179
+ end
180
+ it "should set the has_file to present ensure" do
181
+ has_file({:name => "redface"})
182
+ resource(:file).get_named("redface").first.options[:ensure].should == "present"
183
+ end
184
+ it "should set the does_not_have_file to absent ensure" do
185
+ does_not_have_file({:name => "net"})
186
+ resource(:file).get_named("net").first.options[:ensure].should == "absent"
187
+ end
188
+ it "should be able to have_service as well" do
189
+ has_service({:name => "apache"})
190
+ resource(:service).get_named("apache").first.options[:ensure].should == "running"
191
+ end
263
192
  end
264
- it "should be able to use the helper to grab the file" do
265
- PoolParty::Resources::File.should_not_receive(:new)
266
- file(:name => "pancakes").should == @file
193
+ describe "get_resource" do
194
+ before(:each) do
195
+ reset_resources!
196
+ @cloud_get_resource = cloud :get_resource do
197
+ file(:name => "red")
198
+ file(:name => "hot")
199
+ file(:name => "tamales")
200
+ end
201
+ end
202
+ it "should return a type of resource when looking for a resource that exists" do
203
+ @cloud_get_resource.get_resource(:file, "hot").class.should == PoolParty::Resources::File
204
+ end
205
+ it "should return the resource of the name requested" do
206
+ @cloud_get_resource.get_resource(:file, "hot").name.should == "hot"
207
+ end
208
+ it "should return nil if the resource requested is not there" do
209
+ @cloud_get_resource.get_resource(:file, "smarties").should be_nil
210
+ end
211
+ it "should not have created any more resources" do
212
+ @cloud_get_resource.resource(:file).size.should == 3
213
+ end
267
214
  end
268
- it "should turn the resource into a string" do
269
- @file.to_s.should == "File['pancakes']"
215
+ describe "parent" do
216
+ before(:each) do
217
+ @cloud = cloud :orange do
218
+ tangerine "orange"
219
+ file(:name => "file.txt")
220
+ end
221
+ @file = @cloud.resources[:file].first
222
+ end
223
+ it "should take the options of the parent" do
224
+ @file.parent.tangerine.should_not == nil
225
+ end
226
+ it "should set the option as the same from the parent" do
227
+ @file.parent.tangerine.should == "orange"
228
+ end
270
229
  end
271
- describe "cancelled" do
272
- it "should make a resource not cancelled by default" do
273
- @file.cancelled?.should == false
230
+ describe "appending to resource" do
231
+ before(:each) do
232
+ @cloud1 = cloud :apples do
233
+ directory(:name => "/var/www") do
234
+ file(:name => "/var/www/file.html")
235
+ end
236
+ end
237
+ @dir = @cloud1.get_resource(:directory, "/var/www")
238
+ @file = @dir.get_resource(:file, "/var/www/file.html")
239
+ end
240
+ it "should say there is 1 resource because the lower-level resources should be contained on the parenting resource" do
241
+ @cloud1.resources.size.should == 1
274
242
  end
275
- it "should say cancelled? is true if it has been cancelled" do
276
- @file.cancel
277
- @file.cancelled?.should == true
243
+ it "should say there is one resource on the outer resource" do
244
+ @dir.resources.size.should == 1
245
+ end
246
+ it "should contain the file as a resource" do
247
+ @dir.resource(:file)[0].to_s.should == @file.to_s
248
+ end
249
+ it "should set the parent as the parenting resource" do
250
+ @file.parent.to_s.should == @dir.to_s
278
251
  end
279
252
  end
280
- describe "virtual_resources" do
253
+ describe "fetching" do
281
254
  before(:each) do
282
- @virtual_resource = git(:name => "tank", :source => "git://github.com/auser/testgit.git")
255
+ @file = file(:name => "pancakes")
256
+ end
257
+ it "should not create a new resource if the same resource exists" do
258
+ PoolParty::Resources::File.should_not_receive(:new)
259
+ file(:name => "pancakes")
260
+ end
261
+ it "should return the file preiously created" do
262
+ get_resource(:file, "pancakes").options.keys.sort.should == @file.options.keys.sort
283
263
  end
284
- it "should fetch a virtual resource the same" do
285
- git(:name => "tank", :source => "git://github.com/auser/testgit.git").to_s.should == @virtual_resource.to_s
264
+ it "should be able to use the helper to grab the file" do
265
+ PoolParty::Resources::File.should_not_receive(:new)
266
+ self.stub!(:key).and_return "false"
267
+ file(:name => "pancakes").name.should == @file.name
268
+ end
269
+ it "should turn the resource into a string" do
270
+ @file.to_s.should == "File['pancakes']"
271
+ end
272
+ describe "cancelled" do
273
+ it "should make a resource not cancelled by default" do
274
+ @file.cancelled?.should == false
275
+ end
276
+ it "should say cancelled? is true if it has been cancelled" do
277
+ @file.cancel
278
+ @file.cancelled?.should == true
279
+ end
280
+ it "should be able to get the file from the helper" do
281
+ get_file("pancakes").options.keys.sort.should == @file.options.keys.sort
282
+ end
283
+ end
284
+ describe "virtual_resources" do
285
+ before(:each) do
286
+ @virtual_resource = git(:name => "tank", :source => "git://github.com/auser/testgit.git")
287
+ end
288
+ it "should fetch a virtual resource the same" do
289
+ git(:name => "tank", :source => "git://github.com/auser/testgit.git").to_s.should == @virtual_resource.to_s
290
+ end
286
291
  end
287
292
  end
288
- end
293
+ describe "global resources" do
294
+ describe "setting" do
295
+ before(:each) do
296
+ @cloud2 = cloud :applepie do
297
+ directory(:name => "/var/www") do
298
+ file(:name => "/var/www/file.html")
299
+ end
300
+ end
301
+ @cloud2 = cloud(:applepie)
302
+ end
303
+ it "should have a global_resources_store available as an Array" do
304
+ @cloud2.global_resources_store.class.should == Array
305
+ end
306
+ it "should have stored the two resources from the cloud into the global_resources_store" do
307
+ @cloud2.global_resources_store.size.should >= 2
308
+ end
309
+ it "should be an array of resources" do
310
+ @cloud2.global_resources_store.first.is_a?(PoolParty::Resources::Resource).should == true
311
+ end
312
+ it "should say that the type directory of name /var/www is in the global_resources_store" do
313
+ @cloud2.in_global_resource_store?(:directory, "/var/www").should == true
314
+ end
315
+ it "should say that the type file of the name /var/www/file.html is in the global_resources_store" do
316
+ @cloud2.in_global_resource_store?(:file, "/var/www/file.html").should == true
317
+ end
318
+ it "should say tht the type exec of the name echo 'hello' is not in the global_resources_store" do
319
+ @cloud2.in_global_resource_store?(:exec, "echo 'hello'").should == false
320
+ end
321
+ it "should say that the resource is in the global_resources_store when put in the global_resources_store" do
322
+ @file1 = PoolParty::Resources::File.new(:name => "/var/tmp.txt")
323
+ @cloud2.store_into_global_resource_store(@file1)
324
+ @cloud2.in_global_resource_store?(:file, "/var/tmp.txt")
325
+ end
326
+ it "should put the resource into the global_resources_store when calling store_into_global_resource_store" do
327
+ @file2 = PoolParty::Resources::File.new({:name => "/var/bunk.txt"})
328
+ @cloud2.global_resources_store.should_receive(:<<).with(@file2)
329
+ @cloud2.store_into_global_resource_store(@file2)
330
+ end
331
+ it "should not put a resource into the global_resources_store if it's already there" do
332
+ @file3 = PoolParty::Resources::File.new({:name => "/var/www/file.html"})
333
+ @cloud2.global_resources_store.should_not_receive(:<<).with(@file3)
334
+ @cloud2.store_into_global_resource_store(@file3)
335
+ end
336
+ it "should be able to get the resource from the global_resources_store by the name and type" do
337
+ @cloud2.get_from_global_resource_store(:directory, "/var/www").key.should == "/var/www"
338
+ end
339
+ describe "adding to global resource store" do
340
+ before(:each) do
341
+ @cloud3 = cloud :pumpkinpie do
342
+ file(:name => "/var/www/pumpkinfile.html")
343
+ file(:name => "/var/www/pumpkinfile.html")
344
+ apache do
345
+ file(:name => "/var/www/pumpkinfile.html")
346
+ end
347
+ end
348
+ @cloud3 = cloud(:pumpkinpie)
349
+ end
350
+ it "should not have 2 of the same resources" do
351
+ @cloud3.resource(:file).size.should == 1
352
+ end
353
+ end
354
+ describe "grabbing after already instantiated" do
355
+ before(:each) do
356
+ @cloud2.instance_eval do
357
+ has_package(:name => "apache2") do
358
+ has_exec(:name => "Add apache2 module") do
359
+ command "a2enmod mpm_worker"
360
+ end
361
+ end
362
+ has_package(:name => "boxers") do
363
+ has_file(:name => "/var/list_of_boxers.txt", :requires => (get_package("apache2")) )
364
+ end
365
+ end
366
+ end
367
+ describe "same_resources_of" do
368
+ it "should say that two resources are the same" do
369
+ has_file(:name => "tanks")
370
+ has_file(:name => "tanks").same_resources_of(:file, "tanks").should == true
371
+ end
372
+ it "should say that two resources are the same regardless of their context" do
373
+ @cloud2.instance_eval do
374
+ has_file(:name => "mighty_mighty_bosstones")
375
+ end
376
+ @cloud2.resource(:file).first.same_resources_of(:file, "mighty_mighty_bosstones").should == true
377
+ end
378
+ it "should say that two resources are not the same if they are not the same" do
379
+ has_file(:name => "trees").same_resources_of(:file, "timber").should == false
380
+ end
381
+ end
382
+ it "should grab the resource when called in in a block"# do
383
+ # @cloud2.resources_string_from_resources(@cloud2.resources).should =~ /\[ Package\['apache2'\], Package\['boxers'\] \]/
384
+ # end
385
+ end
386
+ describe "inherited" do
387
+ it "should turn passengersite_with_ssl into PassengerSiteWithSsl" do
388
+ "PassengersiteWithSsl".to_s.split("::")[-1].underscore.should == "passengersite_with_ssl"
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
289
394
  end
290
395
  end