Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit 3c935aae0d38bd294168aae54bd8104f455ebe8f @wickman wickman committed Jun 14, 2010
@@ -0,0 +1,6 @@
+*.gem
+*.o
+*.so
+*~
+*.log
+Makefile
@@ -0,0 +1 @@
+v0.1 Rewrite of original ZK gem.
23 LICENSE
@@ -0,0 +1,23 @@
+(The MIT License)
+
+Copyright (C) 2008 Phillip Pearson
+Copyright (C) 2010 Twitter, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,16 @@
+CHANGELOG
+LICENSE
+README
+Rakefile
+ext/extconf.rb
+ext/zkc-3.3.1.tar.gz
+ext/zookeeper_c.c
+ext/zookeeper_lib.c
+ext/zookeeper_lib.h
+lib/zookeeper.rb
+lib/zookeeper/acls.rb
+lib/zookeeper/callbacks.rb
+lib/zookeeper/constants.rb
+lib/zookeeper/exceptions.rb
+lib/zookeeper/stat.rb
+Manifest
42 README
@@ -0,0 +1,42 @@
+zookeeper
+
+An interface to the Zookeeper distributed configuration server.
+
+== License
+
+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.
+
+== Install
+
+sudo gem install zookeeper
+
+== Usage
+
+Connect to a server:
+
+ require 'rubygems'
+ require 'zookeeper'
+ z = Zookeeper.new("localhost:2181")
+ z.get_children(:path => "/")
+
+== Idioms
+
+ The following methods are initially supported:
+ get
+ set
+ get_children
+ stat
+ create
+ delete
+ get_acl
+ set_acl
+
+ All support async callbacks. get, get_children and stat support both
+ watchers and callbacks.
+
+ Calls take a dictionary of parameters. With the exception of set_acl, the
+ only required parameter is :path. Each call returns a dictionary with at
+ minimum two keys :req_id and :rc.
@@ -0,0 +1,11 @@
+require 'echoe'
+
+Echoe.new("zookeeper") do |p|
+ p.author = "Phillip Pearson, Eric Maland, Evan Weaver, Brian Wickman"
+ p.project = "fauna"
+ p.summary = "An interface to the Zookeeper distributed configuration server."
+ p.url = "http://blog.evanweaver.com/files/doc/fauna/zookeeper/"
+ p.docs_host = "blog.evanweaver.com:~/www/bax/public/files/doc/"
+ p.clean_pattern += ["ext/lib", "ext/include", "ext/c", "ext/bin", "ext/conftest.dSYM"]
+ p.rdoc_pattern = /README|TODO|LICENSE|CHANGELOG|BENCH|COMPAT|zookeeper_c.c|zookeeper.rb/
+end
@@ -0,0 +1,55 @@
+
+require 'mkmf'
+require 'rbconfig'
+
+HERE = File.expand_path(File.dirname(__FILE__))
+BUNDLE = Dir.glob("zkc-*.tar.gz").first
+BUNDLE_PATH = "c"
+
+$CFLAGS = "#{RbConfig::CONFIG['CFLAGS']} #{$CFLAGS}".gsub("$(cflags)", "").gsub("-arch ppc", "")
+$LDFLAGS = "#{RbConfig::CONFIG['LDFLAGS']} #{$LDFLAGS}".gsub("$(ldflags)", "").gsub("-arch ppc", "")
+$CXXFLAGS = " -std=gnu++98 #{$CFLAGS}"
+$CPPFLAGS = $ARCH_FLAG = $DLDFLAGS = ""
+
+if ENV['DEBUG']
+ puts "Setting debug flags."
+ $CFLAGS << " -O0 -ggdb -DHAVE_DEBUG"
+ $EXTRA_CONF = " --enable-debug"
+end
+
+$includes = " -I#{HERE}/include"
+$libraries = " -L#{HERE}/lib"
+$CFLAGS = "#{$includes} #{$libraries} #{$CFLAGS}"
+$LDFLAGS = "#{$libraries} #{$LDFLAGS}"
+$LIBPATH = ["#{HERE}/lib"]
+$DEFLIBPATH = []
+
+Dir.chdir(HERE) do
+ if File.exist?("lib")
+ puts "Zkc already built; run 'rake clean' first if you need to rebuild."
+ else
+ puts "Building zkc."
+ puts(cmd = "tar xzf #{BUNDLE} 2>&1")
+ raise "'#{cmd}' failed" unless system(cmd)
+
+ Dir.chdir(BUNDLE_PATH) do
+ puts(cmd = "env CFLAGS='-fPIC #{$CFLAGS}' LDFLAGS='-fPIC #{$LDFLAGS}' ./configure --prefix=#{HERE} --without-cppunit --disable-shared --disable-dependency-tracking #{$EXTRA_CONF} 2>&1")
+ raise "'#{cmd}' failed" unless system(cmd)
+ puts(cmd = "make CXXFLAGS='#{$CXXFLAGS}' || true 2>&1")
+ raise "'#{cmd}' failed" unless system(cmd)
+ puts(cmd = "make install || true 2>&1")
+ raise "'#{cmd}' failed" unless system(cmd)
+ end
+
+ system("rm -rf #{BUNDLE_PATH}") unless ENV['DEBUG'] or ENV['DEV']
+ end
+end
+
+# Absolutely prevent the linker from picking up any other zookeeper_mt
+Dir.chdir("#{HERE}/lib") do
+ system("cp -f libzookeeper_mt.a libzookeeper_mt_gem.a")
+ system("cp -f libzookeeper_mt.la libzookeeper_mt_gem.la")
+end
+$LIBS << " -lzookeeper_mt_gem"
+
+create_makefile 'zookeeper_c'
Binary file not shown.
Oops, something went wrong.

0 comments on commit 3c935aa

Please sign in to comment.