evdispatch 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +96 -0
  4. data/README.txt +73 -0
  5. data/Rakefile +4 -0
  6. data/config/hoe.rb +70 -0
  7. data/config/requirements.rb +15 -0
  8. data/ext/revdispatch/extconf.rb +31 -0
  9. data/ext/revdispatch/libevdispatch/Changelog +0 -0
  10. data/ext/revdispatch/libevdispatch/LICENSE +0 -0
  11. data/ext/revdispatch/libevdispatch/Makefile.am +10 -0
  12. data/ext/revdispatch/libevdispatch/Makefile.in +637 -0
  13. data/ext/revdispatch/libevdispatch/README +3 -0
  14. data/ext/revdispatch/libevdispatch/TODO +5 -0
  15. data/ext/revdispatch/libevdispatch/aclocal.m4 +7459 -0
  16. data/ext/revdispatch/libevdispatch/autogen.sh +11 -0
  17. data/ext/revdispatch/libevdispatch/confdefs.h +32 -0
  18. data/ext/revdispatch/libevdispatch/config.guess +1516 -0
  19. data/ext/revdispatch/libevdispatch/config.h.in +112 -0
  20. data/ext/revdispatch/libevdispatch/config.sub +1626 -0
  21. data/ext/revdispatch/libevdispatch/configure +21949 -0
  22. data/ext/revdispatch/libevdispatch/configure.ac +40 -0
  23. data/ext/revdispatch/libevdispatch/depcomp +584 -0
  24. data/ext/revdispatch/libevdispatch/install-sh +507 -0
  25. data/ext/revdispatch/libevdispatch/libev/Changes +54 -0
  26. data/ext/revdispatch/libevdispatch/libev/LICENSE +25 -0
  27. data/ext/revdispatch/libevdispatch/libev/Makefile.am +18 -0
  28. data/ext/revdispatch/libevdispatch/libev/Makefile.in +677 -0
  29. data/ext/revdispatch/libevdispatch/libev/README +130 -0
  30. data/ext/revdispatch/libevdispatch/libev/aclocal.m4 +7430 -0
  31. data/ext/revdispatch/libevdispatch/libev/autogen.sh +7 -0
  32. data/ext/revdispatch/libevdispatch/libev/config.guess +1516 -0
  33. data/ext/revdispatch/libevdispatch/libev/config.h.in +106 -0
  34. data/ext/revdispatch/libevdispatch/libev/config.sub +1626 -0
  35. data/ext/revdispatch/libevdispatch/libev/configure +21636 -0
  36. data/ext/revdispatch/libevdispatch/libev/configure.ac +18 -0
  37. data/ext/revdispatch/libevdispatch/libev/ev++.h +779 -0
  38. data/ext/revdispatch/libevdispatch/libev/ev.3 +3276 -0
  39. data/ext/revdispatch/libevdispatch/libev/ev.c +2547 -0
  40. data/ext/revdispatch/libevdispatch/libev/ev.h +608 -0
  41. data/ext/revdispatch/libevdispatch/libev/ev.pod +3192 -0
  42. data/ext/revdispatch/libevdispatch/libev/ev_epoll.c +182 -0
  43. data/ext/revdispatch/libevdispatch/libev/ev_kqueue.c +194 -0
  44. data/ext/revdispatch/libevdispatch/libev/ev_poll.c +135 -0
  45. data/ext/revdispatch/libevdispatch/libev/ev_port.c +163 -0
  46. data/ext/revdispatch/libevdispatch/libev/ev_select.c +244 -0
  47. data/ext/revdispatch/libevdispatch/libev/ev_vars.h +157 -0
  48. data/ext/revdispatch/libevdispatch/libev/ev_win32.c +125 -0
  49. data/ext/revdispatch/libevdispatch/libev/ev_wrap.h +144 -0
  50. data/ext/revdispatch/libevdispatch/libev/event.c +404 -0
  51. data/ext/revdispatch/libevdispatch/libev/event.h +152 -0
  52. data/ext/revdispatch/libevdispatch/libev/install-sh +294 -0
  53. data/ext/revdispatch/libevdispatch/libev/libev.m4 +28 -0
  54. data/ext/revdispatch/libevdispatch/libev/ltmain.sh +6930 -0
  55. data/ext/revdispatch/libevdispatch/libev/missing +336 -0
  56. data/ext/revdispatch/libevdispatch/libev/mkinstalldirs +111 -0
  57. data/ext/revdispatch/libevdispatch/ltmain.sh +6930 -0
  58. data/ext/revdispatch/libevdispatch/missing +367 -0
  59. data/ext/revdispatch/libevdispatch/src/Makefile.am +11 -0
  60. data/ext/revdispatch/libevdispatch/src/Makefile.in +486 -0
  61. data/ext/revdispatch/libevdispatch/src/ev_dispatch.cc +264 -0
  62. data/ext/revdispatch/libevdispatch/src/ev_dispatch.h +300 -0
  63. data/ext/revdispatch/libevdispatch/src/ev_http.cc +238 -0
  64. data/ext/revdispatch/libevdispatch/src/ev_http.h +65 -0
  65. data/ext/revdispatch/libevdispatch/test/Makefile.am +16 -0
  66. data/ext/revdispatch/libevdispatch/test/Makefile.in +513 -0
  67. data/ext/revdispatch/libevdispatch/test/helper.rb +94 -0
  68. data/ext/revdispatch/libevdispatch/test/key_test.cc +52 -0
  69. data/ext/revdispatch/libevdispatch/test/next_test.cc +86 -0
  70. data/ext/revdispatch/libevdispatch/test/next_test.rb +8 -0
  71. data/ext/revdispatch/libevdispatch/test/server.rb +9 -0
  72. data/ext/revdispatch/revdispatch.cc +151 -0
  73. data/ext/revdispatch/server.rb +60 -0
  74. data/ext/revdispatch/test.rb +100 -0
  75. data/lib/evdispatch/loop.rb +16 -0
  76. data/lib/evdispatch/version.rb +9 -0
  77. data/lib/evdispatch.rb +8 -0
  78. data/log/debug.log +0 -0
  79. data/script/console +10 -0
  80. data/script/destroy +14 -0
  81. data/script/generate +14 -0
  82. data/script/txt2html +74 -0
  83. data/setup.rb +1585 -0
  84. data/tasks/deployment.rake +34 -0
  85. data/tasks/environment.rake +7 -0
  86. data/tasks/extconf/revdispatch.rake +43 -0
  87. data/tasks/extconf.rake +13 -0
  88. data/tasks/website.rake +17 -0
  89. data/test/test_evdispatch.rb +11 -0
  90. data/test/test_helper.rb +3 -0
  91. data/test/test_revdispatch_extn.rb +14 -0
  92. data/website/index.html +128 -0
  93. data/website/index.txt +55 -0
  94. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  95. data/website/stylesheets/screen.css +138 -0
  96. data/website/template.html.erb +49 -0
  97. metadata +157 -0
