auser-poolparty 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/VERSION.yml +1 -1
  2. data/bin/cloud-list +4 -4
  3. data/bin/cloud-provision +2 -0
  4. data/bin/cloud-ssh +1 -1
  5. data/bin/install-poolparty +1 -1
  6. data/examples/fairchild.rb +26 -17
  7. data/examples/metavirt_cloud.rb +2 -4
  8. data/lib/poolparty.rb +2 -7
  9. data/lib/poolparty/core/array.rb +1 -1
  10. data/lib/poolparty/core/exception.rb +1 -1
  11. data/lib/poolparty/core/hash.rb +12 -5
  12. data/lib/poolparty/core/integer.rb +11 -0
  13. data/lib/poolparty/core/object.rb +14 -0
  14. data/lib/poolparty/core/string.rb +6 -1
  15. data/lib/poolparty/core/time.rb +6 -0
  16. data/lib/poolparty/extra/duration.rb +96 -0
  17. data/lib/poolparty/helpers/binary.rb +1 -1
  18. data/lib/poolparty/modules/cloud_resourcer.rb +1 -1
  19. data/lib/poolparty/modules/definable_resource.rb +5 -7
  20. data/lib/poolparty/modules/output.rb +2 -2
  21. data/lib/poolparty/monitors/base_monitor.rb +17 -0
  22. data/lib/poolparty/net/init.rb +4 -11
  23. data/lib/poolparty/net/remote_instance.rb +5 -0
  24. data/lib/poolparty/net/remoter/connections.rb +14 -11
  25. data/lib/poolparty/net/remoter/interactive.rb +13 -2
  26. data/lib/poolparty/net/remoter_base.rb +9 -4
  27. data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +50 -35
  28. data/lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb +46 -5
  29. data/lib/poolparty/net/remoter_bases/ec2/ec2_response_object.rb +57 -1
  30. data/lib/poolparty/plugins/apache2/apache.rb +13 -160
  31. data/lib/poolparty/plugins/apache2/passenger_site.rb +86 -0
  32. data/lib/poolparty/plugins/apache2/php5.rb +40 -0
  33. data/lib/poolparty/plugins/apache2/virtual_host.rb +53 -0
  34. data/lib/poolparty/plugins/authorized_key.rb +2 -2
  35. data/lib/poolparty/plugins/bind.rb +5 -6
  36. data/lib/poolparty/plugins/{chef.rb → chef/chef.rb} +22 -18
  37. data/lib/poolparty/plugins/{chef_deploy.rb → chef/chef_deploy.rb} +20 -19
  38. data/lib/poolparty/plugins/deploy_directory.rb +2 -3
  39. data/lib/poolparty/plugins/gem_package.rb +6 -12
  40. data/lib/poolparty/plugins/git.rb +22 -7
  41. data/lib/poolparty/{base_packages → plugins}/haproxy.rb +2 -2
  42. data/lib/poolparty/{base_packages → plugins}/heartbeat.rb +7 -7
  43. data/lib/poolparty/plugins/line_in_file.rb +4 -2
  44. data/lib/poolparty/plugins/plugin_template.rb +13 -0
  45. data/lib/poolparty/{base_packages/poolparty.rb → plugins/poolparty_base_packages.rb} +2 -2
  46. data/lib/poolparty/plugins/rails_deploy.rb +2 -3
  47. data/lib/poolparty/{base_packages → plugins}/ruby.rb +3 -3
  48. data/lib/poolparty/{base_packages → plugins}/runit.rb +3 -3
  49. data/lib/poolparty/plugins/svn.rb +8 -6
  50. data/lib/poolparty/poolparty/cloud.rb +5 -8
  51. data/lib/poolparty/poolparty/default.rb +1 -1
  52. data/lib/poolparty/poolparty/plugin.rb +36 -15
  53. data/lib/poolparty/poolparty/pool.rb +6 -2
  54. data/lib/poolparty/poolparty/poolparty_base_class.rb +5 -11
  55. data/lib/poolparty/poolparty/resource.rb +2 -1
  56. data/lib/poolparty/poolparty/service.rb +6 -8
  57. data/lib/poolparty/provision/dr_configure.rb +3 -3
  58. data/lib/poolparty/verification/verifier_base.rb +10 -0
  59. data/spec/bin/server-list-active_spec.rb +1 -3
  60. data/spec/poolparty/core/string_spec.rb +1 -1
  61. data/spec/poolparty/dependency_resolver/chef_resolver_spec.rb +0 -2
  62. data/spec/poolparty/dependency_resolver/dependency_resolver_cloud_extensions_spec.rb +16 -13
  63. data/spec/poolparty/extra/deployments_spec.rb +68 -68
  64. data/spec/poolparty/net/remoter_bases/ec2_spec.rb +1 -0
  65. data/spec/poolparty/plugins/deploydirectory_spec.rb +64 -51
  66. data/spec/poolparty/poolparty/cloud_spec.rb +21 -19
  67. data/spec/poolparty/poolparty/configurers/files/ruby_basic.rb +1 -1
  68. data/spec/poolparty/poolparty/configurers/files/ruby_plugins.rb +1 -1
  69. data/spec/poolparty/{base_packages → poolparty}/haproxy_spec.rb +1 -1
  70. data/spec/poolparty/{base_packages → poolparty}/heartbeat_spec.rb +1 -1
  71. data/spec/poolparty/poolparty/plugin_model_spec.rb +6 -13
  72. data/spec/poolparty/poolparty/plugin_spec.rb +7 -7
  73. data/spec/poolparty/poolparty/resource_spec.rb +15 -5
  74. data/spec/poolparty/poolparty/test_plugins/webserver.rb +27 -23
  75. data/test/fixtures/metavirt_cloud.json +1 -0
  76. data/test/poolparty/dependency_resolver/puppet_resolver_test.rb +0 -5
  77. data/test/poolparty/modules/cloud_dsl_test.rb +1 -1
  78. data/test/poolparty/monitors/test_base_monitor.rb +17 -0
  79. data/test/poolparty/monitors/test_monitor_rack.rb +39 -0
  80. data/test/poolparty/net/remoter_base_test.rb +18 -0
  81. data/test/poolparty/plugins/chef_deploy_test.rb +1 -1
  82. data/test/poolparty/plugins/rails_deploy_test.rb +3 -3
  83. data/test/poolparty/poolparty/cloud_test.rb +27 -2
  84. data/test/poolparty/poolparty/isolated_cloud_test.rb +25 -0
  85. data/test/poolparty/poolparty/plugin_test.rb +9 -8
  86. data/test/poolparty/poolparty/schema_test.rb +13 -0
  87. data/test/poolparty/verification/verify_test.rb +4 -0
  88. data/test/test_helper.rb +10 -3
  89. data/test/test_methods.rb +11 -0
  90. data/vendor/gems/dslify/test/dslify_test.rb +28 -0
  91. metadata +29 -15
  92. data/lib/poolparty/extra/deployments.rb +0 -31
  93. data/lib/poolparty/poolparty/plugin_model.rb +0 -46
