Thursday, March 26, 2009

ocaml batteries on Ubuntu

OCaml is a functional programming language. I'm trying to learn it right now, but it clearly has a steep learning curve, especially if you aren't familiar with functional programming languages. It does seem impressive in many ways, but we'll see, eh?

Anyway, the standard library seems a little sparse, so I am trying to install 'batteries'. Turns out it wants some dependencies to build and they aren't entirely straightforward. Here's how to get it building:

sudo aptitude install libcamomile-ocaml-dev libzip-ocaml-dev libtype-conv-camlp4-dev
libsexplib-ocaml-dev libbin-prot-camlp4-dev libocamlnet-ocaml-dev

(do we need libmagic-ocaml-dev ??)
This is super weird, you have to configure the program as super user because it wants to make a directory for batteries in /usr/local. Anyway, here's the install

sudo ./configure
sudo make all opt install install-doc

And it does take forever to make the documentation (maybe 5 minutes to install on my computer).

Friday, March 6, 2009

how to set up your own git repository with only a server, ssh, and git

This assumes you have ssh access to a server somewhere which you want to use as a sort of centralized repository and that server and your local machine have git on them. Don't tell anyone I used centralized and git in the same sentence, but centralized makes a lot of sense to me for lots of things, especially my own projects.

I'll do it the long way first and then with a tiny bit of bash scripting:

# ssh into your server
ssh jtprince@yourserver.domain.edu
# on remote machine:
mkdir git
mkdir git/project1.git && cd git/project1.git
git --bare init
exit

# on local machine
mkdir project1 && cd project1  # if you don't already have a project
# make a commit (you need at least one commit)
git init
echo "some text" > file.txt
git add .
git commit -m 'init commit'

# now we will push it to the server
git push ssh://jtprince@yourserver.domain.edu/home/jtprince/git/project1.git master

# we still need to link our git folder with the server
git remote add origin ssh://jtprince@yourserver.domain.edu/home/jtprince/git/project1.git
git config branch.master.remote origin
git config branch.master.merge refs/heads/master

Now for the BASH scripting I promised. This is basically the same thing but maybe a little easier to copy and paste once you set up your variables:

SERVER='jtprince@yourserver.domain.edu'
PROJ="project2"
PROJ_URL="ssh://$SERVER/home/jtprince/git/${PROJ}.git"

# set up the remote git repo in one command:
ssh $SERVER "mkdir git/${PROJ}.git; cd git/${PROJ}.git; git --bare init"

# (inside your project directory... with files/dirs already present):
git init ; git add . ; git commit -m 'init commit'; git push $PROJ_URL master ; git remote add origin $PROJ_URL ; git config branch.master.remote origin ; git config branch.master.merge refs/heads/master


And my rant...

At least in the ruby and linux developer community, Git seems to be quite hip right now. I personally think bazaar wipes git all over the floor, but due to server circumstances beyond my control I need to version control my files with git.

While the above operation is CLEARLY and SUCCINCTLY documented in the main bazaar docs, I've had to piece this together myself for git. Now, I suppose if I had actually read and digested the volumes of arcane documentation, switches, and nuances of git, I wouldn't be griping right now. That said, projects like 'eg' can make it easier and I'm sure the things people want to do with a vcs will become documented soon enough in git... the beauties of open source.