m2r 2.0.2 → 2.1.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +11 -3
  4. data/Vagrantfile +16 -0
  5. data/example/http_0mq.rb +4 -0
  6. data/kitchen/Rakefile +28 -0
  7. data/kitchen/auth.cfg +2 -0
  8. data/kitchen/cookbooks/build-essential/README.md +24 -0
  9. data/kitchen/cookbooks/build-essential/metadata.json +35 -0
  10. data/kitchen/cookbooks/build-essential/metadata.rb +10 -0
  11. data/kitchen/cookbooks/build-essential/recipes/default.rb +45 -0
  12. data/kitchen/cookbooks/essential/CHANGELOG.md +12 -0
  13. data/kitchen/cookbooks/essential/README.md +12 -0
  14. data/kitchen/cookbooks/essential/metadata.json +29 -0
  15. data/kitchen/cookbooks/essential/metadata.rb +6 -0
  16. data/kitchen/cookbooks/essential/recipes/default.rb +16 -0
  17. data/kitchen/cookbooks/m2r/CHANGELOG.md +12 -0
  18. data/kitchen/cookbooks/m2r/README.md +12 -0
  19. data/kitchen/cookbooks/m2r/metadata.json +29 -0
  20. data/kitchen/cookbooks/m2r/metadata.rb +6 -0
  21. data/kitchen/cookbooks/m2r/recipes/default.rb +13 -0
  22. data/kitchen/cookbooks/mongrel2/CHANGELOG.md +12 -0
  23. data/kitchen/cookbooks/mongrel2/README.md +12 -0
  24. data/kitchen/cookbooks/mongrel2/metadata.json +29 -0
  25. data/kitchen/cookbooks/mongrel2/metadata.rb +6 -0
  26. data/kitchen/cookbooks/mongrel2/recipes/default.rb +38 -0
  27. data/kitchen/cookbooks/ruby-build/README.md +12 -0
  28. data/kitchen/cookbooks/ruby-build/definitions/ruby.rb +65 -0
  29. data/kitchen/cookbooks/ruby-build/metadata.json +29 -0
  30. data/kitchen/cookbooks/ruby-build/metadata.rb +6 -0
  31. data/kitchen/cookbooks/ruby-build/recipes/default.rb +9 -0
  32. data/kitchen/cookbooks/zmq/CHANGELOG.md +12 -0
  33. data/kitchen/cookbooks/zmq/README.md +12 -0
  34. data/kitchen/cookbooks/zmq/metadata.json +29 -0
  35. data/kitchen/cookbooks/zmq/metadata.rb +6 -0
  36. data/kitchen/cookbooks/zmq/recipes/default.rb +36 -0
  37. data/kitchen/data_bags/README +1 -0
  38. data/kitchen/data_bags/vagrant.key +27 -0
  39. data/kitchen/data_bags/vagrant.pub +1 -0
  40. data/kitchen/m2r.cfg +5 -0
  41. data/kitchen/nodes/m2r.local.json +16 -0
  42. data/kitchen/roles/.gitkeep +0 -0
  43. data/kitchen/site-cookbooks/README +1 -0
  44. data/lib/m2r.rb +2 -0
  45. data/lib/m2r/connection.rb +30 -5
  46. data/lib/m2r/handler.rb +8 -0
  47. data/lib/m2r/multithread_handler.rb +27 -0
  48. data/lib/m2r/parser.rb +44 -0
  49. data/lib/m2r/rack_handler.rb +0 -2
  50. data/lib/m2r/request.rb +2 -21
  51. data/lib/m2r/version.rb +1 -1
  52. data/lib/rack/handler/mongrel2.rb +7 -3
  53. data/m2r.gemspec +3 -3
  54. data/test/support/test_handler.rb +29 -12
  55. data/test/test_helper.rb +1 -1
  56. data/test/unit/connection_test.rb +51 -16
  57. data/test/unit/handler_test.rb +33 -5
  58. data/test/unit/m2r_test.rb +2 -0
  59. data/test/unit/multithread_handler_test.rb +75 -0
  60. data/test/unit/rack_handler_test.rb +6 -2
  61. data/test/unit/{request_test.rb → request_parsing_test.rb} +5 -5
  62. metadata +71 -62
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3f0f628d8db7c7de4625f0f42445f377c3ec9f5c
4
+ data.tar.gz: c356a75ae6cbdc2e7c4eff39e977abd887619cc4
5
+ SHA512:
6
+ metadata.gz: b4afde4794564c45b804289ead01320838d968d4e74a71abf002fdbcbac3c01e6786b01508eb0f63cd7da38004b317078ec396e4fdfc444143cd4c87a0c79a0f
7
+ data.tar.gz: 1d6dc2ce3668765acc617f5b8e61327db02b41c0aee29883832953b3a219ef89359a31f8a456baecddba81ec5b03f6d04747f7bb42d8d2f92c0af9e493ede2d7
data/.gitignore CHANGED
@@ -17,3 +17,4 @@ test/version_tmp
17
17
  tmp
