zack 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -2
- data/README +1 -1
- data/Rakefile +9 -58
- data/lib/zack/client.rb +24 -1
- metadata +35 -63
data/History.txt
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
= 0.
|
1
|
+
= 0.3.0 / 20Jul2011
|
2
|
+
|
3
|
+
+ Channel names are generated using UUIDs. No duplicate detection yet.
|
4
|
+
|
5
|
+
= 0.2.0 / 26Apr2011
|
2
6
|
|
3
7
|
+ Starting with this version, zack depends on Cod for all its inner workings
|
4
8
|
and just adds RPC. This makes it lean to the point of nonexistence.
|
5
|
-
|
9
|
+
|
6
10
|
= 0.1.3 / not released
|
7
11
|
|
8
12
|
+ All calls now have a default timeout of 10 seconds. Timeouts reset the
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -1,66 +1,17 @@
|
|
1
|
+
require 'rake/clean'
|
1
2
|
require "rubygems"
|
2
|
-
require
|
3
|
-
require "rake/rdoctask"
|
3
|
+
require 'rubygems/package_task'
|
4
4
|
|
5
5
|
require 'rspec'
|
6
6
|
require 'rspec/core/rake_task'
|
7
7
|
Rspec::Core::RakeTask.new
|
8
8
|
task :default => :spec
|
9
9
|
|
10
|
-
# This builds the
|
11
|
-
|
12
|
-
|
13
|
-
# http://rubygems.org/read/chapter/20
|
14
|
-
#
|
15
|
-
spec = Gem::Specification.new do |s|
|
10
|
+
# This task actually builds the gem.
|
11
|
+
task :gem => :spec
|
12
|
+
spec = eval(File.read('zack.gemspec'))
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
s.authors = ['Kaspar Schiess', 'Patrick Marchi']
|
22
|
-
s.email = ["kaspar.schiess@absurd.li", 'mail@patrickmarchi.ch']
|
23
|
-
s.homepage = "http://github.com/kschiess/zack"
|
24
|
-
|
25
|
-
s.has_rdoc = true
|
26
|
-
s.extra_rdoc_files = %w(README)
|
27
|
-
s.rdoc_options = %w(--main README)
|
28
|
-
|
29
|
-
# Add any extra files to include in the gem
|
30
|
-
s.files = %w(History.txt LICENSE Rakefile README) + Dir.glob("{spec,lib/**/*}")
|
31
|
-
s.require_paths = ["lib"]
|
32
|
-
|
33
|
-
s.add_dependency("cod", "~> 0.2")
|
34
|
-
s.add_dependency("beanstalk-client", "~> 1.0")
|
35
|
-
|
36
|
-
# If your tests use any gems, include them here
|
37
|
-
s.add_development_dependency("rspec")
|
38
|
-
s.add_development_dependency("flexmock")
|
39
|
-
end
|
40
|
-
|
41
|
-
# This task actually builds the gem. We also regenerate a static
|
42
|
-
# .gemspec file, which is useful if something (i.e. GitHub) will
|
43
|
-
# be automatically building a gem for this project. If you're not
|
44
|
-
# using GitHub, edit as appropriate.
|
45
|
-
#
|
46
|
-
# To publish your gem online, install the 'gemcutter' gem; Read more
|
47
|
-
# about that here: http://gemcutter.org/pages/gem_docs
|
48
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
49
|
-
pkg.gem_spec = spec
|
50
|
-
|
51
|
-
# Generate the gemspec file for github.
|
52
|
-
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
|
53
|
-
File.open(file, "w") {|f| f << spec.to_ruby }
|
54
|
-
end
|
55
|
-
|
56
|
-
# Generate documentation
|
57
|
-
Rake::RDocTask.new do |rd|
|
58
|
-
rd.main = "README"
|
59
|
-
rd.rdoc_files.include("README", "lib/**/*.rb")
|
60
|
-
rd.rdoc_dir = "rdoc"
|
61
|
-
end
|
62
|
-
|
63
|
-
desc 'Clear out RDoc and generated packages'
|
64
|
-
task :clean => [:clobber_rdoc, :clobber_package] do
|
65
|
-
rm "#{spec.name}.gemspec"
|
66
|
-
end
|
14
|
+
desc "Generate the gem package."
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
# pkg.need_tar = true
|
17
|
+
end
|
data/lib/zack/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
|
2
|
+
require 'uuid'
|
2
3
|
|
3
4
|
# Client part of Zack RPC
|
4
5
|
#
|
@@ -14,7 +15,8 @@ class Zack::Client
|
|
14
15
|
|
15
16
|
@outgoing = Cod.beanstalk(server, tube_name)
|
16
17
|
unless @with_answer.empty?
|
17
|
-
@incoming = Cod.beanstalk(server
|
18
|
+
@incoming = Cod.beanstalk(server,
|
19
|
+
unique_tube_name(tube_name))
|
18
20
|
end
|
19
21
|
|
20
22
|
@service = Cod::Client.new(@outgoing, @incoming, 1)
|
@@ -41,4 +43,25 @@ class Zack::Client
|
|
41
43
|
def has_answer?(sym)
|
42
44
|
@with_answer.include?(sym.to_sym)
|
43
45
|
end
|
46
|
+
|
47
|
+
private
|
48
|
+
# Pretend that UUIDs don't collide for now.
|
49
|
+
#
|
50
|
+
def unique_tube_name(name)
|
51
|
+
"name.#{uuid}"
|
52
|
+
end
|
53
|
+
def uuid
|
54
|
+
uuid_generator.generate
|
55
|
+
end
|
56
|
+
def uuid_generator
|
57
|
+
generator=Thread.current[:zack_uuid_generator]
|
58
|
+
return generator if generator
|
59
|
+
|
60
|
+
# assert: generator is nil
|
61
|
+
|
62
|
+
# Pretend we've just forked, because that might be the case.
|
63
|
+
UUID.generator.next_sequence
|
64
|
+
|
65
|
+
Thread.current[:zack_uuid_generator]=generator=UUID.new
|
66
|
+
end
|
44
67
|
end
|
metadata
CHANGED
@@ -1,74 +1,49 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: zack
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Kaspar Schiess
|
9
9
|
- Patrick Marchi
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
date: 2011-04-27 00:00:00 +02:00
|
13
|
+
date: 2011-07-20 00:00:00.000000000 +02:00
|
15
14
|
default_executable:
|
16
|
-
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
18
17
|
name: cod
|
19
|
-
|
20
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: &2157732620 !ruby/object:Gem::Requirement
|
21
19
|
none: false
|
22
|
-
requirements:
|
20
|
+
requirements:
|
23
21
|
- - ~>
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version:
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0.3'
|
26
24
|
type: :runtime
|
27
|
-
version_requirements: *id001
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: beanstalk-client
|
30
25
|
prerelease: false
|
31
|
-
|
26
|
+
version_requirements: *2157732620
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: beanstalk-client
|
29
|
+
requirement: &2157731840 !ruby/object:Gem::Requirement
|
32
30
|
none: false
|
33
|
-
requirements:
|
31
|
+
requirements:
|
34
32
|
- - ~>
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version:
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.0'
|
37
35
|
type: :runtime
|
38
|
-
version_requirements: *id002
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: rspec
|
41
36
|
prerelease: false
|
42
|
-
|
43
|
-
none: false
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: "0"
|
48
|
-
type: :development
|
49
|
-
version_requirements: *id003
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: flexmock
|
52
|
-
prerelease: false
|
53
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
|
-
requirements:
|
56
|
-
- - ">="
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version: "0"
|
59
|
-
type: :development
|
60
|
-
version_requirements: *id004
|
37
|
+
version_requirements: *2157731840
|
61
38
|
description:
|
62
|
-
email:
|
39
|
+
email:
|
63
40
|
- kaspar.schiess@absurd.li
|
64
41
|
- mail@patrickmarchi.ch
|
65
42
|
executables: []
|
66
|
-
|
67
43
|
extensions: []
|
68
|
-
|
69
|
-
extra_rdoc_files:
|
44
|
+
extra_rdoc_files:
|
70
45
|
- README
|
71
|
-
files:
|
46
|
+
files:
|
72
47
|
- History.txt
|
73
48
|
- LICENSE
|
74
49
|
- Rakefile
|
@@ -79,31 +54,28 @@ files:
|
|
79
54
|
has_rdoc: true
|
80
55
|
homepage: http://github.com/kschiess/zack
|
81
56
|
licenses: []
|
82
|
-
|
83
57
|
post_install_message:
|
84
|
-
rdoc_options:
|
58
|
+
rdoc_options:
|
85
59
|
- --main
|
86
60
|
- README
|
87
|
-
require_paths:
|
61
|
+
require_paths:
|
88
62
|
- lib
|
89
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
64
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version:
|
95
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
70
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version:
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
101
75
|
requirements: []
|
102
|
-
|
103
76
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.6.2
|
105
78
|
signing_key:
|
106
79
|
specification_version: 3
|
107
80
|
summary: Ruby RPC calls via Cod
|
108
81
|
test_files: []
|
109
|
-
|