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