@@ -1,12 +1,19 @@
1
+ $:.unshift(::File.dirname(__FILE__))
1
2
  require "rubygems"
2
3
  require "test/unit"
3
4
  # require "context"
4
5
  require "matchy"
5
6
  require "shoulda"
6
- # require "mocha"
7
- # require 'ruby-debug'
7
+ require "mocha"
8
+
9
+ require "test_methods"
8
10
 
9
11
  require File.dirname(__FILE__) + '/../lib/poolparty'
10
12
  require 'git-style-binary/command'
11
13
 
12
- GitStyleBinary.run = true
14
+ GitStyleBinary.run = true
15
+
16
+ modify_env_with_hash(
17
+ "AWS_ACCESS_KEY" => "fake_aws_access_key",
18
+ "AWS_SECRET_ACCESS_KEY" => "fake_secret_aws_key"
19
+ )
@@ -0,0 +1,11 @@
1
+ def modify_env_with_hash(h={})
2
+ orig_env = Kernel.const_get(:ENV)
3
+
4
+ h.each do |k,v|
5
+ orig_env.delete(k)
6
+ orig_env[k] = v
7
+ end
8
+
9
+ Kernel.send :remove_const, :ENV if Kernel.const_defined?(:ENV)
10
+ Kernel.const_set(:ENV, orig_env)
11
+ end
@@ -262,5 +262,33 @@ class QuickieTest < Test::Unit::TestCase
262
262
  end
