kjess 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/{HISTORY.rdoc → HISTORY.md} +9 -3
- data/Manifest.txt +5 -2
- data/{README.rdoc → README.md} +9 -9
- data/Rakefile +5 -334
- data/lib/kjess.rb +1 -1
- data/lib/kjess/client.rb +4 -4
- data/lib/kjess/connection.rb +38 -7
- data/lib/kjess/error.rb +5 -2
- data/lib/kjess/response/error.rb +1 -1
- data/lib/kjess/response/stats.rb +1 -1
- data/lib/kjess/socket.rb +19 -10
- data/spec/client_spec.rb +3 -3
- data/spec/connection_spec.rb +15 -0
- data/tasks/default.rake +271 -0
- data/tasks/this.rb +209 -0
- metadata +17 -24
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NThhODY1MzZlNTE5MWZhZDI4ZGYzYTZmZjg3NTIxYTlmZjYxZDEwYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZWM3NjkwNzczNDM4ZWIzNzA5MmNlYzE0ZjQwZTdiM2ZmOTJlZjczMg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTA0NDVhYmE4MTdiNTdjZjM4NjdmNzkyNzUwOWM2MTQyMjI5MzQ4MTU3Y2Rk
|
10
|
+
N2IwNDEyNDU1Mzk2ZThiYjBiZWE1NDE2MTIzNTg3NWUzNjkxOWUwOGJkYzBj
|
11
|
+
NjRiOGVmNTcxOTQ2ZTA4MjExYWEyM2EzMzcwNWM2MjA4NWM2NmU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
M2Q3MGNhNzdlM2RlOTM4OGI0ZmFhNjkxMzhlZjQ3ZTJhNmE1MGIxNzI0MGQ4
|
14
|
+
ZGIzNmY3NzE2MDRkZTQ0Zjk1NTYxM2JmZGQxMGVhY2E2MDQ5YWExMDA1NTJl
|
15
|
+
NGQ1NjgzNGQ5MTE2MzQzYmFlMTFkNDYxODhiMzc0ZGUzMDA4NDM=
|
data/{HISTORY.rdoc → HISTORY.md}
RENAMED
@@ -1,6 +1,12 @@
|
|
1
|
-
|
1
|
+
# KJess Changlog
|
2
2
|
|
3
|
-
|
3
|
+
## Version 1.2.0 - 2013-07-08
|
4
|
+
|
5
|
+
* Allow for setting a socket factory on the Connection (eric)
|
6
|
+
* Connections only raise Connection::Error (eric)
|
7
|
+
* Refactor Error hierarchy [#19]
|
8
|
+
|
9
|
+
## Version 1.1.0 - 2013-01-08
|
4
10
|
|
5
11
|
* Allow the setting of the kestrel server processes ports for testing (eric)
|
6
12
|
* Update development dependencies, new version and missing gems
|
@@ -10,7 +16,7 @@
|
|
10
16
|
* Added socket timeout feature (eric)
|
11
17
|
* Added support for tcp keepalive
|
12
18
|
|
13
|
-
|
19
|
+
## Version 1.0.0 - 2012-10-31
|
14
20
|
|
15
21
|
* Initial Release - Yeah!
|
16
22
|
|
data/Manifest.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
CONTRIBUTING.md
|
2
|
-
HISTORY.
|
2
|
+
HISTORY.md
|
3
3
|
LICENSE
|
4
4
|
Manifest.txt
|
5
|
-
README.
|
5
|
+
README.md
|
6
6
|
Rakefile
|
7
7
|
example/client_test.rb
|
8
8
|
lib/kjess.rb
|
@@ -44,6 +44,7 @@ lib/kjess/response/version.rb
|
|
44
44
|
lib/kjess/socket.rb
|
45
45
|
lib/kjess/stats_cache.rb
|
46
46
|
spec/client_spec.rb
|
47
|
+
spec/connection_spec.rb
|
47
48
|
spec/kestrel_server.rb
|
48
49
|
spec/request/set_spec.rb
|
49
50
|
spec/request/version_spec.rb
|
@@ -52,4 +53,6 @@ spec/response/client_error_spec.rb
|
|
52
53
|
spec/spec_helper.rb
|
53
54
|
spec/utils.rb
|
54
55
|
spec/version_spec.rb
|
56
|
+
tasks/default.rake
|
55
57
|
tasks/kestrel.rake
|
58
|
+
tasks/this.rb
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,19 +1,19 @@
|
|
1
|
-
|
1
|
+
# KJess
|
2
2
|
|
3
|
-
* Homepage
|
4
|
-
*
|
5
|
-
* email jeremy at
|
3
|
+
* [Homepage](https://github.com/copiousfreetime/kjess/)
|
4
|
+
* [Github Project](https://github.com/copiousfreetime/kjess)
|
5
|
+
* email jeremy at copiousfreetime dot org
|
6
6
|
|
7
|
-
|
7
|
+
## DESCRIPTION
|
8
8
|
|
9
9
|
KJess is a pure ruby Kestrel client that supports Kestrel's Memcache style
|
10
10
|
protocol.
|
11
11
|
|
12
|
-
|
12
|
+
## FEATURES
|
13
13
|
|
14
14
|
A pure ruby native client to Kestrel.
|
15
15
|
|
16
|
-
|
16
|
+
## Examples
|
17
17
|
|
18
18
|
client = Kestrel::Client.new( 'k.example.com' )
|
19
19
|
client.set( 'my_queue', 'item' ) # put an 'item' on 'my_queue'
|
@@ -25,9 +25,9 @@ A pure ruby native client to Kestrel.
|
|
25
25
|
client.close( 'my_queue' ) # confirm with Kestrel that the item
|
26
26
|
# retrieved was processed
|
27
27
|
|
28
|
-
|
28
|
+
## ISC LICENSE
|
29
29
|
|
30
|
-
http://opensource.org/licenses/isc-license.txt
|
30
|
+
<http://opensource.org/licenses/isc-license.txt>
|
31
31
|
|
32
32
|
Copyright (c) 2012 Jeremy Hinegardner
|
33
33
|
|
data/Rakefile
CHANGED
@@ -1,350 +1,21 @@
|
|
1
1
|
# vim: syntax=ruby
|
2
|
+
load 'tasks/this.rb'
|
2
3
|
|
3
4
|
This.name = "kjess"
|
4
5
|
This.author = "Jeremy Hinegardner"
|
5
6
|
This.email = "jeremy@copiousfreetime.org"
|
6
7
|
This.homepage = "http://github.com/copiousfreetime/#{ This.name }"
|
7
|
-
This.version = Util.version
|
8
8
|
|
9
|
-
|
10
|
-
# If you want to Develop on this project just run 'rake develop' and you'll
|
11
|
-
# have all you need to get going. If you want to use bundler for development,
|
12
|
-
# then run 'rake develop:using_bundler'
|
13
|
-
#------------------------------------------------------------------------------
|
14
|
-
namespace :develop do
|
15
|
-
|
16
|
-
# Install all the development and runtime dependencies of this gem using the
|
17
|
-
# gemspec.
|
18
|
-
task :default do
|
19
|
-
require 'rubygems/dependency_installer'
|
20
|
-
installer = Gem::DependencyInstaller.new
|
21
|
-
|
22
|
-
Util.set_coverage_gem
|
23
|
-
|
24
|
-
puts "Installing gem depedencies needed for development"
|
25
|
-
Util.platform_gemspec.dependencies.each do |dep|
|
26
|
-
if dep.matching_specs.empty? then
|
27
|
-
puts "Installing : #{dep}"
|
28
|
-
installer.install dep
|
29
|
-
else
|
30
|
-
puts "Skipping : #{dep} -> already installed #{dep.matching_specs.first.full_name}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
puts "\n\nNow run 'rake test'"
|
34
|
-
end
|
35
|
-
|
36
|
-
# Create a Gemfile that just references the gemspec
|
37
|
-
file 'Gemfile' => :gemspec do
|
38
|
-
File.open( "Gemfile", "w+" ) do |f|
|
39
|
-
f.puts 'source :rubygems'
|
40
|
-
f.puts 'gemspec'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "Create a bundler Gemfile"
|
45
|
-
task :using_bundler => 'Gemfile' do
|
46
|
-
puts "Now you can 'bundle'"
|
47
|
-
end
|
48
|
-
|
49
|
-
# Gemfiles are build artifacts
|
50
|
-
CLOBBER << FileList['Gemfile*']
|
51
|
-
end
|
52
|
-
desc "Boostrap development"
|
53
|
-
task :develop => "develop:default"
|
54
|
-
|
55
|
-
#------------------------------------------------------------------------------
|
56
|
-
# Minitest - standard TestTask
|
57
|
-
#------------------------------------------------------------------------------
|
58
|
-
begin
|
59
|
-
require 'rake/testtask'
|
60
|
-
Rake::TestTask.new( :test ) do |t|
|
61
|
-
t.ruby_opts = %w[ -w -rubygems ]
|
62
|
-
t.libs = %w[ lib spec ]
|
63
|
-
t.pattern = "spec/**/*_spec.rb"
|
64
|
-
end
|
65
|
-
task :default => :test
|
66
|
-
rescue LoadError
|
67
|
-
Util.task_warning( 'test' )
|
68
|
-
end
|
69
|
-
|
70
|
-
#------------------------------------------------------------------------------
|
71
|
-
# RDoc - standard rdoc rake task, although we must make sure to use a more
|
72
|
-
# recent version of rdoc since it is the one that has 'tomdoc' markup
|
73
|
-
#------------------------------------------------------------------------------
|
74
|
-
begin
|
75
|
-
gem 'rdoc' # otherwise we get the wrong task from stdlib
|
76
|
-
require 'rdoc/task'
|
77
|
-
RDoc::Task.new do |t|
|
78
|
-
t.markup = 'tomdoc'
|
79
|
-
t.rdoc_dir = 'doc'
|
80
|
-
t.main = 'README.rdoc'
|
81
|
-
t.title = "#{This.name} #{This.version}"
|
82
|
-
t.rdoc_files.include( '*.rdoc', 'lib/**/*.rb' )
|
83
|
-
end
|
84
|
-
rescue LoadError => le
|
85
|
-
Util.task_warning( 'rdoc' )
|
86
|
-
end
|
87
|
-
|
88
|
-
#------------------------------------------------------------------------------
|
89
|
-
# Coverage - optional code coverage, rcov for 1.8 and simplecov for 1.9, so
|
90
|
-
# for the moment only rcov is listed.
|
91
|
-
#------------------------------------------------------------------------------
|
92
|
-
if RUBY_VERSION <= "1.9.2"
|
93
|
-
begin
|
94
|
-
require 'rcov/rcovtask'
|
95
|
-
Rcov::RcovTask.new( 'coverage' ) do |t|
|
96
|
-
t.libs << 'spec'
|
97
|
-
t.pattern = 'spec/**/*_spec.rb'
|
98
|
-
t.verbose = true
|
99
|
-
t.rcov_opts << "-x ^/" # remove all the global files
|
100
|
-
t.rcov_opts << "--sort coverage" # so we see the worst files at the top
|
101
|
-
end
|
102
|
-
rescue LoadError
|
103
|
-
Util.task_warning( 'rcov' )
|
104
|
-
end
|
105
|
-
else
|
106
|
-
begin
|
107
|
-
require 'simplecov'
|
108
|
-
desc 'Run tests with code coverage'
|
109
|
-
task :coverage do
|
110
|
-
ENV['COVERAGE'] = 'true'
|
111
|
-
Rake::Task[:test].execute
|
112
|
-
end
|
113
|
-
CLOBBER << FileList["coverage"]
|
114
|
-
rescue LoadError
|
115
|
-
Util.task_warning( 'simplecov' )
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
#------------------------------------------------------------------------------
|
120
|
-
# Manifest - We want an explicit list of thos files that are to be packaged in
|
121
|
-
# the gem. Most of this is from Hoe.
|
122
|
-
#------------------------------------------------------------------------------
|
123
|
-
namespace 'manifest' do
|
124
|
-
desc "Check the manifest"
|
125
|
-
task :check => :clean do
|
126
|
-
files = FileList["**/*", ".*"].exclude( This.exclude_from_manifest ).to_a.sort
|
127
|
-
files = files.select{ |f| File.file?( f ) }
|
128
|
-
|
129
|
-
tmp = "Manifest.tmp"
|
130
|
-
File.open( tmp, 'w' ) do |f|
|
131
|
-
f.puts files.join("\n")
|
132
|
-
end
|
133
|
-
|
134
|
-
begin
|
135
|
-
sh "diff -du Manifest.txt #{tmp}"
|
136
|
-
ensure
|
137
|
-
rm tmp
|
138
|
-
end
|
139
|
-
puts "Manifest looks good"
|
140
|
-
end
|
141
|
-
|
142
|
-
desc "Generate the manifest"
|
143
|
-
task :generate => :clean do
|
144
|
-
files = %x[ git ls-files ].split("\n").sort
|
145
|
-
files.reject! { |f| f =~ This.exclude_from_manifest }
|
146
|
-
File.open( "Manifest.txt", "w" ) do |f|
|
147
|
-
f.puts files.join("\n")
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
#------------------------------------------------------------------------------
|
153
|
-
# Fixme - look for fixmes and report them
|
154
|
-
#------------------------------------------------------------------------------
|
155
|
-
task :fixme => 'manifest:check' do
|
156
|
-
Util.read_manifest.each do |file|
|
157
|
-
next if file == File.basename( __FILE__ )
|
158
|
-
|
159
|
-
puts "FIXME: Rename #{file}" if file =~ /fixme/i
|
160
|
-
|
161
|
-
IO.readlines( file ).each_with_index do |line, idx|
|
162
|
-
prefix = "FIXME: #{file}:#{idx+1}".ljust(42)
|
163
|
-
puts "#{prefix} => #{line.strip}" if line =~ /fixme/i
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
#------------------------------------------------------------------------------
|
169
|
-
# Gem Specification
|
170
|
-
#------------------------------------------------------------------------------
|
171
|
-
This.gemspec = Hash.new
|
172
|
-
This.gemspec['ruby'] = Gem::Specification.new do |spec|
|
173
|
-
spec.name = This.name
|
174
|
-
spec.version = This.version
|
175
|
-
spec.author = This.author
|
176
|
-
spec.email = This.email
|
177
|
-
spec.homepage = This.homepage
|
178
|
-
|
179
|
-
spec.summary = This.summary
|
180
|
-
spec.description = This.description
|
181
|
-
|
182
|
-
spec.files = This.manifest
|
183
|
-
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
184
|
-
spec.test_files = spec.files.grep(/^spec/)
|
185
|
-
|
186
|
-
spec.extra_rdoc_files += spec.files.grep(/(txt|rdoc)$/)
|
187
|
-
spec.rdoc_options = [ "--main" , 'README.rdoc',
|
188
|
-
"--markup", "tomdoc" ]
|
189
|
-
|
190
|
-
# The Runtime Dependencies
|
191
|
-
|
192
|
-
# The Development Dependencies
|
9
|
+
This.ruby_gemspec do |spec|
|
193
10
|
spec.add_development_dependency( 'rake' , '~> 10.0.3')
|
194
|
-
spec.add_development_dependency( 'minitest' , '~> 4.
|
11
|
+
spec.add_development_dependency( 'minitest' , '~> 4.5.0' )
|
195
12
|
spec.add_development_dependency( 'rdoc' , '~> 3.12' )
|
196
13
|
spec.add_development_dependency( 'zip' , '~> 2.0.2' )
|
197
14
|
spec.add_development_dependency( 'json' , '~> 1.7.6' )
|
198
15
|
end
|
199
16
|
|
200
17
|
|
201
|
-
|
202
|
-
This.gemspec_file = "#{This.name}.gemspec"
|
18
|
+
load 'tasks/default.rake'
|
203
19
|
|
204
|
-
# Really this is only here to support those who use bundler
|
205
|
-
desc "Build the #{This.name}.gemspec file"
|
206
|
-
task :gemspec do
|
207
|
-
Util.set_coverage_gem
|
208
|
-
File.open( This.gemspec_file, "wb+" ) do |f|
|
209
|
-
f.write Util.platform_gemspec.to_ruby
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
# the gemspec is also a dev artifact and should not be kept around.
|
214
|
-
CLOBBER << This.gemspec_file
|
215
|
-
|
216
|
-
# The standard gem packaging task, everyone has it.
|
217
|
-
require 'rubygems/package_task'
|
218
|
-
Gem::PackageTask.new( Util.platform_gemspec ) do
|
219
|
-
# nothing
|
220
|
-
end
|
221
|
-
|
222
|
-
#------------------------------------------------------------------------------
|
223
|
-
# Release - the steps we go through to do a final release, this is pulled from
|
224
|
-
# a compbination of mojombo's rakegem, hoe and hoe-git
|
225
|
-
#
|
226
|
-
# 1) make sure we are on the master branch
|
227
|
-
# 2) make sure there are no uncommitted items
|
228
|
-
# 3) check the manifest and make sure all looks good
|
229
|
-
# 4) build the gem
|
230
|
-
# 5) do an empty commit to have the commit message of the version
|
231
|
-
# 6) tag that commit as the version
|
232
|
-
# 7) push master
|
233
|
-
# 8) push the tag
|
234
|
-
# 7) pus the gem
|
235
|
-
#------------------------------------------------------------------------------
|
236
|
-
task :release_check do
|
237
|
-
unless `git branch` =~ /^\* master$/
|
238
|
-
abort "You must be on the master branch to release!"
|
239
|
-
end
|
240
|
-
unless `git status` =~ /^nothing to commit/m
|
241
|
-
abort "Nope, sorry, you have unfinished business"
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
desc "Create tag v#{This.version}, build and push #{Util.platform_gemspec.full_name} to rubygems.org"
|
246
|
-
task :release => [ :release_check, 'manifest:check', :gem ] do
|
247
|
-
sh "git commit --allow-empty -a -m 'Release #{This.version}'"
|
248
|
-
sh "git tag -a -m 'v#{This.version}' v#{This.version}"
|
249
|
-
sh "git push origin master"
|
250
|
-
sh "git push origin v#{This.version}"
|
251
|
-
sh "gem push pkg/#{Util.platform_gemspec.full_name}.gem"
|
252
|
-
end
|
253
|
-
|
254
|
-
#------------------------------------------------------------------------------
|
255
|
-
# Load the extra rake tasks
|
256
|
-
#------------------------------------------------------------------------------
|
257
20
|
$: << "." unless $:.include?(".")
|
258
|
-
|
259
|
-
load 'tasks/kestrel.rake'
|
260
|
-
rescue LoadError => le
|
261
|
-
Util.task_warning( 'kestrel' )
|
262
|
-
end
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
#------------------------------------------------------------------------------
|
267
|
-
# Rakefile Support - This is all the guts and utility methods that are
|
268
|
-
# necessary to support the above tasks.
|
269
|
-
#
|
270
|
-
# Lots of Credit for this Rakefile goes to:
|
271
|
-
#
|
272
|
-
# Ara T. Howard - see the Rakefile in all of his projects -
|
273
|
-
# https://github.com/ahoward/
|
274
|
-
# Tom Preston Werner - his Rakegem project https://github.com/mojombo/rakegem
|
275
|
-
# Seattle.rb - Hoe - cuz it has relly good stuff in there
|
276
|
-
#------------------------------------------------------------------------------
|
277
|
-
BEGIN {
|
278
|
-
|
279
|
-
require 'ostruct'
|
280
|
-
require 'rake/clean'
|
281
|
-
require 'rubygems' unless defined? Gem
|
282
|
-
|
283
|
-
module Util
|
284
|
-
def self.version
|
285
|
-
[ "lib/#{ This.name }.rb", "lib/#{ This.name }/version.rb" ].each do |v|
|
286
|
-
line = File.read( v )[/^\s*VERSION\s*=\s*.*/]
|
287
|
-
if line then
|
288
|
-
return line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
289
|
-
end
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
# Partition an rdoc file into sections and return the text of the section
|
294
|
-
# as an array of paragraphs
|
295
|
-
def self.section_of( file, section_name )
|
296
|
-
re = /^=+ (.*)$/
|
297
|
-
parts = File.read( file ).split( re )[1..-1]
|
298
|
-
parts.map! { |p| p.strip }
|
299
|
-
|
300
|
-
sections = Hash.new
|
301
|
-
Hash[*parts].each do |k,v|
|
302
|
-
sections[k] = v.split("\n\n")
|
303
|
-
end
|
304
|
-
return sections[section_name]
|
305
|
-
end
|
306
|
-
|
307
|
-
def self.task_warning( task )
|
308
|
-
warn "WARNING: '#{task}' tasks are not defined. Please run 'rake develop'"
|
309
|
-
end
|
310
|
-
|
311
|
-
def self.project_root
|
312
|
-
File.expand_path( File.dirname(__FILE__) )
|
313
|
-
end
|
314
|
-
|
315
|
-
def self.read_manifest
|
316
|
-
abort "You need a Manifest.txt" unless File.readable?( "Manifest.txt" )
|
317
|
-
File.readlines( "Manifest.txt" ).map { |l| l.strip }
|
318
|
-
end
|
319
|
-
|
320
|
-
def self.platform_gemspec
|
321
|
-
This.gemspec[This.platform]
|
322
|
-
end
|
323
|
-
|
324
|
-
def self.set_coverage_gem
|
325
|
-
# list these here instead of gem dependencies since there is not a way to
|
326
|
-
# specify ruby version specific dependencies
|
327
|
-
g, v = 'simplecov', '~> 0.7.1'
|
328
|
-
if RUBY_VERSION < "1.9.2"
|
329
|
-
g, v = 'rcov', '~> 1.0.0'
|
330
|
-
end
|
331
|
-
|
332
|
-
if Util.platform_gemspec.dependencies.none? { |s| s.name == g } then
|
333
|
-
Util.platform_gemspec.add_development_dependency( g, v )
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
# Hold all the metadata about this project
|
339
|
-
This = OpenStruct.new
|
340
|
-
This.platform = (RUBY_PLATFORM == "java") ? 'java' : Gem::Platform::RUBY
|
341
|
-
|
342
|
-
desc = Util.section_of( 'README.rdoc', 'DESCRIPTION')
|
343
|
-
This.summary = desc.first
|
344
|
-
This.description = desc.join(" ").tr("\n", ' ').gsub(/[{}]/,'').gsub(/\[[^\]]+\]/,'') # strip rdoc
|
345
|
-
|
346
|
-
|
347
|
-
This.exclude_from_manifest = %r/tmp$|\.(git|DS_Store)|^(doc|coverage|pkg)|Gemfile*|\.gemspec$|\.swp$|\.jar|\.rvmrc$|^kestrel|~$/
|
348
|
-
This.manifest = Util.read_manifest
|
349
|
-
|
350
|
-
}
|
21
|
+
load 'tasks/kestrel.rake'
|