data/History.txt ADDED
@@ -0,0 +1,3 @@
1
+ == 0.0.1 2008-04-10
2
+
3
+ * Initial release
data/License.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Todd A. Fisher
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,96 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ config/hoe.rb
7
+ config/requirements.rb
8
+ lib/evdispatch.rb
9
+ lib/evdispatch/version.rb
10
+ lib/evdispatch/loop.rb
11
+ log/debug.log
12
+ script/console
13
+ script/destroy
14
+ script/generate
15
+ script/txt2html
16
+ setup.rb
17
+ tasks/deployment.rake
18
+ tasks/environment.rake
19
+ tasks/website.rake
20
+ tasks/extconf.rake
21
+ tasks/extconf/revdispatch.rake
22
+ test/test_revdispatch_extn.rb
23
+ test/test_evdispatch.rb
24
+ test/test_helper.rb
25
+ website/index.html
26
+ website/index.txt
27
+ website/javascripts/rounded_corners_lite.inc.js
28
+ website/stylesheets/screen.css
29
+ website/template.html.erb
30
+ ext/revdispatch/revdispatch.cc
31
+ ext/revdispatch/extconf.rb
32
+ ext/revdispatch/libevdispatch/Changelog
33
+ ext/revdispatch/libevdispatch/LICENSE
34
+ ext/revdispatch/libevdispatch/Makefile.am
35
+ ext/revdispatch/libevdispatch/Makefile.in
36
+ ext/revdispatch/libevdispatch/README
37
+ ext/revdispatch/libevdispatch/TODO
38
+ ext/revdispatch/libevdispatch/aclocal.m4
39
+ ext/revdispatch/libevdispatch/autogen.sh
40
+ ext/revdispatch/libevdispatch/confdefs.h
41
+ ext/revdispatch/libevdispatch/config.guess
42
+ ext/revdispatch/libevdispatch/config.h.in
43
+ ext/revdispatch/libevdispatch/config.sub
44
+ ext/revdispatch/libevdispatch/configure
45
+ ext/revdispatch/libevdispatch/configure.ac
46
+ ext/revdispatch/libevdispatch/depcomp
47
+ ext/revdispatch/libevdispatch/install-sh
48
+ ext/revdispatch/libevdispatch/libev/Changes
49
+ ext/revdispatch/libevdispatch/libev/LICENSE
50
+ ext/revdispatch/libevdispatch/libev/Makefile.am
51
+ ext/revdispatch/libevdispatch/libev/Makefile.in
52
+ ext/revdispatch/libevdispatch/libev/README
53
+ ext/revdispatch/libevdispatch/libev/aclocal.m4
54
+ ext/revdispatch/libevdispatch/libev/autogen.sh
55
+ ext/revdispatch/libevdispatch/libev/config.guess
56
+ ext/revdispatch/libevdispatch/libev/config.h.in
57
+ ext/revdispatch/libevdispatch/libev/config.sub
58
+ ext/revdispatch/libevdispatch/libev/configure
59
+ ext/revdispatch/libevdispatch/libev/configure.ac
60
+ ext/revdispatch/libevdispatch/libev/ev++.h
61
+ ext/revdispatch/libevdispatch/libev/ev.3
62
+ ext/revdispatch/libevdispatch/libev/ev.c
63
+ ext/revdispatch/libevdispatch/libev/ev.h
64
+ ext/revdispatch/libevdispatch/libev/ev.pod
65
+ ext/revdispatch/libevdispatch/libev/ev_epoll.c
66
+ ext/revdispatch/libevdispatch/libev/ev_kqueue.c
67
+ ext/revdispatch/libevdispatch/libev/ev_poll.c
68
+ ext/revdispatch/libevdispatch/libev/ev_port.c
69
+ ext/revdispatch/libevdispatch/libev/ev_select.c
70
+ ext/revdispatch/libevdispatch/libev/ev_vars.h
71
+ ext/revdispatch/libevdispatch/libev/ev_win32.c
72
+ ext/revdispatch/libevdispatch/libev/ev_wrap.h
73
+ ext/revdispatch/libevdispatch/libev/event.c
74
+ ext/revdispatch/libevdispatch/libev/event.h
75
+ ext/revdispatch/libevdispatch/libev/install-sh
76
+ ext/revdispatch/libevdispatch/libev/libev.m4
77
+ ext/revdispatch/libevdispatch/libev/ltmain.sh
78
+ ext/revdispatch/libevdispatch/libev/missing
79
+ ext/revdispatch/libevdispatch/libev/mkinstalldirs
80
+ ext/revdispatch/libevdispatch/ltmain.sh
81
+ ext/revdispatch/libevdispatch/missing
82
+ ext/revdispatch/libevdispatch/src/Makefile.am
83
+ ext/revdispatch/libevdispatch/src/Makefile.in
84
+ ext/revdispatch/libevdispatch/src/ev_dispatch.cc
85
+ ext/revdispatch/libevdispatch/src/ev_dispatch.h
86
+ ext/revdispatch/libevdispatch/src/ev_http.cc
87
+ ext/revdispatch/libevdispatch/src/ev_http.h
88
+ ext/revdispatch/libevdispatch/test/Makefile.am
89
+ ext/revdispatch/libevdispatch/test/Makefile.in
90
+ ext/revdispatch/libevdispatch/test/helper.rb
91
+ ext/revdispatch/libevdispatch/test/key_test.cc
92
+ ext/revdispatch/libevdispatch/test/next_test.cc
93
+ ext/revdispatch/libevdispatch/test/next_test.rb
94
+ ext/revdispatch/libevdispatch/test/server.rb
95
+ ext/revdispatch/server.rb
96
+ ext/revdispatch/test.rb
data/README.txt ADDED
@@ -0,0 +1,73 @@
1
+ = evdispatch
2
+
3
+ * http://rubyforge.org/projects/evdispatch/
4
+
5
+ == DESCRIPTION:
6
+
7
+ A high performance event based network request library. Send requests to a
8
+ background thread running an event loop based on libev. Designed to make
9
+ multiple simultaneous requests while performing other foreground tasks.
10
+
11
+ == FEATURES
12
+
13
+ * Support high concurrency HTTP requests
14
+
15
+ == PROBLEMS:
16
+
17
+ * Add support to select responses from a pipe instead of having it all buffer
18
+ directly in memory
19
+
20
+ == SYNOPSIS:
21
+
22
+ FIX (code sample of usage)
23
+
24
+ == REQUIREMENTS:
25
+
26
+ Using ruby dispatch interface:
27
+
28
+ require 'evdispatch'
29
+
30
+ # create a new dispatch loop
31
+ d = Evdispatch::Loop.new
32
+
33
+ # start the event loop thread
34
+
35
+ # send a dispatch http request and store a handle to the request
36
+ google_id = d.request_http("http://www.google.com/")
37
+
38
+ # do some processing and later on check for the response
39
+ response = d.response( google_id )
40
+
41
+ puts response[:body]
42
+
43
+ # sometime later you can stop the event loop
44
+ d.stop
45
+
46
+ == INSTALL:
47
+
48
+ sudo gem install evdispatch
49
+
50
+ == LICENSE:
51
+
52
+ (The MIT License)
53
+
54
+ Copyright (c) 2008 Todd A. Fisher
55
+
56
+ Permission is hereby granted, free of charge, to any person obtaining
57
+ a copy of this software and associated documentation files (the
58
+ 'Software'), to deal in the Software without restriction, including
59
+ without limitation the rights to use, copy, modify, merge, publish,
60
+ distribute, sublicense, and/or sell copies of the Software, and to
61
+ permit persons to whom the Software is furnished to do so, subject to
62
+ the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be
65
+ included in all copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
68
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
69
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
70
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
71
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
72
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
73
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/config/hoe.rb ADDED
@@ -0,0 +1,70 @@
1
+ require 'evdispatch/version'
2
+
3
+ AUTHOR = 'Todd A. Fisher' # can also be an array of Authors
4
+ EMAIL = 'todd.fisher@gmail.com'
5
+ DESCRIPTION = 'Based on libev provides a background event loop for making simulataneous requests'
6
+ GEM_NAME = 'evdispatch' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'evdispatch' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+
11
+ @config_file = "~/.rubyforge/user-config.yml"
12
+ @config = nil
13
+ RUBYFORGE_USERNAME = "taf2"
14
+ def rubyforge_username
15
+ unless @config
16
+ begin
17
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
18
+ rescue
19
+ puts <<-EOS
20
+ ERROR: No rubyforge config file found: #{@config_file}
21
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
22
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
23
+ EOS
24
+ exit
25
+ end
26
+ end
27
+ RUBYFORGE_USERNAME.replace @config["username"]
28
+ end
29
+
30
+
31
+ REV = nil
32
+ # UNCOMMENT IF REQUIRED:
33
+ # REV = YAML.load(`svn info`)['Revision']
34
+ VERS = Evdispatch::VERSION::STRING + (REV ? ".#{REV}" : "")
35
+ RDOC_OPTS = ['--quiet', '--title', 'evdispatch documentation',
36
+ "--opname", "index.html",
37
+ "--line-numbers",
38
+ "--main", "README",
39
+ "--inline-source"]
40
+
41
+ class Hoe
42
+ def extra_deps
43
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
44
+ @extra_deps
45
+ end
46
+ end
47
+
48
+ # Generate all the Rake tasks
49
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
50
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
51
+ p.developer(AUTHOR, EMAIL)
52
+ p.description = DESCRIPTION
53
+ p.summary = DESCRIPTION
54
+ p.url = HOMEPATH
55
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
56
+ p.test_globs = ["test/**/test_*.rb"]
57
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
58
+
59
+ # == Optional
60
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
61
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
62
+
63
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
64
+
65
+ end
66
+
67
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
68
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
69
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
70
+ $hoe.rsync_args = '-av --delete --ignore-errors'
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -0,0 +1,31 @@
1
+ require 'mkmf'
2
+
3
+ if !File.exist?("libevdispatch/src/.libs") or !File.exist?("libevdispatch/libev/.libs")
4
+ system("chmod a+x libevdispatch/configure")
5
+ system("chmod a+x libevdispatch/autogen.sh")
6
+ system("chmod a+x libevdispatch/libev/configure")
7
+ system("chmod a+x libevdispatch/libev/autogen.sh")
8
+ # configure and build libev and libevdispatch we'll link against the static libraries
9
+ if !system("cd libevdispatch && ./autogen.sh && ./configure && make")
10
+ STDERR.puts "Failed to compile libevdispatcher"
11
+ exit(1)
12
+ end
13
+ end
14
+
15
+ $srcs = ['revdispatch.cc']
16
+ $objs = ['revdispatch.o']
17
+
18
+ # put the header files first
19
+ $CPPFLAGS = " -I./libevdispatch/ -I./libevdispatch/src -I./libevdispatch/libev/ #{$CPPFLAGS}"
20
+
21
+ # link to the static library versions of libdispatch and libev
22
+ $LDFLAGS << " ./libevdispatch/src/.libs/libdispatch.a ./libevdispatch/libev/.libs/libev.a "
23
+
24
+ dir_config("revdispatch")
25
+ have_library("c", "main")
26
+ have_library("stdc++", "main")
27
+ have_library("rt", "clock_gettime")
28
+ have_library("pthread", "pthread_create")
29
+ have_library("curl", "curl_easy_init")
30
+
31
+ create_makefile("revdispatch")
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ AUTOMAKE_OPTIONS=foreign no-dependencies
2
+
3
+ VERSION_INFO = 0:1
4
+
5
+ EXTRA_DIST=LICENSE Changes autogen.sh \
6
+ src/ev_dispatch.h src/ev_dispatch.cc \
7
+ src/ev_http.h src/ev_http.cc \
8
+ test/next_test.cc test/key_test.cc
9
+
10
+ SUBDIRS=src test