263
263
  end
264
264
 
265
+ context "dsl_methods and methods on the object" do
266
+ setup do
267
+ class PluginMoopieMoop
268
+ include Dslify
269
+ default_options :stars => to_s
270
+
271
+ def self.inherited(s)
272
+ # stuff
273
+ super
274
+ end
275
+ end
276
+ class DoopyDoop < PluginMoopieMoop
277
+ def stars
278
+ "right now"
279
+ end
280
+ end
281
+ @obj = DoopyDoop.new
282
+ end
283
+
284
+ should "have the method :stars" do
285
+ assert @obj.respond_to?(:stars)
286
+ end
287
+ should "use the method on the instance" do
288
+ assert_equal @obj.stars, "right now"
289
+ end
290
+ end
291
+
292
+
265
293
 
266
294
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-26 00:00:00 -07:00
12
+ date: 2009-06-02 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -111,18 +111,13 @@ files:
111
111
  - examples/vmrun_cloud.rb
112
112
  - lib/poolparty
113
113
  - lib/poolparty/aska.rb
114
- - lib/poolparty/base_packages
115
- - lib/poolparty/base_packages/haproxy.rb
116
- - lib/poolparty/base_packages/heartbeat.rb
117
- - lib/poolparty/base_packages/poolparty.rb
118
- - lib/poolparty/base_packages/ruby.rb
119
- - lib/poolparty/base_packages/runit.rb
120
114
  - lib/poolparty/core
121
115
  - lib/poolparty/core/array.rb
122
116
  - lib/poolparty/core/class.rb
123
117
  - lib/poolparty/core/exception.rb
124
118
  - lib/poolparty/core/float.rb
125
119
  - lib/poolparty/core/hash.rb
120
+ - lib/poolparty/core/integer.rb
126
121
  - lib/poolparty/core/kernel.rb
127
122
  - lib/poolparty/core/my_open_struct.rb
128
123
  - lib/poolparty/core/nil.rb
@@ -153,7 +148,7 @@ files:
153
148
  - lib/poolparty/exceptions/TemplateNotFound.rb
154
149
  - lib/poolparty/exceptions/UnacceptableCommand.rb
155
150
  - lib/poolparty/extra
156
- - lib/poolparty/extra/deployments.rb
151
+ - lib/poolparty/extra/duration.rb
157
152
  - lib/poolparty/helpers
158
153
  - lib/poolparty/helpers/binary.rb
159
154
  - lib/poolparty/helpers/console.rb
@@ -219,15 +214,25 @@ files:
219
214
  - lib/poolparty/plugins
220
215
  - lib/poolparty/plugins/apache2
221
216
  - lib/poolparty/plugins/apache2/apache.rb
217
+ - lib/poolparty/plugins/apache2/passenger_site.rb
218
+ - lib/poolparty/plugins/apache2/php5.rb
219
+ - lib/poolparty/plugins/apache2/virtual_host.rb
222
220
  - lib/poolparty/plugins/authorized_key.rb
223
221
  - lib/poolparty/plugins/bind.rb
224
- - lib/poolparty/plugins/chef.rb
225
- - lib/poolparty/plugins/chef_deploy.rb
222
+ - lib/poolparty/plugins/chef
223
+ - lib/poolparty/plugins/chef/chef.rb
224
+ - lib/poolparty/plugins/chef/chef_deploy.rb
226
225
  - lib/poolparty/plugins/deploy_directory.rb
