Installing software


Well, my next job will be making these pages:

http://anbg.gov.au/cgi-bin/apclist (and all the rest of ’em)

Into a RoR app. Sounds easy. But there are a couple dozen individual cgi scripts, which use a common framework, which has changed over time. And it’s powered by its very own configuration language.

And it’s in Perl. Which – currently – I do not speak.

So. Software! Not including too much about all of the false starts which consumed my weekend:

Ruby 2 from macports
Had to get rid of an old version lying about in /usr/local. Tried compiling from source (you know that the ruby build relies on you having a preexisting working copy of ruby?). Couldn’t make it run – library paths &etc.
“Use homebrew! Homebrew is way better!” No way. homebrew relies on ruby, which is exactly the bit I am having trouble with. Homebrew insists on being run as root, won’t install to a user subdirectory, won’t play nice with macports, which I use for a number of things.
No. I have too many other things which I will not risk screwing up.
Eventually:

#port deactivate active
# port install ruby20
# port select ruby ruby20 (or something like that)

/opt/local/bin on the path, and booyah

ibis@dhcp-128:~$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin11]
ibis@dhcp-128:~$ 
Rails 4
$ export GEM_HOME=~/gems
$ gem install rails

No worries whatever – all you need to do is explain to gem that you are not attempting to put things in the system gemfile.

cgi
Rather than setting up a webserver, I intend to run the existing cgi stuff (which I need to do to understand the existing functionality) at the command line. Thus, the simple test script that I wish to get going is:

#!/bin/bash
export REQUEST_METHOD=GET
export QUERY_STRING=NAME=Doodia
./apclist

which is eqivalent to navigating to http://anbg.gov.au/cgi-bin/apclist?NAME=Doodia

perl
Comes with apple. Works out of the box. Before this process, I deactivated every single macport because I know I have some rubbish in there.
perl-oracle bridge
Sweet jesus. I eventually got DBC-Oracle and made/installed it as root. I dislike doing this, but it worked. Before it did work, however:

oracle instant client
The DBD build needs the instant client sdk and libraries. Had the 10.2 instant client. 64 bit never really worked on my machine, and DBD-Oracle just would not work with the 32-bit version. I don’t like to touch oracle instant client because I have stuff that depends on it and it’s finicky.
But, we have moved to 11.2 on the servers anyway. So I downloaded all components of the 32 and 64 bit clients (except that you only want one of either basic or basic lite), mashed them together and symlinked:

ibis@dhcp-128:/opt/oracle$ ls -l
total 8
lrwxr-xr-x   1 ibis  admin   21  1 Oct 17:46 instantclient -> instantclient_11_2-64
drwxr-xr-x@ 24 ibis  staff  816  1 Oct 16:23 instantclient_10_2
drwxr-xr-x  22 ibis  admin  748  1 Oct 16:24 instantclient_10_2-x64
drwxr-xr-x  22 ibis  admin  748  1 Oct 17:45 instantclient_11_2-32
drwxr-xr-x  27 ibis  admin  918  1 Oct 17:46 instantclient_11_2-64
ibis@dhcp-128:/opt/oracle$ 

My PATH and DYLD_LIBRARY_PATH already include the instant client. DBD-Oracle built, tested, and installed ok.

Final part was getting the TNS name happening. Normally you go to that network directory and fiddle with SQL*Net config. But for a developer box, it’s easier just to use an explicit connection string. So I just told the perl scripts that the oracle TNS name was not
@PRODBOX; but
@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=prodbox ip)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=prodbox service)))

And hallelujah, my test script ran and spat back what looks like correct html.

Oh – I should also mention. Eclipse plugins. I’m running a new install of eclipse (Kepler), so was missing some plugins I was previously using.

Perl editor – http://e-p-i-c.sf.net/updates
Bash editor – http://sourceforge.net/projects/shelled/files/shelled/update/

So. Now I can run the existing code locally, fool with it, attempt to understand it well enough to replicate its functionality in RoR (with new spiffiness, most particularly WCAG compliance as far as is practicable).

Ruby editor? Don’t really want to install a whole new thing. XCode, interestingly, is the default system editor for .rb files and seems to read them ok.

Lessons learned:

  • MacPorts is ok for ruby 2.0
  • Don’t bother with trying to install it in a user directory
  • Install all of the oracle instant client, don’t bother not installing bits you think you wont need

Now all I need to do is … is everything else.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: