auser-poolparty 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/VERSION.yml +1 -1
  2. data/bin/cloud +1 -0
  3. data/config/jeweler.rb +4 -4
  4. data/lib/poolparty/plugins/chef.rb +1 -1
  5. data/lib/poolparty/poolparty/poolparty_base_class.rb +1 -1
  6. data/lib/poolparty/resources/package.rb +8 -0
  7. data/vendor/gems/butterfly/History.txt +4 -0
  8. data/vendor/gems/butterfly/PostInstall.txt +2 -0
  9. data/vendor/gems/butterfly/README.rdoc +48 -0
  10. data/vendor/gems/butterfly/Rakefile +62 -0
  11. data/vendor/gems/butterfly/VERSION.yml +4 -0
  12. data/vendor/gems/butterfly/bin/flutter +4 -0
  13. data/vendor/gems/butterfly/butterfly.gemspec +37 -0
  14. data/vendor/gems/butterfly/examples/config.ru +15 -0
  15. data/vendor/gems/butterfly/examples/my_app.rb +12 -0
  16. data/vendor/gems/butterfly/lib/butterfly.rb +14 -0
  17. data/vendor/gems/butterfly/lib/handler.rb +48 -0
  18. data/vendor/gems/butterfly/lib/request.rb +29 -0
  19. data/vendor/gems/butterfly/lib/response.rb +49 -0
  20. data/vendor/gems/butterfly/script/console +10 -0
  21. data/vendor/gems/butterfly/script/destroy +14 -0
  22. data/vendor/gems/butterfly/script/generate +14 -0
  23. data/vendor/gems/butterfly/test/test_adapter_base.rb +23 -0
  24. data/vendor/gems/butterfly/test/test_butterfly_request.rb +46 -0
  25. data/vendor/gems/butterfly/test/test_butterfly_response.rb +43 -0
  26. data/vendor/gems/butterfly/test/test_butterfly_server.rb +16 -0
  27. data/vendor/gems/butterfly/test/test_default.rb +12 -0
  28. data/vendor/gems/butterfly/test/test_helper.rb +6 -0
  29. data/vendor/gems/dslify/History.txt +4 -0
  30. data/vendor/gems/dslify/Manifest.txt +25 -0
  31. data/vendor/gems/dslify/PostInstall.txt +5 -0
  32. data/vendor/gems/dslify/README.txt +60 -0
  33. data/vendor/gems/dslify/Rakefile +56 -0
  34. data/vendor/gems/dslify/config/hoe.rb +73 -0
  35. data/vendor/gems/dslify/config/requirements.rb +15 -0
  36. data/vendor/gems/dslify/dslify.gemspec +40 -0
  37. data/vendor/gems/dslify/lib/dslify.rb +7 -0
  38. data/vendor/gems/dslify/lib/dslify/dslify.rb +76 -0
  39. data/vendor/gems/dslify/lib/dslify/version.rb +10 -0
  40. data/vendor/gems/dslify/script/console +10 -0
  41. data/vendor/gems/dslify/script/destroy +14 -0
  42. data/vendor/gems/dslify/script/generate +14 -0
  43. data/vendor/gems/dslify/script/txt2html +82 -0
  44. data/vendor/gems/dslify/setup.rb +1585 -0
  45. data/vendor/gems/dslify/tasks/deployment.rake +34 -0
  46. data/vendor/gems/dslify/tasks/environment.rake +7 -0
  47. data/vendor/gems/dslify/tasks/website.rake +17 -0
  48. data/vendor/gems/dslify/test/test_dslify.rb +138 -0
  49. data/vendor/gems/dslify/website/index.html +86 -0
  50. data/vendor/gems/dslify/website/index.txt +83 -0
  51. data/vendor/gems/dslify/website/javascripts/rounded_corners_lite.inc.js +285 -0
  52. data/vendor/gems/dslify/website/stylesheets/screen.css +138 -0
  53. data/vendor/gems/dslify/website/template.html.erb +48 -0
  54. data/vendor/gems/parenting/History.txt +4 -0
  55. data/vendor/gems/parenting/Manifest.txt +13 -0
  56. data/vendor/gems/parenting/PostInstall.txt +2 -0
  57. data/vendor/gems/parenting/README.rdoc +47 -0
  58. data/vendor/gems/parenting/Rakefile +28 -0
  59. data/vendor/gems/parenting/lib/parenting.rb +10 -0
  60. data/vendor/gems/parenting/lib/parenting/parenting.rb +61 -0
  61. data/vendor/gems/parenting/parenting.gemspec +39 -0
  62. data/vendor/gems/parenting/script/console +10 -0
  63. data/vendor/gems/parenting/script/destroy +14 -0
  64. data/vendor/gems/parenting/script/generate +14 -0
  65. data/vendor/gems/parenting/test/file_to_eval.rb +9 -0
  66. data/vendor/gems/parenting/test/test_helper.rb +5 -0
  67. data/vendor/gems/parenting/test/test_parenting.rb +117 -0
  68. data/vendor/gems/suitcase/LICENSE +20 -0
  69. data/vendor/gems/suitcase/README.rdoc +31 -0
  70. data/vendor/gems/suitcase/Rakefile +57 -0
  71. data/vendor/gems/suitcase/VERSION.yml +4 -0
  72. data/vendor/gems/suitcase/lib/suitcase.rb +5 -0
  73. data/vendor/gems/suitcase/lib/suitcase/unzipper.rb +15 -0
  74. data/vendor/gems/suitcase/lib/suitcase/zipper.rb +119 -0
  75. data/vendor/gems/suitcase/suitcase.gemspec +32 -0
  76. data/vendor/gems/suitcase/test/suitcase_test.rb +102 -0
  77. data/vendor/gems/suitcase/test/test_dir/box.rb +1 -0
  78. data/vendor/gems/suitcase/test/test_dir/test.txt +1 -0
  79. data/vendor/gems/suitcase/test/test_helper.rb +12 -0
  80. metadata +102 -22
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 1
3
- :patch: 6
3
+ :patch: 7
4
4
  :major: 1
