zookeeper 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,2 +1,4 @@
1
1
 
2
+ v0.2. Bundle C dependencies, like memcached.gem.
3
+
2
4
  v0.1. First release.
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ (The MIT License)
2
+
3
+ Copyright (C) 2008 Phillip Pearson
4
+ Copyright (C) 2010 Twitter, Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest CHANGED
@@ -1,8 +1,10 @@
1
1
  CHANGELOG
2
+ LICENSE
3
+ Manifest
2
4
  README
3
5
  Rakefile
4
- ext/zookeeper_c/extconf.rb
5
- ext/zookeeper_c/zookeeper_ruby.c
6
- lib/zookeeper_client.rb
6
+ ext/extconf.rb
7
+ ext/zkc-3.2.2.tar.gz
8
+ ext/zookeeper_c.c
9
+ lib/zookeeper.rb
7
10
  test/test_basic.rb
8
- Manifest
data/README CHANGED
@@ -1,36 +1,21 @@
1
- zookeeper_client
2
- by Phillip Pearson
3
- http://github.com/myelin/zookeeper_client
1
+ zookeeper
4
2
 
5
- == DESCRIPTION:
3
+ An interface to the ZooKeeper distributed configuration server.
6
4
 
7
- zookeeper_client is a Ruby library to interface with the ZooKeeper
8
- replicated object store / lock server.
5
+ == License
9
6
 
10
- Project maturity: early alpha. Working, although very chatty and
11
- there may be bugs to do with threading. Expect to get your hands
12
- dirty.
7
+ Copyright 2008 Phillip Pearson, and 2010 Twitter, Inc. Licensed under the MIT License. See the included LICENSE file. Portions copyright 2008-2010 the Apache Software Foundation, licensed under the Apache 2 license, and used with permission.
13
8
 
14
- == REQUIREMENTS:
9
+ == Install
15
10
 
