auser-poolparty 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG +1 -0
  2. data/LICENSE +22 -0
  3. data/{README.txt → README} +1 -0
  4. data/Rakefile +3 -2
  5. data/lib/helpers/plugin_spec_helper.rb +1 -1
  6. data/lib/modules/ec2_wrapper.rb +5 -6
  7. data/lib/poolparty.rb +2 -2
  8. data/lib/poolparty/application.rb +9 -11
  9. data/lib/poolparty/init.rb +1 -1
  10. data/lib/poolparty/master.rb +8 -1
  11. data/lib/poolparty/provider.rb +27 -9
  12. data/lib/poolparty/provider/git.rb +4 -0
  13. data/lib/poolparty/provider/haproxy.rb +4 -0
  14. data/lib/poolparty/provider/heartbeat.rb +3 -1
  15. data/lib/poolparty/provider/rsync.rb +4 -0
  16. data/lib/poolparty/provider/ruby.rb +46 -9
  17. data/lib/poolparty/provider/s3fuse.rb +4 -0
  18. data/lib/poolparty/remote_instance.rb +14 -2
  19. data/lib/poolparty/tasks/development.rake +17 -12
  20. data/poolparty.gemspec +11 -10
  21. data/spec/helpers/ec2_mock.rb +7 -0
  22. data/spec/lib/{core_spec.rb → core/core_spec.rb} +1 -1
  23. data/spec/lib/{kernel_spec.rb → core/kernel_spec.rb} +1 -1
  24. data/spec/lib/{string_spec.rb → core/string_spec.rb} +1 -1
  25. data/spec/lib/{callback_spec.rb → modules/callback_spec.rb} +1 -1
  26. data/spec/lib/{file_writer_spec.rb → modules/file_writer_spec.rb} +1 -1
  27. data/spec/lib/{application_spec.rb → poolparty/application_spec.rb} +21 -5
  28. data/spec/lib/{ec2_wrapper_spec.rb → poolparty/ec2_wrapper_spec.rb} +26 -3
  29. data/spec/lib/{master_spec.rb → poolparty/master_spec.rb} +55 -55
  30. data/spec/lib/{optioner_spec.rb → poolparty/optioner_spec.rb} +1 -1
  31. data/spec/lib/{plugin_spec.rb → poolparty/plugin_spec.rb} +2 -2
  32. data/spec/lib/{poolparty_spec.rb → poolparty/poolparty_spec.rb} +1 -1
  33. data/spec/lib/poolparty/provider_spec.rb +74 -0
  34. data/spec/lib/{remote_instance_spec.rb → poolparty/remote_instance_spec.rb} +2 -2
  35. data/spec/lib/{remoter_spec.rb → poolparty/remoter_spec.rb} +2 -2
  36. data/spec/lib/{remoting_spec.rb → poolparty/remoting_spec.rb} +2 -2
  37. data/spec/lib/{scheduler_spec.rb → poolparty/scheduler_spec.rb} +1 -1
  38. data/spec/spec_helper.rb +11 -0
  39. metadata +30 -27
  40. data/lib/poolparty/plugin_manager.rb +0 -67
  41. data/spec/lib/plugin_manager_spec.rb +0 -23
  42. data/spec/lib/pool_binary_spec.rb +0 -13
  43. data/spec/lib/provider_spec.rb +0 -72
@@ -1,5 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require File.dirname(__FILE__) + "/../helpers/ec2_mock"
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require File.dirname(__FILE__) + '/../../helpers/ec2_mock'
3
3
 
4
4
  class RemoteInstance
5
5
  def scp(src="", dest="", opts={})
@@ -1,5 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require File.dirname(__FILE__) + "/../helpers/ec2_mock"
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require File.dirname(__FILE__) + '/../../helpers/ec2_mock'
3
3
 
4
4
  class TestRemote
5
5
  include Remoter
@@ -1,5 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require File.dirname(__FILE__) + "/../helpers/ec2_mock"
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require File.dirname(__FILE__) + '/../../helpers/ec2_mock'
3
3
 
4
4
  describe "Master remoting: " do
5
5
  before(:each) do
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
3
  class TestSched
4
4
  include Scheduler
@@ -34,6 +34,17 @@ def stub_option_load
34
34
  Application.reset!
35
35
  end
36
36
 