data/bin/cloud CHANGED
@@ -27,6 +27,7 @@ extra_help_string = <<-EOE
27
27
  cloud contract contracts the cloud by a single instance
28
28
  cloud describe show the configuration of the current clouds.rb configuration file
29
29
  cloud list show a list of the current instances on the cloud
30
+ cloud show shows output about the clouds.rb
30
31
  cloud ssh ssh into an instance of the cloud
31
32
  cloud terminate terminate the cloud
32
33
 
data/config/jeweler.rb CHANGED
@@ -12,18 +12,18 @@ end
12
12
  require 'jeweler'
13
13
  Jeweler::Tasks.new do |s|
14
14
  s.name = "poolparty"
15
+ s.description = "PoolParty: The easy, open-source, cross-cloud management solution"
15
16
  s.summary = <<-EOM
16
17
  Self-healing, auto-scaling system administration, provisioning
17
18
  and maintaining tool that makes cloud computing fun and easy
18
19
  EOM
19
- s.description = s.summary
20
20
 
21
21
  s.homepage = "http://poolpartyrb.com"
22
22
  s.email = "ari.lerner@citrusbyte.com"
23
23
  s.authors = ["Ari Lerner"]
24
24
 
25
25
  s.test_files = Dir["test/**/test_*.rb"]
26
- excludes_regexp = ["vendor/gems", "lib/erlang"].one_of_regex
26
+ excludes_regexp = ["lib/erlang"].one_of_regex
27
27
 
28
28
  s.files = (%w(Rakefile History.txt README.txt PostInstall.txt License.txt VERSION.yml) +
29
29
  Dir["{config,examples,lib,spec,test,tasks,script,generators,bin,vendor}/**/*"]).delete_if{|f| f =~ excludes_regexp}
@@ -38,8 +38,8 @@ end
38
38
 
39
39
  s.add_dependency 'activesupport'
40
40
  s.add_dependency 'logging'
41
- s.add_dependency 'auser-dslify'
42
- s.add_dependency 'auser-parenting'
41
+ # s.add_dependency 'auser-dslify'
42
+ # s.add_dependency 'auser-parenting'
43
43
  # s.add_dependency 'auser-suitcase'
44
44
  # s.add_dependency 'ruby2ruby' #TODO: remove this after verifying removing doesnt break anything
45
45
  s.add_dependency 'grempe-amazon-ec2'
@@ -12,7 +12,7 @@ module PoolParty
12
12
 
13
13
  plugin :include_chef_recipe do
14
14
  def loaded(opts={}, &block)
15
- parent.has_chef_recipe ::File.basename(name)
15
+ has_chef_recipe ::File.basename(name)
16
16
  end
17
17
  def before_configure
18
18
  ::Suitcase::Zipper.add(name, "chef/cookbooks") if ::File.exist?(name)
@@ -140,7 +140,7 @@ module PoolParty
140
140
  end
141
141
 
142
142
  def method_missing(m,*a,&block)
143
- if this_context && this_context != self && this_context.respond_to?(m)# && !self.is_a?(PoolParty::Resources::Resource)
143
+ if respond_to?(:this_context) && this_context != self && this_context.respond_to?(m)# && !self.is_a?(PoolParty::Resources::Resource)
144
144
  this_context.send m, *a, &block
145
145
  else
146
146
  # if dsl_options.has_key?(m)
