Merge lp:~posulliv/drizzle-interface/ruby-interface into lp:drizzle-interface

Proposed by Padraig O'Sullivan
Status: Merged
Merged at revision: not available
Proposed branch: lp:~posulliv/drizzle-interface/ruby-interface
Merge into: lp:drizzle-interface
Diff against target: 271 lines
11 files modified
INSTALL (+3/-14)
Makefile.am (+4/-4)
config/install-sh (+2/-3)
ruby/CHANGELOG (+3/-0)
ruby/LICENSE (+30/-0)
ruby/README (+8/-0)
ruby/Rakefile (+8/-0)
ruby/ext/extconf.rb (+18/-0)
ruby/test/setup.rb (+15/-0)
ruby/test/test_helper.rb (+16/-0)
ruby/test/unit/drizzle_test.rb (+32/-0)
To merge this branch: bzr merge lp:~posulliv/drizzle-interface/ruby-interface
Reviewer Review Type Date Requested Status
Monty Taylor Pending
Review via email: mp+13762@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Padraig O'Sullivan (posulliv) wrote :

I was messing around with the SWIG generated ruby interface to drizzle tonight and I've started thinking about how we are going to distribute this. I'm guessing we are going to want to create a ruby gem since that seems to be the standard way.

I've created the various files in this branch I'm proposing for a merge for creating a ruby gem and am currently working on writing some unit tests for it. I'm trying to do this in what appears to be the standard way that things like this are done in the ruby community.

How would we distribute something like this? It seems that most ruby folks use github and not launchpad. Is there a way to mirror a launchpad branch on github? What are your plans for the python interface?

Sorry for all the questions on this! Software distribution is something I'm really not familiar with at all.

-Padraig

Revision history for this message
Monty Taylor (mordred) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Padraig O'Sullivan wrote:
> Padraig O'Sullivan has proposed merging
> lp:~posulliv/drizzle-interface/ruby-interface into
> lp:drizzle-interface.
>
> Requested reviews: Monty Taylor (mordred)
>
>
> I was messing around with the SWIG generated ruby interface to
> drizzle tonight and I've started thinking about how we are going to
> distribute this. I'm guessing we are going to want to create a ruby
> gem since that seems to be the standard way.

Totally agree.

> I've created the various files in this branch I'm proposing for a
> merge for creating a ruby gem and am currently working on writing
> some unit tests for it. I'm trying to do this in what appears to be
> the standard way that things like this are done in the ruby
> community.

Looks good to me.

> How would we distribute something like this? It seems that most ruby
> folks use github and not launchpad. Is there a way to mirror a
> launchpad branch on github? What are your plans for the python
> interface?

The way I've been doing this for the python interface is similar. I use
python setuptools to create python packages and upload those to PyPI
(the python packaging system) In general, the thought is this:

root makefile generates the C code into language subdir
language subdir should be self-sufficient, so it (including the
generated file) can be tarred up and distributed

If you want to just install the code, you can grab a tarball we'll
publish of just your language. (python-libdrizzle-0.1.tar.gz or
ruby-libdrizzle-0.1.tar.gz)

If you want to hack on the _C_ part, you can grab the bzr branch from
launchpad and run SWIG and all of that. (less people will want to do this)