227
226
  - lib/poolparty/plugins/gem_package.rb
228
227
  - lib/poolparty/plugins/git.rb
228
+ - lib/poolparty/plugins/haproxy.rb
229
+ - lib/poolparty/plugins/heartbeat.rb
229
230
  - lib/poolparty/plugins/line_in_file.rb
231
+ - lib/poolparty/plugins/plugin_template.rb
232
+ - lib/poolparty/plugins/poolparty_base_packages.rb
230
233
  - lib/poolparty/plugins/rails_deploy.rb
234
+ - lib/poolparty/plugins/ruby.rb
235
+ - lib/poolparty/plugins/runit.rb
231
236
  - lib/poolparty/plugins/svn.rb
232
237
  - lib/poolparty/poolparty
233
238
  - lib/poolparty/poolparty/cloud.rb
@@ -236,7 +241,6 @@ files:
236
241
  - lib/poolparty/poolparty/loggable.rb
237
242
  - lib/poolparty/poolparty/neighborhoods.rb
238
243
  - lib/poolparty/poolparty/plugin.rb
239
- - lib/poolparty/poolparty/plugin_model.rb
240
244
  - lib/poolparty/poolparty/pool.rb
241
245
  - lib/poolparty/poolparty/poolparty_base_class.rb
242
246
  - lib/poolparty/poolparty/resource.rb
@@ -330,9 +334,6 @@ files:
330
334
  - spec/poolparty
331
335
  - spec/poolparty/aska
332
336
  - spec/poolparty/aska/aska_spec.rb
333
- - spec/poolparty/base_packages
334
- - spec/poolparty/base_packages/haproxy_spec.rb
335
- - spec/poolparty/base_packages/heartbeat_spec.rb
336
337
  - spec/poolparty/bin
337
338
  - spec/poolparty/bin/console_spec.rb
338
339
  - spec/poolparty/core
@@ -395,6 +396,8 @@ files:
395
396
  - spec/poolparty/poolparty/configurers/ruby_spec.rb
396
397
  - spec/poolparty/poolparty/default_spec.rb
397
398
  - spec/poolparty/poolparty/example_spec.rb
399
+ - spec/poolparty/poolparty/haproxy_spec.rb
400
+ - spec/poolparty/poolparty/heartbeat_spec.rb
398
401
  - spec/poolparty/poolparty/key_spec.rb
399
402
  - spec/poolparty/poolparty/neighborhoods_spec.rb
400
403
  - spec/poolparty/poolparty/plugin_model_spec.rb
@@ -428,6 +431,7 @@ files:
428
431
  - spec/poolparty/spec_helper.rb
429
432
  - spec/poolparty/test_spec_helper.rb
430
433
  - test/fixtures
434
+ - test/fixtures/metavirt_cloud.json
431
435
  - test/fixtures/test_key
432
436
  - test/fixtures/test_template.erb
433
437
  - test/poolparty
@@ -441,7 +445,11 @@ files:
441
445
  - test/poolparty/modules
442
446
  - test/poolparty/modules/callbacks_test.rb
443
447
  - test/poolparty/modules/cloud_dsl_test.rb
448
+ - test/poolparty/monitors
449
+ - test/poolparty/monitors/test_base_monitor.rb
450
+ - test/poolparty/monitors/test_monitor_rack.rb
444
451
  - test/poolparty/net
452
+ - test/poolparty/net/remoter_base_test.rb
445
453
  - test/poolparty/net/remoter_bases
446
454
  - test/poolparty/net/remoter_bases/metavirt
447
455
  - test/poolparty/net/remoter_bases/metavirt/metavirt_test.rb
@@ -453,9 +461,11 @@ files:
453
461
  - test/poolparty/plugins/rails_deploy_test.rb
454
462
  - test/poolparty/poolparty
455
463
  - test/poolparty/poolparty/cloud_test.rb