18
18
  example/tmp
19
19
  example/config.sqlite
20
+ .vagrant
@@ -2,14 +2,14 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 1.9.2
5
+ - 2.0.0
5
6
  - ruby-head
6
7
  - jruby-19mode
7
8
  - jruby-head
8
9
  - rbx-19mode
9
10
 
10
11
  env:
11
- - PATH=/opt/mongrel2-1.7.5/bin:$PATH
12
- - PATH=/opt/mongrel2-1.8.0/bin:$PATH
12
+ - PATH=/opt/mongrel2-1.8.1/bin:$PATH
13
13
 
14
14
  matrix:
15
15
  allow_failures:
@@ -20,4 +20,12 @@ notifications:
20
20
  irc: "irc.freenode.org#mongrel2-ruby"
21
21
 
22
22
  before_install:
23
- - curl -o - https://raw.github.com/gist/3690228/329913ac81c8749dadcc08e220a62c33a8a51897/make_everything_ok.sh 2>/dev/null | sh 2>/dev/null 1>/dev/null
23
+ - sudo apt-get install -qq libzmq3-dev
24
+ - mkdir mongrel2-1.8.1
25
+ - curl -L https://github.com/zedshaw/mongrel2/archive/v1.8.1.tar.gz -o - |tar --strip-components=1 -C mongrel2-1.8.1 -zxvf -
26
+ - pushd mongrel2-1.8.1
27
+ - make PREFIX=/opt/mongrel2-1.8.1
28
+ - sudo make install PREFIX=/opt/mongrel2-1.8.1
29
+ - popd
30
+
31
+ script: bundle exec rake
@@ -0,0 +1,16 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ Vagrant::Config.run do |multi|
5
+ multi.vm.define :m2r do |config|
6
+ config.vm.box = "m2r"
7
+ config.vm.box_url = "http://files.vagrantup.com/precise32.box"
8
+
9
+ config.vm.host_name = "m2r.local"
10
+ config.vm.network :hostonly, "172.26.66.100"
11
+ config.vm.share_folder "v-root", "/home/vagrant/current", "."
12
+
13
+ config.vm.customize ["modifyvm", :id, "--memory", 512]
14
+ config.ssh.forward_agent = true
15
+ end
16
+ end
@@ -54,5 +54,9 @@ pub_port = "tcp://127.0.0.1:9998"
54
54
 
55
55
  factory = M2R::ConnectionFactory.new M2R::ConnectionFactory::Options.new(sender_id, pull_port, pub_port)
56
56
  handler = Http0MQHandler.new(factory, M2R::Request)
57
+ graceful = Proc.new { handler.stop }
58
+ trap("INT", &graceful)
59
+ trap("TERM", &graceful)
57
60
  handler.listen
61
+ M2R.zmq_context.terminate
58
62
 