37
+ def hide_output
38
+ begin
39
+ stdout_sv = STDOUT.dup
40
+ STDOUT.reopen(File.open((PLATFORM =~ /mswin/ ? "NUL" : "/dev/null"), 'w'))
41
+ yield if block_given?
42
+ ensure
43
+ STDOUT.flush
44
+ STDOUT.reopen(stdout_sv)
45
+ end
46
+ end
47
+
37
48
  def wait_launch(time=5)
38
49
  pid = fork {yield}
39
50
  wait time
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
- date: 2008-07-19 00:00:00 -07:00
11
+ date: 2008-07-30 00:00:00 -07:00
12
12
  default_executable:
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
@@ -48,7 +48,7 @@ dependencies:
48
48
  version: "0"
49
49
  version:
50
50
  - !ruby/object:Gem::Dependency
51
- name: crafterm-sprinkle
51
+ name: sprinkle
52
52
  version_requirement:
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
@@ -93,7 +93,8 @@ extensions: []
93
93
 
94
94
  extra_rdoc_files:
95
95
  - CHANGELOG
96
- - README.txt
96
+ - LICENSE
97
+ - README
97
98
  - bin
98
99
  - bin/instance
99
100
  - bin/pool
@@ -131,7 +132,6 @@ extra_rdoc_files:
131
132
  - lib/poolparty/monitors/web.rb
132
133
  - lib/poolparty/optioner.rb
133
134
  - lib/poolparty/plugin.rb
134
- - lib/poolparty/plugin_manager.rb
135
135
  - lib/poolparty/provider
136
136
  - lib/poolparty/provider.rb
137
137
  - lib/poolparty/provider/essential.rb
@@ -158,7 +158,8 @@ extra_rdoc_files:
158
158
  - lib/s3/s3_object_store_folders.rb
159
159
  files:
160
160
  - CHANGELOG
161
- - README.txt
161
+ - LICENSE
162
+ - README
162
163
  - Rakefile
163
164
  - assets
164
165
  - assets/clouds.png
@@ -215,7 +216,6 @@ files:
215
216
  - lib/poolparty/monitors/web.rb
216
217
  - lib/poolparty/optioner.rb
217
218
  - lib/poolparty/plugin.rb
218
- - lib/poolparty/plugin_manager.rb
219
219
  - lib/poolparty/provider
220
220
  - lib/poolparty/provider.rb
221
221
  - lib/poolparty/provider/essential.rb
@@ -241,6 +241,7 @@ files:
241
241
  - lib/s3
242
242
  - lib/s3/s3_object_store_folders.rb
243
243
  - plugins
244
+ - poolparty-0.1.2.gem
244
245
  - spec
245
246
  - spec/files
246
247
  - spec/files/describe_response
@@ -249,24 +250,26 @@ files:
249
250
  - spec/helpers
250
251
  - spec/helpers/ec2_mock.rb
251
252
  - spec/lib
252
- - spec/lib/application_spec.rb
253
- - spec/lib/callback_spec.rb
254
- - spec/lib/core_spec.rb
255
- - spec/lib/ec2_wrapper_spec.rb
256
- - spec/lib/file_writer_spec.rb
257
- - spec/lib/kernel_spec.rb
258
- - spec/lib/master_spec.rb
259
- - spec/lib/optioner_spec.rb
260
- - spec/lib/plugin_manager_spec.rb
261
- - spec/lib/plugin_spec.rb
262
- - spec/lib/pool_binary_spec.rb
263
- - spec/lib/poolparty_spec.rb
264
- - spec/lib/provider_spec.rb
265
- - spec/lib/remote_instance_spec.rb
266
- - spec/lib/remoter_spec.rb
267
- - spec/lib/remoting_spec.rb
268
- - spec/lib/scheduler_spec.rb
269
- - spec/lib/string_spec.rb
253
+ - spec/lib/core
254
+ - spec/lib/core/core_spec.rb
255
+ - spec/lib/core/kernel_spec.rb
256
+ - spec/lib/core/string_spec.rb
257
+ - spec/lib/modules
258
+ - spec/lib/modules/callback_spec.rb
259
+ - spec/lib/modules/file_writer_spec.rb
260
+ - spec/lib/poolparty
261
+ - spec/lib/poolparty/application_spec.rb
262
+ - spec/lib/poolparty/ec2_wrapper_spec.rb
263
+ - spec/lib/poolparty/master_spec.rb
264
+ - spec/lib/poolparty/optioner_spec.rb
265
+ - spec/lib/poolparty/plugin_spec.rb
266
+ - spec/lib/poolparty/poolparty_spec.rb
267
+ - spec/lib/poolparty/provider_spec.rb
268
+ - spec/lib/poolparty/remote_instance_spec.rb
269
+ - spec/lib/poolparty/remoter_spec.rb
270
+ - spec/lib/poolparty/remoting_spec.rb
271
+ - spec/lib/poolparty/scheduler_spec.rb
272
+ - spec/lib/s3
270
273
  - spec/monitors
