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
1=== modified file 'INSTALL'
2--- INSTALL 2009-08-23 22:39:54 +0000
3+++ INSTALL 2009-10-22 04:30:22 +0000
4@@ -2,7 +2,7 @@
5 *************************
6
7 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
8-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
9+2006, 2007, 2008 Free Software Foundation, Inc.
10
11 This file is free documentation; the Free Software Foundation gives
12 unlimited permission to copy, distribute and modify it.
13@@ -159,7 +159,7 @@
14 CC is not installed, it is recommended to use the following options in
15 order to use an ANSI C compiler:
16
17- ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
18+ ./configure CC="cc -Ae"
19
20 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
21
22@@ -174,16 +174,6 @@
23
24 ./configure CC="cc -nodtk"
25
26- On Solaris, don't put `/usr/ucb' early in your `PATH'. This
27-directory contains several dysfunctional programs; working variants of
28-these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
29-in your `PATH', put it _after_ `/usr/bin'.
30-
31- On Haiku, software installed for all users goes in `/boot/common',
32-not `/usr/local'. It is recommended to use the following options:
33-
34- ./configure --prefix=/boot/common
35-
36 Specifying the System Type
37 ==========================
38
39@@ -199,8 +189,7 @@
40
41 where SYSTEM can have one of these forms:
42
43- OS
44- KERNEL-OS
45+ OS KERNEL-OS
46
47 See the file `config.sub' for the possible values of each field. If
48 `config.sub' isn't included in this package, then this package doesn't
49
50=== modified file 'Makefile.am'
51--- Makefile.am 2009-10-07 19:04:30 +0000
52+++ Makefile.am 2009-10-22 04:30:22 +0000
53@@ -83,10 +83,10 @@
54 if BUILD_RUBY
55 libswig_la_SOURCES+= interface/ruby/libdrizzle.i
56 nobase_rubyarch_LTLIBRARIES+= ruby/drizzle/libdrizzle.la
57- BUILT_SOURCES+= ruby/libdrizzle.cc ruby/drizzle/libdrizzle.so
58- CLEANFILES+= ruby/*.db ruby/core* ruby/libdrizzle.cc ruby/drizzle/libdrizzle.so ruby/drizzle/libdrizzle.so
59+ BUILT_SOURCES+= ruby/ext/libdrizzle.cc ruby/drizzle/libdrizzle.so
60+ CLEANFILES+= ruby/*.db ruby/core* ruby/ext/libdrizzle.cc ruby/drizzle/libdrizzle.so ruby/drizzle/libdrizzle.so
61
62- ruby_drizzle_libdrizzle_la_SOURCES= ruby/libdrizzle.cc
63+ ruby_drizzle_libdrizzle_la_SOURCES= ruby/ext/libdrizzle.cc
64 ruby_drizzle_libdrizzle_la_CXXFLAGS= ${RUBY_INCLUDES}
65 ruby_drizzle_libdrizzle_la_LIBADD= ${LTLIBDRIZZLE}
66 ruby_drizzle_libdrizzle_la_LDFLAGS= -module -avoid-version
67@@ -97,7 +97,7 @@
68 @rm -f ruby/drizzle/libdrizzle.so
69 @ln -s .libs/libdrizzle.so ruby/drizzle/libdrizzle.so
70
71-ruby/libdrizzle.cc: interface/ruby/libdrizzle.i
72+ruby/ext/libdrizzle.cc: interface/ruby/libdrizzle.i
73 $(MKDIR_P) ruby/drizzle
74 $(SWIG) -ruby -autorename -MD -MF ruby/$(DEPDIR)/$(@F).Tpo -o $@ $<
75 @mv -f ruby/$(DEPDIR)/$(@F).Tpo ruby/$(DEPDIR)/$(@F).Plo
76
77=== modified file 'config/install-sh'
78--- config/install-sh 2009-08-23 22:39:54 +0000
79+++ config/install-sh 2009-10-22 04:30:22 +0000
80@@ -1,7 +1,7 @@
81 #!/bin/sh
82 # install - install a program, script, or datafile
83
84-scriptversion=2009-04-28.21; # UTC
85+scriptversion=2006-12-25.00
86
87 # This originates from X11R5 (mit/util/scripts/install.sh), which was
88 # later released in X11R6 (xc/config/util/install.sh) with the
89@@ -515,6 +515,5 @@
90 # eval: (add-hook 'write-file-hooks 'time-stamp)
91 # time-stamp-start: "scriptversion="
92 # time-stamp-format: "%:y-%02m-%02d.%02H"
93-# time-stamp-time-zone: "UTC"
94-# time-stamp-end: "; # UTC"
95+# time-stamp-end: "$"
96 # End:
97
98=== added file 'ruby/CHANGELOG'
99--- ruby/CHANGELOG 1970-01-01 00:00:00 +0000
100+++ ruby/CHANGELOG 2009-10-22 04:30:22 +0000
101@@ -0,0 +1,3 @@
102+
103+v0.1. Initial release.
104+
105
106=== added file 'ruby/LICENSE'
107--- ruby/LICENSE 1970-01-01 00:00:00 +0000
108+++ ruby/LICENSE 2009-10-22 04:30:22 +0000
109@@ -0,0 +1,30 @@
110+Copyright (C) 2009 Padraig O'Sullivan (osullivan.padraig@gmail.com)
111+All rights reserved.
112+
113+Redistribution and use in source and binary forms, with or without
114+modification, are permitted provided that the following conditions are
115+met:
116+
117+ * Redistributions of source code must retain the above copyright
118+notice, this list of conditions and the following disclaimer.
119+
120+ * Redistributions in binary form must reproduce the above
121+copyright notice, this list of conditions and the following disclaimer
122+in the documentation and/or other materials provided with the
123+distribution.
124+
125+ * The names of its contributors may not be used to endorse or
126+promote products derived from this software without specific prior
127+written permission.
128+
129+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
130+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
131+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
132+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
133+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
134+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
135+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
136+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
137+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
138+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
139+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
140
141=== added file 'ruby/README'
142--- ruby/README 1970-01-01 00:00:00 +0000
143+++ ruby/README 2009-10-22 04:30:22 +0000
144@@ -0,0 +1,8 @@
145+These are the ruby wrappers for libdrizzle which can be used to connect
146+to Drizzle or MySQL.
147+
148+The C++ source here is generated from SWIG. That, as well as the larger build
149+process of which it is a part and from which this source package is derived
150+can be checked out from launchpad via:
151+
152+bzr branch lp:drizzle-interface
153
154=== added file 'ruby/Rakefile'
155--- ruby/Rakefile 1970-01-01 00:00:00 +0000
156+++ ruby/Rakefile 2009-10-22 04:30:22 +0000
157@@ -0,0 +1,8 @@
158+require 'echoe'
159+
160+Echoe.new("drizzle") do |p|
161+ p.author = "Padraig O'Sullivan"
162+ p.project = "drizzle"
163+ p.summary = "An interface to the libdrizzle C client."
164+ p.url = "http://launchpad.net/drizzle-interface"
165+end
166
167=== renamed file 'ruby/client.rb' => 'ruby/examples/client.rb'
168=== added directory 'ruby/ext'
169=== added file 'ruby/ext/extconf.rb'
170--- ruby/ext/extconf.rb 1970-01-01 00:00:00 +0000
171+++ ruby/ext/extconf.rb 2009-10-22 04:30:22 +0000
172@@ -0,0 +1,18 @@
173+require 'mkmf'
174+
175+HERE = File.expand_path(File.dirname(__FILE__))
176+
177+$CPPFLAGS = $CFLAGS = $LDFLAGS = ""
178+$LDFLAGS = " -L/usr/local/lib -lstdc++ -lm -lc -lgcc_s -ldrizzle"
179+
180+if ENV['DEBUG']
181+ puts "Setting debug flags for gem."
182+ $CPPFLAGS << " -O0 -g"
183+else
184+ $CPPFLAGS << "-O4"
185+end
186+
187+if have_header('libdrizzle/con_client.h')
188+ create_makefile 'drizzle'
189+end
190+
191
192=== added directory 'ruby/lib'
193=== added directory 'ruby/test'
194=== added file 'ruby/test/setup.rb'
195--- ruby/test/setup.rb 1970-01-01 00:00:00 +0000
196+++ ruby/test/setup.rb 2009-10-22 04:30:22 +0000
197@@ -0,0 +1,15 @@
198+
199+unless defined? UNIX_SOCKET_NAME
200+ HERE = File.dirname(__FILE__)
201+ UNIX_SOCKET_NAME = File.join(ENV['TMPDIR']||'/tmp','drizzle')
202+
203+ # Kill drizzled
204+ system("drizzle --shutdown --port=43047")
205+
206+ # Start drizzled
207+ log = "/tmp/drizzle.log"
208+ system ">#{log}"
209+
210+ cmd = "drizzled --no-defaults --port=43047 --basedir=/tmp --datadir=/tmp >> #{log} 2>&1 &"
211+ raise "'#{cmd}' failed to start" unless system(cmd)
212+end
213
214=== added file 'ruby/test/test_helper.rb'
215--- ruby/test/test_helper.rb 1970-01-01 00:00:00 +0000
216+++ ruby/test/test_helper.rb 2009-10-22 04:30:22 +0000
217@@ -0,0 +1,16 @@
218+
219+$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
220+
221+require 'rubygems'
222+require 'mocha'
223+
224+if ENV['DEBUG']
225+ require 'ruby-debug'
226+end
227+
228+require 'drizzle'
229+require 'test/unit'
230+require 'ostruct'
231+
232+class GenericClass
233+end
234
235=== added directory 'ruby/test/unit'
236=== added file 'ruby/test/unit/drizzle_test.rb'
237--- ruby/test/unit/drizzle_test.rb 1970-01-01 00:00:00 +0000
238+++ ruby/test/unit/drizzle_test.rb 2009-10-22 04:30:22 +0000
239@@ -0,0 +1,32 @@
240+
241+require "#{File.dirname(__FILE__)}/../test_helper"
242+require 'drizzle'
243+require 'socket'
244+require 'mocha'
245+require 'benchmark'
246+
247+class DrizzleTest < Test::Unit::TestCase
248+
249+ def setup
250+ @host = 'localhost'
251+ @port = 43047
252+ @server = Libdrizzle::Drizzle.new
253+ end
254+
255+ # Initialize
256+
257+ def test_initialize
258+ @con = @server.create_client_connection()
259+ @con.set_db("information_schema")
260+ @con.set_tcp(@host, @port)
261+ @con.connect()
262+ end
263+
264+ def simple_query
265+ result = @con.buffer_query("select table_name from tables")
266+ # this obviously needs to be changed...
267+ assert_equal 25, result.row_count()
268+ end
269+
270+end
271+

Subscribers

People subscribed via source and target branches