16
- * ZooKeeper C client library (http://zookeeper.sourceforge.net/)
11
+ sudo gem install zookeeper
17
12
 
18
- See installation instructions in c/README, in the ZooKeeper source
19
- distribution. zookeeper_client expects the headers to live in
20
- /usr/include/c-client-src/, which doesn't feel right but is where
21
- they go on my system when I run 'make install'.
22
-
23
- == INSTALL:
24
-
25
- $ gem sources -a http://gems.github.com/
26
- $ gem install myelin-zookeeper_client
27
-
28
- == USAGE:
13
+ == Usage
29
14
 
30
15
  = Connect to a server
31
16
 
32
17
  require 'rubygems'
33
- require 'myelin-zookeeper_client'
18
+ require 'zookeeper'
34
19
  z = ZooKeeper.new("localhost:2181")
35
20
 
36
21
  = Create, set and read nodes
@@ -71,28 +56,3 @@ dirty.
71
56
  end
72
57
  # we have the lock
73
58
  # => nil
74
-
75
- == LICENSE:
76
-
77
- (The MIT License)
78
-
79
- Copyright (C) 2008 Phillip Pearson
80
-
81
- Permission is hereby granted, free of charge, to any person obtaining
82
- a copy of this software and associated documentation files (the
83
- 'Software'), to deal in the Software without restriction, including
84
- without limitation the rights to use, copy, modify, merge, publish,
85
- distribute, sublicense, and/or sell copies of the Software, and to
86
- permit persons to whom the Software is furnished to do so, subject to
87
- the following conditions:
88
-
89
- The above copyright notice and this permission notice shall be
90
- included in all copies or substantial portions of the Software.
91
-
92
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
93
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
94
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
95
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
96
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
97
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
98
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -6,4 +6,5 @@ Echoe.new("zookeeper") do |p|
6
6
  p.summary = "A Ruby wrapper for the ZooKeeper C client library."
7
7
  p.url = "http://blog.evanweaver.com/files/doc/fauna/zookeeper/"
8
8
  p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
9
+ p.clean_pattern += ["ext/lib", "ext/include", "ext/c", "ext/bin", "ext/conftest.dSYM"]
9
10
  end
data/ext/extconf.rb ADDED
@@ -0,0 +1,55 @@
1
+
2
+ require 'mkmf'
3
+ require 'rbconfig'
4
+
5
+ HERE = File.expand_path(File.dirname(__FILE__))
6
+ BUNDLE = Dir.glob("zkc-*.tar.gz").first
7
+ BUNDLE_PATH = "c"
8
+
9
+ $CFLAGS = "#{RbConfig::CONFIG['CFLAGS']} #{$CFLAGS}".gsub("$(cflags)", "")
10
+ $LDFLAGS = "#{RbConfig::CONFIG['LDFLAGS']} #{$LDFLAGS}".gsub("$(ldflags)", "")
11
+ $CXXFLAGS = " -std=gnu++98 #{$CFLAGS}"
12
+ $CPPFLAGS = $ARCH_FLAG = $DLDFLAGS = ""
13
+
14
+ if ENV['DEBUG']
15
+ puts "Setting debug flags."
16
+ $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
17
+ $EXTRA_CONF = " --enable-debug"
18
+ end
19
+
20
+ $includes = " -I#{HERE}/include"
21
+ $libraries = " -L#{HERE}/lib"
22
+ $CFLAGS = "#{$includes} #{$libraries} #{$CFLAGS}"
23
+ $LDFLAGS = "#{$libraries} #{$LDFLAGS}"
24
+ $LIBPATH = ["#{HERE}/lib"]
25
+ $DEFLIBPATH = []
26
+
27
+ Dir.chdir(HERE) do
28
+ if File.exist?("lib")
29
+ puts "Zkc already built; run 'rake clean' first if you need to rebuild."
30
+ else
31
+ puts "Building zkc."
32
+ puts(cmd = "tar xzf #{BUNDLE} 2>&1")
33
+ raise "'#{cmd}' failed" unless system(cmd)
34
+
35
+ Dir.chdir(BUNDLE_PATH) do
36
+ puts(cmd = "env CFLAGS='-fPIC #{$CFLAGS}' LDFLAGS='-fPIC #{$LDFLAGS}' ./configure --prefix=#{HERE} #{$EXTRA_CONF} 2>&1")
37
+ raise "'#{cmd}' failed" unless system(cmd)
38
+ puts(cmd = "make CXXFLAGS='#{$CXXFLAGS}' || true 2>&1")
39
+ raise "'#{cmd}' failed" unless system(cmd)
40
+ puts(cmd = "make install || true 2>&1")
41
+ raise "'#{cmd}' failed" unless system(cmd)
42
+ end
43
+
44
+ system("rm -rf #{BUNDLE_PATH}") unless ENV['DEBUG'] or ENV['DEV']
45
+ end
46
+ end
47
+
48
+ # Absolutely prevent the linker from picking up any other zookeeper_mt
49
+ Dir.chdir("#{HERE}/lib") do
50
+ system("cp -f libzookeeper_mt.a libzookeeper_mt_gem.a")
51
+ system("cp -f libzookeeper_mt.la libzookeeper_mt_gem.la")
52
+ end
53
+ $LIBS << " -lzookeeper_mt_gem"
54
+
55
+ create_makefile 'zookeeper_c'
Binary file
@@ -7,7 +7,7 @@
7
7
 
8
8
  #include "ruby.h"
9
9
 
10
- #include "zookeeper/zookeeper.h"
10
+ #include "c-client-src/zookeeper.h"
11
11
  #include <errno.h>
12
12
  #include <stdio.h>
13
13
 
File without changes
data/test/test_basic.rb CHANGED
@@ -1,6 +1,6 @@
1
- $LOAD_PATH << '/home/eric/zk-clients/lib'
2
- require 'rubygems'
3
- require 'zookeeper_client'
1
+ HERE = File.expand_path(File.dirname(__FILE__))
2
+
3
+ require "#{HERE}/../lib/zookeeper"
4
4
 
5
5
  z = ZooKeeper.new("localhost:2181")
6
6
 
data/zookeeper.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{zookeeper}
5
- s.version = "0.1"
5
+ s.version = "0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Phillip Pearson, Eric Maland, Evan Weaver"]
9
9
  s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