@@ -1,3 +1,11 @@
1
+ =begin rdoc
2
+ Package
3
+
4
+ Usage:
5
+ has_package "name_of_package"
6
+
7
+ This will install the "name_of_package" package with the package provider (apt, yum, etc)
8
+ =end
1
9
  module PoolParty
2
10
  module Resources
3
11
 
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2009-03-23
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
@@ -0,0 +1,2 @@
1
+ start butterfly with:
2
+ flutter
@@ -0,0 +1,48 @@
1
+ = Butterfly
2
+
3
+ http://blog.xnot.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ An HTTP mini server to query against modular adaptors
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ It's new
12
+
13
+ == SYNOPSIS:
14
+
15
+ Check out the tests
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * thin
20
+
21
+ == INSTALL:
22
+
23
+ * sudo gem install auser-butterfly
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2009 Ari Lerner, CloudTeam, AT&Ti
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ # %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
5
+ # require File.dirname(__FILE__) + '/lib/butterfly'
6
+
7
+
8
+ begin
9
+ require 'jeweler'
10
+ Jeweler::Tasks.new do |gem|
11
+ gem.name = "butterfly"
12
+ gem.summary = %Q{An HTTP mini server to query against modular adaptors}
13
+ gem.email = "arilerner@mac.com"
14
+ gem.homepage = "http://github.com/auser/butterfly"
15
+ gem.files = FileList["[A-Z]*", "{bin,examples,lib,test}/**/*", '.gitignore']
16
+ gem.post_install_message = 'PostInstall.txt'
17
+ gem.add_dependency 'rack', '>=0.9'
18
+ gem.add_dependency 'json', '>=1.1.3'
19
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
+ end
21
+ rescue LoadError
22
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
23
+ end
24
+
25
+ require 'rake/testtask'
26
+ Rake::TestTask.new(:test) do |test|
27
+ test.libs << 'lib' << 'test'
28
+ test.pattern = 'test/test*.rb'
29
+ test.verbose = false
30
+ end
31
+
32
+ begin
33
+ require 'rcov/rcovtask'
34
+ Rcov::RcovTask.new do |test|
35
+ test.libs << 'test'
36
+ test.pattern = 'test/*_test.rb'
37
+ test.verbose = true
38
+ end
39
+ rescue LoadError
40
+ task :rcov do
41
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
+ end
43
+ end
44
+
45
+
46
+ task :default => :test
47
+
48
+ require 'rake/rdoctask'
49
+ Rake::RDocTask.new do |rdoc|
50
+ if File.exist?('VERSION.yml')
51
+ config = YAML.load(File.read('VERSION.yml'))
52
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
53
+ else
54
+ version = ""
55
+ end
56
+
57
+ rdoc.rdoc_dir = 'rdoc'
58
+ rdoc.title = "butterfly #{version}"
59
+ rdoc.rdoc_files.include('README*')
60
+ rdoc.rdoc_files.include('lib/**/*.rb')
61
+ end
62
+
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 9
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require "#{File.dirname(__FILE__)}/../lib/butterfly"
3
+
4
+ Butterfly::Server.new({}).start!
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{butterfly}
5
+ s.version = "0.0.9"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.date = %q{2009-04-09}
9
+ s.default_executable = %q{flutter}
10
+ s.email = %q{arilerner@mac.com}
11
+ s.executables = ["flutter"]
12
+ s.extra_rdoc_files = ["README.rdoc"]
13
+ s.files = ["History.txt", "PostInstall.txt", "Rakefile", "README.rdoc", "VERSION.yml", "bin/flutter", "examples/config.ru", "examples/my_app.rb", "lib/butterfly.rb", "lib/handler.rb", "lib/request.rb", "lib/response.rb", "test/test_adapter_base.rb", "test/test_butterfly_request.rb", "test/test_butterfly_response.rb", "test/test_butterfly_server.rb", "test/test_default.rb", "test/test_helper.rb", ".gitignore"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/auser/butterfly}
16
+ s.post_install_message = %q{PostInstall.txt}
17
+ s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
18
+ s.require_paths = ["lib"]
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{An HTTP mini server to query against modular adaptors}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ s.add_runtime_dependency(%q<rack>, [">= 0.9"])
28
+ s.add_runtime_dependency(%q<json>, [">= 1.1.3"])
29
+ else
30
+ s.add_dependency(%q<rack>, [">= 0.9"])
31
+ s.add_dependency(%q<json>, [">= 1.1.3"])
32
+ end
33
+ else
34
+ s.add_dependency(%q<rack>, [">= 0.9"])
35
+ s.add_dependency(%q<json>, [">= 1.1.3"])
36
+ end
37
+ end
@@ -0,0 +1,15 @@
1
+ require "rubygems"
2
+ require "#{File.dirname(__FILE__)}/../lib/butterfly"
3
+ require "#{File.dirname(__FILE__)}/my_app"
4
+
5
+ app = Rack::Builder.new {
6
+ use Rack::ShowExceptions
7
+ use Rack::Reloader
8
+ use Rack::CommonLogger
9
+
10
+ use Butterfly::Handler, :module => Buts
11
+
12
+ run lambda {|env| [404, {}, "uh oh"]}
13
+ }
14
+
15
+ run app
@@ -0,0 +1,12 @@
1
+ require "rubygems"
2
+
3
+ module Buts
4
+ class Stats
5
+ def get req, resp
6
+ "ordinary"
7
+ end
8
+ def load req, resp
9
+ "load"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ %w(rubygems thin rack handler request response).each {|lib| require lib }
5
+
6
+ module Butterfly
7
+ VERSION = '0.0.5' unless Butterfly.const_defined?("VERSION")
8
+ end
9
+
10
+ class String
11
+ def camelcase
12
+ gsub(/(^|_|-)(.)/) { $2.upcase }
13
+ end
14
+ end
@@ -0,0 +1,48 @@
1
+ module Butterfly
2
+ class Handler
3
+
4
+ def initialize(app, o={})
5
+ @app = app
6
+ @module_space = o.delete(:module) || Kernel
7
+ @ops = o
8
+ end
9
+ def call env
10
+ status, headers, body = @app.call env
11
+
12
+ req, resp = request_and_response(env)
13
+
14
+ body = begin
15
+ konst = get_const(req)
16
+ resp.return! try_handle(konst, req, resp)
17
+ rescue Exception => e
18
+ resp.fail!
19
+ error_message = "Boom! could not find Butterfly::#{req.route_param.to_s.camelcase} #{e.inspect}"
20
+ resp.return!(error_message)
21
+ end
22
+ end
23
+
24
+ def try_handle(konst, req, resp)
25
+ inst = konst.send(:new, @ops)
26
+ if inst.respond_to?(req.meth_param)
27
+ inst.send(req.meth_param, req, resp)
28
+ else
29
+ inst.send(req.request_method, req, resp)
30
+ end
31
+ end
32
+
33
+ def get_const(req)
34
+ route_param = req.route_param.to_s.camelcase.to_sym
35
+ begin
36
+ klass = @module_space.const_get(route_param)
37
+ rescue Exception => e
38
+ @module_space.const_get(route_param)
39
+ end
40
+ end
41
+
42
+ def request_and_response(env)
43
+ req = Request.new(env)
44
+ [req, Response.new(req)]
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,29 @@
1
+ module Butterfly
2
+ class Request
3
+ attr_reader :env
4
+ def initialize(env)
5
+ @env = env
6
+ end
7
+ def route_param
8
+ @route_param ||= params.empty? ? nil : params.shift
9
+ end
10
+ def meth_param
11
+ @meth_param ||= params.empty? ? :index : params.shift
12
+ end
13
+ def post_data
14
+ @post_data ||= env["rack.input"]
15
+ end
16
+ def post_content
17
+ @post_content ||= post_data.read
18
+ end
19
+ def params
20
+ @params ||= env["REQUEST_URI"].split("?")[0].split(".")[0].split("/").reject {|a| a.empty? }.map {|a| a.to_sym }
21
+ end
22
+ def request_method
23
+ env["REQUEST_METHOD"].downcase.to_sym
24
+ end
25
+ def request_type
26
+ env["REQUEST_URI"].split(".")[-1] rescue env["CONTENT_TYPE"] || nil
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,49 @@
1
+ require "rubygems"
2
+ require "json"
3
+ module Butterfly
4
+ class Response
5
+ attr_reader :request, :body, :status, :headers
6
+
7
+ def initialize req, b=nil
8
+ @request = req
9
+ @headers = {}
10
+ @body = b
11
+ end
12
+ def return!(b)
13
+ @body ||= b
14
+ [status, prepare_headers, prepare_body]
15
+ end
16
+ def prepare_headers
17
+ add_header("ContentType", choose_response_type)
18
+ headers
19
+ end
20
+ def prepare_body
21
+ case request.request_type
22
+ when "json"
23
+ body.to_json
24
+ else
25
+ body.to_s
26
+ end
27
+ end
28
+ def add_header(k,v)
29
+ @headers[k] = v unless @headers.include?(k)
30
+ end
31
+ def status
32
+ @status ||= 200
33
+ end
34
+ def success!
35
+ @status = 200
36
+ end
37
+ def fail!
38
+ @status = 404
39
+ end
40
+ def choose_response_type
41
+ case request.request_type
42
+ when "json"
43
+ "application/json"
44
+ else
45
+ "text/plain"
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/butterfly.rb'}"
9
+ puts "Loading butterfly gem"
10
+ exec "#{irb} #{libs} --simple-prompt"