For distribution, I make a source tarball of just the python dir (using
python setup.py sdist) and I upload that to launchpad
(http://edge.launchpad.net/drizzle-interface/trunk/ongoing-development/+download/python-libdrizzle-0.3.0.tar.gz)
and also to PyPI (http://pypi.python.org/pypi/python-libdrizzle/ -
http://pypi.python.org/packages/source/p/python-libdrizzle/python-libdrizzle-0.3.0.tar.gz#md5=a938eb02df37168a2aa7ec0cf3b0b7fe)

I think a similar pattern can be used for Ruby. Make a gemspec file in
the ruby dir which assumes that the ruby dir is actually the root dir.
That can be used to create the tarballs for ruby, and then we can use
that to create gems to upload as well.

I'm not sure we need to do anything with github unless we were going to
move development to use git from bzr.

> Sorry for all the questions on this! Software distribution is
> something I'm really not familiar with at all.

Only one way to learn... :)

This reminds me - I _really_ need to make some .debs for these...

Monty

PS. Your branch is merged, btw.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkrf7wUACgkQ2Jv7/VK1RgH1fACgxvpzGovjvZMP6768yjpztYE5
4XkAoJ7x2YBSrJSZmrzMFHaJ0w9F1UQ8
=0aOg
-----END PGP SIGNATURE-----

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'INSTALL'
--- INSTALL 2009-08-23 22:39:54 +0000
+++ INSTALL 2009-10-22 04:30:22 +0000
@@ -2,7 +2,7 @@
2*************************2*************************
33
4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,4Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
52006, 2007, 2008, 2009 Free Software Foundation, Inc.52006, 2007, 2008 Free Software Foundation, Inc.
66
7 This file is free documentation; the Free Software Foundation gives7 This file is free documentation; the Free Software Foundation gives
8unlimited permission to copy, distribute and modify it.8unlimited permission to copy, distribute and modify it.
@@ -159,7 +159,7 @@
159CC is not installed, it is recommended to use the following options in159CC is not installed, it is recommended to use the following options in
160order to use an ANSI C compiler:160order to use an ANSI C compiler:
161161
162 ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"162 ./configure CC="cc -Ae"
163163
164and if that doesn't work, install pre-built binaries of GCC for HP-UX.164and if that doesn't work, install pre-built binaries of GCC for HP-UX.
165165
@@ -174,16 +174,6 @@
174174
175 ./configure CC="cc -nodtk"175 ./configure CC="cc -nodtk"
176176
177 On Solaris, don't put `/usr/ucb' early in your `PATH'. This
178directory contains several dysfunctional programs; working variants of
179these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
180in your `PATH', put it _after_ `/usr/bin'.
181
182 On Haiku, software installed for all users goes in `/boot/common',
183not `/usr/local'. It is recommended to use the following options:
184
185 ./configure --prefix=/boot/common
186
187Specifying the System Type177Specifying the System Type
188==========================178==========================
189179
@@ -199,8 +189,7 @@
199189
200where SYSTEM can have one of these forms:190where SYSTEM can have one of these forms:
201191
202 OS192 OS KERNEL-OS
203 KERNEL-OS
204193
205 See the file `config.sub' for the possible values of each field. If194 See the file `config.sub' for the possible values of each field. If
206`config.sub' isn't included in this package, then this package doesn't195`config.sub' isn't included in this package, then this package doesn't
207196
=== modified file 'Makefile.am'
--- Makefile.am 2009-10-07 19:04:30 +0000
+++ Makefile.am 2009-10-22 04:30:22 +0000
@@ -83,10 +83,10 @@
83if BUILD_RUBY83if BUILD_RUBY
84 libswig_la_SOURCES+= interface/ruby/libdrizzle.i84 libswig_la_SOURCES+= interface/ruby/libdrizzle.i
85 nobase_rubyarch_LTLIBRARIES+= ruby/drizzle/libdrizzle.la85 nobase_rubyarch_LTLIBRARIES+= ruby/drizzle/libdrizzle.la
86 BUILT_SOURCES+= ruby/libdrizzle.cc ruby/drizzle/libdrizzle.so86 BUILT_SOURCES+= ruby/ext/libdrizzle.cc ruby/drizzle/libdrizzle.so
87 CLEANFILES+= ruby/*.db ruby/core* ruby/libdrizzle.cc ruby/drizzle/libdrizzle.so ruby/drizzle/libdrizzle.so87 CLEANFILES+= ruby/*.db ruby/core* ruby/ext/libdrizzle.cc ruby/drizzle/libdrizzle.so ruby/drizzle/libdrizzle.so
8888
89 ruby_drizzle_libdrizzle_la_SOURCES= ruby/libdrizzle.cc89 ruby_drizzle_libdrizzle_la_SOURCES= ruby/ext/libdrizzle.cc
90 ruby_drizzle_libdrizzle_la_CXXFLAGS= ${RUBY_INCLUDES}90 ruby_drizzle_libdrizzle_la_CXXFLAGS= ${RUBY_INCLUDES}
91 ruby_drizzle_libdrizzle_la_LIBADD= ${LTLIBDRIZZLE}91 ruby_drizzle_libdrizzle_la_LIBADD= ${LTLIBDRIZZLE}
92 ruby_drizzle_libdrizzle_la_LDFLAGS= -module -avoid-version92 ruby_drizzle_libdrizzle_la_LDFLAGS= -module -avoid-version
@@ -97,7 +97,7 @@
97 @rm -f ruby/drizzle/libdrizzle.so97 @rm -f ruby/drizzle/libdrizzle.so
98 @ln -s .libs/libdrizzle.so ruby/drizzle/libdrizzle.so98 @ln -s .libs/libdrizzle.so ruby/drizzle/libdrizzle.so
9999
100ruby/libdrizzle.cc: interface/ruby/libdrizzle.i100ruby/ext/libdrizzle.cc: interface/ruby/libdrizzle.i
101 $(MKDIR_P) ruby/drizzle101 $(MKDIR_P) ruby/drizzle
102 $(SWIG) -ruby -autorename -MD -MF ruby/$(DEPDIR)/$(@F).Tpo -o $@ $<102 $(SWIG) -ruby -autorename -MD -MF ruby/$(DEPDIR)/$(@F).Tpo -o $@ $<
103 @mv -f ruby/$(DEPDIR)/$(@F).Tpo ruby/$(DEPDIR)/$(@F).Plo103 @mv -f ruby/$(DEPDIR)/$(@F).Tpo ruby/$(DEPDIR)/$(@F).Plo
104104
=== modified file 'config/install-sh'
--- config/install-sh 2009-08-23 22:39:54 +0000
+++ config/install-sh 2009-10-22 04:30:22 +0000
@@ -1,7 +1,7 @@
1#!/bin/sh1#!/bin/sh
2# install - install a program, script, or datafile2# install - install a program, script, or datafile
33
4scriptversion=2009-04-28.21; # UTC4scriptversion=2006-12-25.00
55
6# This originates from X11R5 (mit/util/scripts/install.sh), which was6# This originates from X11R5 (mit/util/scripts/install.sh), which was
7# later released in X11R6 (xc/config/util/install.sh) with the7# later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,6 +515,5 @@
515# eval: (add-hook 'write-file-hooks 'time-stamp)515# eval: (add-hook 'write-file-hooks 'time-stamp)
516# time-stamp-start: "scriptversion="516# time-stamp-start: "scriptversion="
517# time-stamp-format: "%:y-%02m-%02d.%02H"517# time-stamp-format: "%:y-%02m-%02d.%02H"
518# time-stamp-time-zone: "UTC"518# time-stamp-end: "$"
519# time-stamp-end: "; # UTC"
520# End:519# End:
521520
=== added file 'ruby/CHANGELOG'
--- ruby/CHANGELOG 1970-01-01 00:00:00 +0000
+++ ruby/CHANGELOG 2009-10-22 04:30:22 +0000
@@ -0,0 +1,3 @@
1
2v0.1. Initial release.
3
04
=== added file 'ruby/LICENSE'
--- ruby/LICENSE 1970-01-01 00:00:00 +0000
+++ ruby/LICENSE 2009-10-22 04:30:22 +0000
@@ -0,0 +1,30 @@
1Copyright (C) 2009 Padraig O'Sullivan (osullivan.padraig@gmail.com)
2All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions are
6met:
7
8 * Redistributions of source code must retain the above copyright
9notice, this list of conditions and the following disclaimer.
10
11 * Redistributions in binary form must reproduce the above
12copyright notice, this list of conditions and the following disclaimer
13in the documentation and/or other materials provided with the
14distribution.
15
16 * The names of its contributors may not be used to endorse or
17promote products derived from this software without specific prior
18written permission.
19
20THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031
=== added file 'ruby/README'
--- ruby/README 1970-01-01 00:00:00 +0000
+++ ruby/README 2009-10-22 04:30:22 +0000
@@ -0,0 +1,8 @@
1These are the ruby wrappers for libdrizzle which can be used to connect
2to Drizzle or MySQL.
3
4The C++ source here is generated from SWIG. That, as well as the larger build
5process of which it is a part and from which this source package is derived
6can be checked out from launchpad via:
7
8bzr branch lp:drizzle-interface
09
=== added file 'ruby/Rakefile'
--- ruby/Rakefile 1970-01-01 00:00:00 +0000
+++ ruby/Rakefile 2009-10-22 04:30:22 +0000
@@ -0,0 +1,8 @@
1require 'echoe'
2
3Echoe.new("drizzle") do |p|
4 p.author = "Padraig O'Sullivan"
5 p.project = "drizzle"
6 p.summary = "An interface to the libdrizzle C client."
7 p.url = "http://launchpad.net/drizzle-interface"
8end
09
=== renamed file 'ruby/client.rb' => 'ruby/examples/client.rb'
=== added directory 'ruby/ext'
=== added file 'ruby/ext/extconf.rb'
--- ruby/ext/extconf.rb 1970-01-01 00:00:00 +0000
+++ ruby/ext/extconf.rb 2009-10-22 04:30:22 +0000
@@ -0,0 +1,18 @@
1require 'mkmf'
2
3HERE = File.expand_path(File.dirname(__FILE__))
4
5$CPPFLAGS = $CFLAGS = $LDFLAGS = ""
6$LDFLAGS = " -L/usr/local/lib -lstdc++ -lm -lc -lgcc_s -ldrizzle"
7
8if ENV['DEBUG']
9 puts "Setting debug flags for gem."
10 $CPPFLAGS << " -O0 -g"
11else
12 $CPPFLAGS << "-O4"
13end
14
15if have_header('libdrizzle/con_client.h')
16 create_makefile 'drizzle'
17end
18
019
=== added directory 'ruby/lib'
=== added directory 'ruby/test'
=== added file 'ruby/test/setup.rb'
--- ruby/test/setup.rb 1970-01-01 00:00:00 +0000
+++ ruby/test/setup.rb 2009-10-22 04:30:22 +0000
@@ -0,0 +1,15 @@
1
2unless defined? UNIX_SOCKET_NAME
3 HERE = File.dirname(__FILE__)
4 UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','drizzle')
5
6 # Kill drizzled
7 system("drizzle --shutdown --port=43047")
8
9 # Start drizzled
10 log = "/tmp/drizzle.log"
11 system ">#{log}"
12
13 cmd = "drizzled --no-defaults --port=43047 --basedir=/tmp --datadir=/tmp >> #{log} 2>&1 &"
14 raise "'#{cmd}' failed to start" unless system(cmd)
15end
016
=== added file 'ruby/test/test_helper.rb'
--- ruby/test/test_helper.rb 1970-01-01 00:00:00 +0000
+++ ruby/test/test_helper.rb 2009-10-22 04:30:22 +0000
@@ -0,0 +1,16 @@
1
2$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
3
4require 'rubygems'
5require 'mocha'
6
7if ENV['DEBUG']
8 require 'ruby-debug'
9end
10
11require 'drizzle'
12require 'test/unit'
13require 'ostruct'
14
15class GenericClass
16end
017
=== added directory 'ruby/test/unit'
=== added file 'ruby/test/unit/drizzle_test.rb'
--- ruby/test/unit/drizzle_test.rb 1970-01-01 00:00:00 +0000
+++ ruby/test/unit/drizzle_test.rb 2009-10-22 04:30:22 +0000
@@ -0,0 +1,32 @@
1
2require "#{File.dirname(__FILE__)}/../test_helper"
3require 'drizzle'
4require 'socket'
5require 'mocha'
6require 'benchmark'
7
8class DrizzleTest < Test::Unit::TestCase
9
10 def setup
11 @host = 'localhost'
12 @port = 43047
13 @server = Libdrizzle::Drizzle.new
14 end
15
16 # Initialize
17
18 def test_initialize
19 @con = @server.create_client_connection()
20 @con.set_db("information_schema")
21 @con.set_tcp(@host, @port)
22 @con.connect()
23 end
24
25 def simple_query
26 result = @con.buffer_query("select table_name from tables")
27 # this obviously needs to be changed...
28 assert_equal 25, result.row_count()
29 end
30
31end
32

Subscribers

People subscribed via source and target branches