271
274
  - spec/monitors/cpu_monitor_spec.rb
272
275
  - spec/monitors/memory_spec.rb
@@ -276,14 +279,14 @@ files:
276
279
  - poolparty.gemspec
277
280
  has_rdoc: true
278
281
  homepage: http://poolpartyrb.com
279
- post_install_message: "\n \n Get ready to jump in the pool, you just installed PoolParty! (Updated at 05:57PM, 07/19/08)\n\n Please check out the documentation for any questions or check out the google groups at\n http://groups.google.com/group/poolpartyrb\n\n Don't forget to check out the plugin tutorial @ http://poolpartyrb.com for extending PoolParty! \n\n For more information, check http://poolpartyrb.com\n On IRC: \n irc.freenode.net / #poolpartyrb\n \n *** Ari Lerner @ <ari.lerner@citrusbyte.com> ***\n "
282
+ post_install_message: "\n \n Get ready to jump in the pool, you just installed PoolParty! (Updated at 12:37PM, 07/30/08)\n\n Please check out the documentation for any questions or check out the google groups at\n http://groups.google.com/group/poolpartyrb\n\n Don't forget to check out the plugin tutorial @ http://poolpartyrb.com for extending PoolParty! \n\n For more information, check http://poolpartyrb.com\n On IRC: \n irc.freenode.net\n #poolpartyrb\n \n *** Ari Lerner @ <ari.lerner@citrusbyte.com> ***\n "
280
283
  rdoc_options:
281
284
  - --line-numbers
282
285
  - --inline-source
283
286
  - --title
284
287
  - Poolparty
285
288
  - --main
286
- - README.txt
289
+ - README
287
290
  require_paths:
288
291
  - lib