464
+ - test/poolparty/poolparty/isolated_cloud_test.rb
456
465
  - test/poolparty/poolparty/neighborhood_test.rb
457
466
  - test/poolparty/poolparty/plugin_test.rb
458
467
  - test/poolparty/poolparty/poolparty_base_class_test.rb
468
+ - test/poolparty/poolparty/schema_test.rb
459
469
  - test/poolparty/poolparty/template_test.rb
460
470
  - test/poolparty/provision
461
471
  - test/poolparty/provision/boot_strapper_test.rb
@@ -464,6 +474,7 @@ files:
464
474
  - test/poolparty/verification/verify_test.rb
465
475
  - test/test_generator_helper.rb
466
476
  - test/test_helper.rb
477
+ - test/test_methods.rb
467
478
  - test/test_pool_spec_generator.rb
468
479
  - test/test_poolparty.rb
469
480
  - tasks/cloud.rake
@@ -736,7 +747,10 @@ signing_key:
736
747
  specification_version: 3
737
748
  summary: Self-healing, auto-scaling system administration, provisioning and maintaining tool that makes cloud computing fun and easy
738
749
  test_files:
750
+ - test/poolparty/monitors/test_base_monitor.rb
751
+ - test/poolparty/monitors/test_monitor_rack.rb
739
752
  - test/test_generator_helper.rb
740
753
  - test/test_helper.rb
754
+ - test/test_methods.rb
741
755
  - test/test_pool_spec_generator.rb
742
756
  - test/test_poolparty.rb
@@ -1,31 +0,0 @@
1
- #TODO: Reimplement
2
- module PoolParty
3
- module Extra
4
- class Deployments
5
-
6
- def self.include_deployment(filename)
7
- return nil unless ::File.file? filename
8
- name = ::File.basename(filename, ::File.extname(filename))
9
- contents = open(filename).read
10
-
11
- plugin_klass = PoolParty::PluginModel::PluginModel.new(name)
12
- plugin_klass.class_eval <<-EOE
13
- def enable
14
- puts "Called enable"
15
- #{contents}
16
- end
17
- EOE
18
- plugin_klass
19
- end
20
-
21
- def self.include_deployments(dir)
22
- return nil unless ::File.directory? dir
23
- Dir["#{dir}/*"].each do |fi|
24
- include_deployment fi
25
- end
26
- dir
27
- end
28
-
29
- end
30
- end
31
- end
@@ -1,46 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "resource")
2
-
3
- module PoolParty
4
- module PluginModel
5
-
6
- def plugin(name=:plugin, cloud=nil, &block)
7
- plugins[name] ||= PluginModel.new(name, &block)
8
- end
9
- alias_method :register_plugin, :plugin
10
-
11
- def plugins
12
- $plugins ||= {}
13
- end
14
-
15
- class PluginModel
16
- attr_accessor :klass
17
-
18
- def initialize(name,&block)
19
- symc = "#{name}".top_level_class.camelcase
20
- klass = symc.class_constant(PoolParty::Plugin::Plugin, {:preserve => true}, &block)
21
-
22
- lowercase_class_name = symc.downcase
23
- # Store the name of the class for pretty printing later
24
- # klass.name = name
25
- # Add the plugin definition to the cloud as an instance method
26
- meth = <<-EOM
27
- def #{lowercase_class_name}(opts={}, &block)
28
- i = plugin_store.select {|i| i if i.class == #{lowercase_class_name.camelcase}Class }.first if plugin_store
29
- if i
30
- i
31
- else
32
- inst = #{lowercase_class_name.camelcase}Class.new(opts, parent, &block)
33
- plugin_store << inst if plugin_store
34
- inst
35
- end
36
- end
37
- EOM
38
-
39
- PoolParty::Cloud::Cloud.class_eval meth
40
- PoolParty::Service.add_has_and_does_not_have_methods_for(lowercase_class_name.to_sym)
41
- end
42
-
43
- end
44
-
45
- end
46
- end