beanstalk-client 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -0
- data/{License.txt → LICENSE} +0 -0
- data/README.rdoc +20 -0
- data/Rakefile +36 -4
- data/VERSION +1 -0
- data/lib/beanstalk-client.rb +2 -0
- data/lib/beanstalk-client/connection.rb +48 -6
- data/lib/beanstalk-client/job.rb +24 -8
- data/lib/beanstalk-client/version.rb +1 -3
- data/test/helper.rb +9 -0
- data/test/test_beanstalk-client.rb +7 -12
- metadata +63 -57
- data/History.txt +0 -57
- data/Manifest.txt +0 -27
- data/README.txt +0 -1
- data/config/hoe.rb +0 -72
- data/config/requirements.rb +0 -17
- data/log/debug.log +0 -0
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/test_helper.rb +0 -2
- data/website/index.html +0 -145
data/tasks/deployment.rake
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
desc 'Release the website and new gem version'
|
2
|
-
task :deploy => [:check_version, :website, :release] do
|
3
|
-
puts "Remember to create SVN tag:"
|
4
|
-
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
-
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
-
puts "Suggested comment:"
|
7
|
-
puts "Tagging release #{CHANGES}"
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
-
task :local_deploy => [:website_generate, :install_gem]
|
12
|
-
|
13
|
-
task :check_version do
|
14
|
-
unless ENV['VERSION']
|
15
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
-
exit
|
17
|
-
end
|
18
|
-
unless ENV['VERSION'] == VERS
|
19
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
-
exit
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
-
task :install_gem_no_doc => [:clean, :package] do
|
26
|
-
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
-
end
|
28
|
-
|
29
|
-
namespace :manifest do
|
30
|
-
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
-
task :refresh do
|
32
|
-
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
-
end
|
34
|
-
end
|
data/tasks/environment.rake
DELETED
data/tasks/website.rake
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
desc 'Generate website files'
|
2
|
-
task :website_generate => :ruby_env do
|
3
|
-
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
-
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
desc 'Upload website files to rubyforge'
|
9
|
-
task :website_upload do
|
10
|
-
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
-
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
-
local_dir = 'website'
|
13
|
-
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Generate and upload website files'
|
17
|
-
task :website => [:website_generate, :website_upload, :publish_docs]
|
data/test/test_helper.rb
DELETED
data/website/index.html
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
-
<title>
|
8
|
-
Beanstalk Client
|
9
|
-
</title>
|
10
|
-
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
-
<style>
|
12
|
-
|
13
|
-
</style>
|
14
|
-
<script type="text/javascript">
|
15
|
-
window.onload = function() {
|
16
|
-
settings = {
|
17
|
-
tl: { radius: 10 },
|
18
|
-
tr: { radius: 10 },
|
19
|
-
bl: { radius: 10 },
|
20
|
-
br: { radius: 10 },
|
21
|
-
antiAlias: true,
|
22
|
-
autoPad: true,
|
23
|
-
validTags: ["div"]
|
24
|
-
}
|
25
|
-
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
-
versionBox.applyCornersToAll();
|
27
|
-
}
|
28
|
-
</script>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="main">
|
32
|
-
|
33
|
-
<h1>Beanstalk Client</h1>
|
34
|
-
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/beanstalk"; return false'>
|
35
|
-
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/beanstalk" class="numbers">1.0.2</a>
|
37
|
-
</div>
|
38
|
-
<h1>→ ‘beanstalk-client’</h1>
|
39
|
-
|
40
|
-
|
41
|
-
<h2>What</h2>
|
42
|
-
|
43
|
-
|
44
|
-
<p>This is a Ruby client library for the Beanstalk protocol.</p>
|
45
|
-
|
46
|
-
|
47
|
-
<p><a href="http://xph.us/software/beanstalkd/"><tt>beanstalkd</tt></a> is a fast,
|
48
|
-
distributed, in-memory work-queue service. Its interface is generic, but is
|
49
|
-
intended for use in reducing the latency of page views in high-volume web
|
50
|
-
applications by running most time-consuming tasks asynchronously.</p>
|
51
|
-
|
52
|
-
|
53
|
-
<h2>Installing</h2>
|
54
|
-
|
55
|
-
|
56
|
-
<p>First you must download and install the
|
57
|
-
<a href="http://xph.us/software/beanstalkd/"><tt>beanstalkd</tt></a> server.</p>
|
58
|
-
|
59
|
-
<p>Then just:</p>
|
60
|
-
|
61
|
-
<p><pre class='syntax'>sudo gem install beanstalk-client</pre></p>
|
62
|
-
|
63
|
-
|
64
|
-
<p>and you’re ready to go!</p>
|
65
|
-
|
66
|
-
<h2>How to use it</h2>
|
67
|
-
|
68
|
-
|
69
|
-
<p>Here’s an example of the low-level Ruby interface.</p>
|
70
|
-
|
71
|
-
|
72
|
-
<p>First, have one process put a job into the queue:</p>
|
73
|
-
|
74
|
-
|
75
|
-
<p><pre class='syntax'>
|
76
|
-
<span class="ident">beanstalk</span> <span class="punct">=</span> <span class="constant">Beanstalk</span><span class="punct">::</span><span class="constant">Pool</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(['</span><span class="string">localhost:11300</span><span class="punct">'])</span>
|
77
|
-
<span class="punct">...</span>
|
78
|
-
<span class="ident">beanstalk</span><span class="punct">.</span><span class="ident">put</span><span class="punct">('</span><span class="string">hello</span><span class="punct">')</span>
|
79
|
-
</pre></p>
|
80
|
-
|
81
|
-
|
82
|
-
<p>Then start another process to take jobs out of the queue and run them:</p>
|
83
|
-
|
84
|
-
|
85
|
-
<p><pre class='syntax'>
|
86
|
-
<span class="ident">beanstalk</span> <span class="punct">=</span> <span class="constant">Beanstalk</span><span class="punct">::</span><span class="constant">Pool</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(['</span><span class="string">localhost:11300</span><span class="punct">'])</span>
|
87
|
-
<span class="ident">loop</span> <span class="keyword">do</span>
|
88
|
-
<span class="ident">job</span> <span class="punct">=</span> <span class="ident">beanstalk</span><span class="punct">.</span><span class="ident">reserve</span>
|
89
|
-
<span class="ident">puts</span> <span class="ident">job</span><span class="punct">.</span><span class="ident">body</span> <span class="comment"># prints "hello"</span>
|
90
|
-
<span class="ident">job</span><span class="punct">.</span><span class="ident">delete</span>
|
91
|
-
<span class="keyword">end</span>
|
92
|
-
</pre></p>
|
93
|
-
|
94
|
-
|
95
|
-
<h2>Rails Integration</h2>
|
96
|
-
|
97
|
-
|
98
|
-
<p>But you very likely want to use this in a Rails project. In that case, you
|
99
|
-
should check out the <a href=http://async-observer.rubyforge.org/>Async
|
100
|
-
Observer Rails plugin</a>. It gives far more functionality and a
|
101
|
-
super-easy-to-use interface.</p>
|
102
|
-
|
103
|
-
|
104
|
-
<h2>Forum</h2>
|
105
|
-
|
106
|
-
|
107
|
-
<p>There’s a google group called
|
108
|
-
<a href="http://groups.google.com/group/beanstalk-talk">beanstalk-talk</a> for all
|
109
|
-
discussion regarding <tt>beanstalkd</tt> and the various client libraries.</p>
|
110
|
-
|
111
|
-
|
112
|
-
<h2>How to submit patches</h2>
|
113
|
-
|
114
|
-
|
115
|
-
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
|
116
|
-
|
117
|
-
|
118
|
-
<p>The repository is <code>http://xph.us/src/beanstalk-client-ruby.git</code> for anonymous access.</p>
|
119
|
-
|
120
|
-
|
121
|
-
<p>You can browse the repo at
|
122
|
-
<a href="http://xph.us/git/beanstalk-client-ruby/">http://xph.us/git/beanstalk-client-ruby/</a>.</p>
|
123
|
-
|
124
|
-
|
125
|
-
<h2>License</h2>
|
126
|
-
|
127
|
-
|
128
|
-
<p>You can share this code under the terms of the <span class="caps">GPL</span> version 3.</p>
|
129
|
-
|
130
|
-
|
131
|
-
<h2>Contact</h2>
|
132
|
-
|
133
|
-
|
134
|
-
<p>Comments are welcome. Send any questions or comments to the
|
135
|
-
<a href="http://groups.google.com/group/beanstalk-talk">beanstalk-talk</a> google group.</p>
|
136
|
-
<p class="coda">
|
137
|
-
<a href="mailto:kr@causes.com">Keith Rarick</a>, 27th May 2008<br>
|
138
|
-
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
139
|
-
</p>
|
140
|
-
</div>
|
141
|
-
|
142
|
-
<!-- insert site tracking codes here, like Google Urchin -->
|
143
|
-
|
144
|
-
</body>
|
145
|
-
</html>
|