10
- s.date = %q{2010-02-09}
10
+ s.date = %q{2010-03-02}
11
11
  s.description = %q{A Ruby wrapper for the ZooKeeper C client library.}
12
12
  s.email = %q{}
13
- s.extensions = ["ext/zookeeper_c/extconf.rb"]
14
- s.extra_rdoc_files = ["CHANGELOG", "README", "ext/zookeeper_c/extconf.rb", "ext/zookeeper_c/zookeeper_ruby.c", "lib/zookeeper_client.rb"]
15
- s.files = ["CHANGELOG", "README", "Rakefile", "ext/zookeeper_c/extconf.rb", "ext/zookeeper_c/zookeeper_ruby.c", "lib/zookeeper_client.rb", "test/test_basic.rb", "Manifest", "zookeeper.gemspec"]
13
+ s.extensions = ["ext/extconf.rb"]
14
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "ext/extconf.rb", "ext/zkc-3.2.2.tar.gz", "ext/zookeeper_c.c", "lib/zookeeper.rb"]
15
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "ext/extconf.rb", "ext/zkc-3.2.2.tar.gz", "ext/zookeeper_c.c", "lib/zookeeper.rb", "test/test_basic.rb", "zookeeper.gemspec"]
16
16
  s.homepage = %q{http://blog.evanweaver.com/files/doc/fauna/zookeeper/}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Zookeeper", "--main", "README"]
18
18
  s.require_paths = ["lib", "ext"]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zookeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phillip Pearson, Eric Maland, Evan Weaver
@@ -30,7 +30,7 @@ cert_chain:
30
30
  yZ0=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2010-02-09 00:00:00 -08:00
33
+ date: 2010-03-02 00:00:00 -08:00
34
34
  default_executable:
35
35
  dependencies: []
36
36
 
@@ -39,22 +39,26 @@ email: ""
39
39
  executables: []
40
40
 
41
41
  extensions:
42
- - ext/zookeeper_c/extconf.rb
42
+ - ext/extconf.rb
43
43
  extra_rdoc_files:
44
44
  - CHANGELOG
45
+ - LICENSE
45
46
  - README
46
- - ext/zookeeper_c/extconf.rb
47
- - ext/zookeeper_c/zookeeper_ruby.c
48
- - lib/zookeeper_client.rb
47
+ - ext/extconf.rb
48
+ - ext/zkc-3.2.2.tar.gz
49
+ - ext/zookeeper_c.c
50
+ - lib/zookeeper.rb
49
51
  files:
50
52
  - CHANGELOG
53
+ - LICENSE
54
+ - Manifest
51
55
  - README
52
56
  - Rakefile
53
- - ext/zookeeper_c/extconf.rb
54
- - ext/zookeeper_c/zookeeper_ruby.c
55
- - lib/zookeeper_client.rb
57
+ - ext/extconf.rb
58
+ - ext/zkc-3.2.2.tar.gz
59
+ - ext/zookeeper_c.c
60
+ - lib/zookeeper.rb
56
61
  - test/test_basic.rb
57
- - Manifest
58
62
  - zookeeper.gemspec
59
63
  has_rdoc: true
60
64
  homepage: http://blog.evanweaver.com/files/doc/fauna/zookeeper/
metadata.gz.sig CHANGED
Binary file
@@ -1,14 +0,0 @@
1
- require 'mkmf'
2
-
3
- dir_config("zookeeper")
4
-
5
- have_header "sys/errno.h"
6
- have_header "stdio.h"
7
- find_header("zookeeper/zookeeper.h") or
8
- raise "zookeeper.h not found."
9
- find_library("zookeeper_mt", "zoo_set_debug_level") or
10
- raise "libzookeeper_mt not found."
11
-
12
- dir_config('zookeeper_c')
13
- create_makefile( 'zookeeper_c')
14
-