@@ -0,0 +1,28 @@
1
+ COOKBOOKS_DIR = File.expand_path('../cookbooks', __FILE__)
2
+ ROLE_DIR = File.expand_path('../roles', __FILE__)
3
+
4
+ require 'chef'
5
+ require 'posix/spawn'
6
+
7
+ namespace :roles do
8
+ desc "Convert ruby roles from ruby to json, creating/overwriting json files."
9
+ task :to_json do
10
+ Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file|
11
+ role = Chef::Role.new
12
+ role.from_file(rb_file)
13
+ json_file = rb_file.sub(/\.rb$/,'.json')
14
+ File.open(json_file, 'w'){|f| f.write(JSON.pretty_generate(role))}
15
+ end
16
+ end
17
+ end
18
+
19
+ namespace :metadata do
20
+ desc "Convert all metadata from ruby to json."
21
+ task :to_json do
22
+ Dir.glob(File.join(COOKBOOKS_DIR, '*/metadata.rb')) do |rb_file|
23
+ path = rb_file.split('/')[-3]
24
+ recipe = rb_file.split('/')[-2]
25
+ POSIX::Spawn::spawn("knife cookbook metadata -o #{path} #{recipe}")
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,2 @@
1
+ [userinfo]
2
+ ssh-config = m2r.cfg
@@ -0,0 +1,24 @@
1
+ DESCRIPTION
2
+ ===========
3
+
4
+ Installs packages required for compiling C software from source.
5
+
6
+ LICENSE AND AUTHOR
7
+ ==================
8
+
9
+ Author:: Joshua Timberman (<joshua@opscode.com>)
10
+ Author:: Seth Chisamore (<schisamo@opscode.com>)
11
+
12
+ Copyright 2009-2011, Opscode, Inc.
13
+
14
+ Licensed under the Apache License, Version 2.0 (the "License");
15
+ you may not use this file except in compliance with the License.
16
+ You may obtain a copy of the License at
17
+
18
+ http://www.apache.org/licenses/LICENSE-2.0
19
+
20
+ Unless required by applicable law or agreed to in writing, software
21
+ distributed under the License is distributed on an "AS IS" BASIS,
22
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ See the License for the specific language governing permissions and
24
+ limitations under the License.
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "build-essential",
3
+ "description": "Installs C compiler / build tools",
4
+ "long_description": "",
5
+ "maintainer": "Opscode, Inc.",
6
+ "maintainer_email": "cookbooks@opscode.com",
7
+ "license": "Apache 2.0",
8
+ "platforms": {
9
+ "fedora": ">= 0.0.0",
10
+ "redhat": ">= 0.0.0",
11
+ "centos": ">= 0.0.0",
12
+ "ubuntu": ">= 0.0.0",
13
+ "debian": ">= 0.0.0"
14
+ },
15
+ "dependencies": {
16
+ },
17
+ "recommendations": {
18
+ },
19
+ "suggestions": {
20
+ },
21
+ "conflicting": {
22
+ },
23
+ "providing": {
24
+ },
25
+ "replacing": {
26
+ },
27
+ "attributes": {
28
+ },
29
+ "groupings": {
30
+ },
31
+ "recipes": {
32
+ "build-essential": "Installs C compiler and build tools on Linux"
33
+ },
34
+ "version": "1.0.0"
35
+ }
@@ -0,0 +1,10 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs C compiler / build tools"
5
+ version "1.0.0"
6
+ recipe "build-essential", "Installs C compiler and build tools on Linux"
7
+
8
+ %w{ fedora redhat centos ubuntu debian }.each do |os|
9
+ supports os
10
+ end
@@ -0,0 +1,45 @@
1
+ #
2
+ # Cookbook Name:: build-essential
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2008-2009, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ case node['platform']
21
+ when "ubuntu","debian"
22
+ %w{build-essential binutils-doc}.each do |pkg|
23
+ package pkg do
24
+ action :install
25
+ end
26
+ end
27
+ when "centos","redhat","fedora"
28
+ %w{gcc gcc-c++ kernel-devel make}.each do |pkg|
29
+ package pkg do
30
+ action :install
31
+ end
32
+ end
33
+ end
34
+
35
+ package "autoconf" do
36
+ action :install
37
+ end
38
+
39
+ package "flex" do
40
+ action :install
41
+ end
42
+
43
+ package "bison" do
44
+ action :install
45
+ end
@@ -0,0 +1,12 @@
1
+ # CHANGELOG for essential
2
+
3
+ This file is used to list changes made in each version of essential.
4
+
5
+ ## 0.1.0:
6
+
7
+ * Initial release of essential
8
+
9
+ - - -
10
+ Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
11
+
12
+ The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
@@ -0,0 +1,12 @@
1
+ Description
2
+ ===========
3
+
4
+ Requirements
5
+ ============
6
+
7
+ Attributes
8
+ ==========
9
+
10
+ Usage
11
+ =====
12
+
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "essential",
3
+ "description": "Installs/Configures essential",
4
+ "long_description": "Description\n===========\n\nRequirements\n============\n\nAttributes\n==========\n\nUsage\n=====\n\n",
5
+ "maintainer": "YOUR_COMPANY_NAME",
6
+ "maintainer_email": "YOUR_EMAIL",
7
+ "license": "All rights reserved",
8
+ "platforms": {
9
+ },
10
+ "dependencies": {
11
+ },
12
+ "recommendations": {
13
+ },
14
+ "suggestions": {
15
+ },
16
+ "conflicting": {
17
+ },
18
+ "providing": {
19
+ },
20
+ "replacing": {
21
+ },
22
+ "attributes": {
23
+ },
24
+ "groupings": {
25
+ },
26
+ "recipes": {
27
+ },
28
+ "version": "0.1.0"
29
+ }
@@ -0,0 +1,6 @@
1
+ maintainer "YOUR_COMPANY_NAME"
2
+ maintainer_email "YOUR_EMAIL"
3
+ license "All rights reserved"
4
+ description "Installs/Configures essential"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6
+ version "0.1.0"
@@ -0,0 +1,16 @@
1
+ #
2
+ # Cookbook Name:: essential
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2012, YOUR_COMPANY_NAME
6
+ #
7
+ # All rights reserved - Do Not Redistribute
8
+ #
9
+
10
+ package 'htop' do
11
+ action :install
12
+ end
13
+
14
+ package 'vim' do
15
+ action :install
16
+ end
@@ -0,0 +1,12 @@
1
+ # CHANGELOG for m2r
2
+
3
+ This file is used to list changes made in each version of m2r.
4
+
5
+ ## 0.1.0:
6
+
7
+ * Initial release of m2r
8
+
9
+ - - -
10
+ Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
11
+
12
+ The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
@@ -0,0 +1,12 @@
1
+ Description
2
+ ===========
3
+
4
+ Requirements
5
+ ============
6
+
7
+ Attributes
8
+ ==========
9
+
10
+ Usage
11
+ =====
12
+
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "m2r",
3
+ "description": "Installs/Configures m2r",
4
+ "long_description": "Description\n===========\n\nRequirements\n============\n\nAttributes\n==========\n\nUsage\n=====\n\n",
5
+ "maintainer": "YOUR_COMPANY_NAME",
6
+ "maintainer_email": "YOUR_EMAIL",
7
+ "license": "All rights reserved",
8
+ "platforms": {
9
+ },
10
+ "dependencies": {
11
+ },
12
+ "recommendations": {
13
+ },
14
+ "suggestions": {
15
+ },
16
+ "conflicting": {
17
+ },
18
+ "providing": {
19
+ },
20
+ "replacing": {
21
+ },
22
+ "attributes": {
23
+ },
24
+ "groupings": {
25
+ },
26
+ "recipes": {
27
+ },
28
+ "version": "0.1.0"
29
+ }
@@ -0,0 +1,6 @@
1
+ maintainer "YOUR_COMPANY_NAME"
2
+ maintainer_email "YOUR_EMAIL"
3
+ license "All rights reserved"
4
+ description "Installs/Configures m2r"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6
+ version "0.1.0"
@@ -0,0 +1,13 @@
1
+ #
2
+ # Cookbook Name:: m2r
3
+ # Recipe:: default
4
+ #
5
+ # Copyright 2012, YOUR_COMPANY_NAME
6
+ #
7
+ # All rights reserved - Do Not Redistribute
8
+ #
9
+
10
+ ruby "1.9.3" do
11
+ version "1.9.3-p327"
12
+ home "/home/vagrant/"
13
+ end
@@ -0,0 +1,12 @@
1
+ # CHANGELOG for mongrel2
2
+
3
+ This file is used to list changes made in each version of mongrel2.
4
+
5
+ ## 0.1.0:
6
+
7
+ * Initial release of mongrel2
8
+
9
+ - - -
10
+ Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
11
+
12
+ The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
@@ -0,0 +1,12 @@
1
+ Description
2
+ ===========
3
+
4
+ Requirements
5
+ ============
6
+
7
+ Attributes
8
+ ==========
9
+
10
+ Usage
11
+ =====
12
+
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "mongrel2",
3
+ "description": "Installs/Configures mongrel2",
4
+ "long_description": "Description\n===========\n\nRequirements\n============\n\nAttributes\n==========\n\nUsage\n=====\n\n",
5
+ "maintainer": "YOUR_COMPANY_NAME",
6
+ "maintainer_email": "YOUR_EMAIL",
7
+ "license": "All rights reserved",
8
+ "platforms": {
9
+ },
10
+ "dependencies": {
11
+ },
12
+ "recommendations": {
13
+ },
14
+ "suggestions": {
15
+ },
16
+ "conflicting": {
17
+ },
18
+ "providing": {
19
+ },
20
+ "replacing": {
21
+ },
22
+ "attributes": {
23
+ },
24
+ "groupings": {
25
+ },
26
+ "recipes": {
27
+ },
28
+ "version": "0.1.0"
29
+ }