289
292
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -1,67 +0,0 @@
1
- =begin rdoc
2
- A convenience method for working with plugins.
3
-
4
- Sits on top of github.
5
- =end
6
- require "git"
7
- module PoolParty
8
- def installed_plugins
9
- @@installed_plugins ||= PluginManager.extract_git_repos_from_plugin_dirs.uniq
10
- end
11
- class PluginManager
12
- include Callbacks
13
-
14
- def self.install_plugin(location)
15
- unless File.directory?(plugin_directory(location))
16
- begin
17
- Git.clone(location, plugin_directory(location))
18
- reset!
19
- rescue Exception => e
20
- puts "There was an error"
21
- puts e
22
- end
23
- else
24
- puts "Plugin already installed"
25
- end
26
- end
27
-
28
- def self.remove_plugin(name)
29
- Dir["#{PoolParty.root_dir}/#{PoolParty.plugin_dir}/*"].select {|a| a =~ /#{name}/}.each do |dir|
30
- FileUtils.rm_rf dir
31
- end
32
- end
33
-
34
- def self.scan
35
- returning Array.new do |a|
36
- plugin_dirs.each do |plugin|
37
- a << File.basename(plugin)
38
- end
39
- end
40
- end
41
-
42
- def self.extract_git_repos_from_plugin_dirs
43
- returning [] do |arr|
44
- plugin_dirs.each do |dir|
45
- begin
46
- arr << open(File.join(dir, ".git", "config")).read[/url[\s]*=[\s](.*)/,1]
47
- rescue Exception => e
48
- end
49
- end
50
- end
51
- end
52
-
53
- def self.plugin_dirs
54
- Dir["#{PoolParty.user_dir}/plugin/*"]
55
- end
56
-
57
- def self.plugin_directory(path)
58
- File.join(base_plugin_dir, File.basename(path, File.extname(path)))
59
- end
60
- def self.create_plugin_directory
61
- FileUtils.mkdir_p base_plugin_dir rescue ""
62
- end
63
- def self.base_plugin_dir
64
- File.join(PoolParty.root_dir, "plugin")
65
- end
66
- end
67
- end
@@ -1,23 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "Plugin manager" do
4
- before(:each) do
5
- FileUtils.stub!(:mkdir_p).and_return true
6
- Dir["./spec/../lib/../plugin/*"].each {|a| FileUtils.rm_rf a}
7
- Git.stub!(:clone).and_return true
8
- PluginManager.stub!(:extract_git_repos_from_plugin_dirs).and_return %w(git@github.com:auser/poolparty-plugins.git)
9
- end
10
- it "should git clone the directory when it is installing a plugin" do
11
- File.stub!(:directory?).and_return false
12
- Git.should_receive(:clone).with("git@github.com:auser/poolparty.git", "/Users/auser/Sites/work/citrusbyte/internal/gems/pool-party/pool/plugin/poolparty").and_return true
13
- PluginManager.install_plugin "git@github.com:auser/poolparty.git"
14
- end
15
- it "should keep a list of the installed plugin locations" do
16
- PluginManager.should_receive(:install_plugin).and_return true
17
- PluginManager.install_plugin "git@github.com:auser/poolparty-plugins.git"
18
- PoolParty.installed_plugins.should == ["git@github.com:auser/poolparty-plugins.git"]
19
- end
20
- it "should be able to rescan the plugin directory and tell which plugins are installed"
21
- it "should be able to remove a plugin based on the name"
22
- it "should be able to extract the git repos from the .git/config file"
23
- end
@@ -1,13 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe "Pool binary" do
4
- describe "running" do
5
- before(:each) do
6
- stub_option_load
7
- end
8
- it "should call PoolParty.options" do
9
- options = PoolParty.options(:optsparse => {:banner => "Usage: pool [OPTIONS] {start | stop | list | maintain | restart}" })
10
- end
11
-
12
- end
13
- end
@@ -1,72 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require File.dirname(__FILE__) + "/../helpers/ec2_mock"
3
-
4
- describe "Provider" do
5
- before(:each) do
6
- stub_option_load
7
- Sprinkle::Script.stub!(:sprinkle).and_return true
8
- @ips = ["127.0.0.1"]
9
- Master.stub!(:cloud_ips).and_return @ips
10
- end
11
- it "should load the packages in the package directory" do
12
- Dir.should_receive(:[]).and_return []
13
- Provider.new.load_packages
14
- end
15
- it "should load the packages defined in the user directory"
16
- describe "running" do
17
- describe "server packages" do
18
- before(:each) do
19
- @provider = Provider.new
20
- @str = "new"
21
- @str.stub!(:process).and_return true
22
- @provider.stub!(:set_start_with_sprinkle).and_return @str
23
- Provider.stub!(:new).and_return @provider
24
- Master.stub!(:cloud_ips).and_return ["127.0.0.1"]
25
- end
26
- it "should use the loaded packages to install" do
27
- @provider.should_receive(:load_packages).and_return []
28
- @provider.install_poolparty
29
- end
30
- it "should load the install script when installing" do
31
- @provider.should_receive(:set_start_with_sprinkle).and_return true
32
- @provider.install_poolparty
33
- end
34
- end
35
- describe "user packages" do
36
- describe "defining" do
37
- before(:each) do
38
- Provider.define_custom_package(:sprinkle) do
39
- package :sprinkle, :provides => :package do
40
- description 'Sprinkle'
41
- apt %w( sprinkle )
42
- end
43
- end
44
- end
45
- it "should be able to define user packages with blocks and pass those into the user_packages" do
46
- Provider.user_packages.size.should == 1
47
- end
48
- it "should define the user packages as strings" do
49
- Provider.user_packages.first.class.should == Proc
50
- end
51
- end
52
- describe "defining custom packages" do
53
- before(:each) do
54
- Provider.reset!
55
- Provider.define_custom_package(:custom) do
56
- <<-EOE
57
- package :custom do
58
- description 'custom packages'
59
- end
60
- EOE
61
- end
62
- end
63
- it "should be able to define a custom package with a name" do
64
- Provider.user_packages.size.should > 1
65
- end
66
- it "should have the name of the custom package built in" do
67
- Provider.user_install_packages.sort {|a,b| a.to_s <=> b.to_s }.should == [:custom, :sprinkle]
68
- end
69
- end
70
- end
71
- end
72
- end