[racket] Current advice on making a 'script'
Jay, hello.
> On 2015 Jan 14, at 13:41, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>
> 1. Create a directory where the files will go: $ROOT
>
> I do this anyways, because everything is in git somewhere.
>
> 2. Make prog.sh in $ROOT that looks like this:
>
> #!/bin/sh
>
> cd $(dirname $(grealpath $0))
> racket -t prog.rkt
>
> 3. Link $ROOT/prog.sh into my ~/bin as 'prog'
Sure -- that's what I was thinking of when saying 'installed a bunch of files in a directory tree along with a launch script' (and using exec, of course).
But the problem with that is that it's inherently a rather more ...floppy object. My 'make install' actions would probably do something like install the various .rkt files into ~/local/bin/prog.contents/ and make the link from ~/local/bin/prog -> ~/local/bin/prog.contents/launch-prog.sh. But one doesn't typically expect a script to have a directory attached to it (ie, this smells non-standard, and there isn't really a standard place for such a prog.contents/ directory to go), and it means that if I blow away ~/local/bin/prog I have to remember to delete prog.contents, too.
Also if, in this scenario, I delete $ROOT because I think it's redundant and I've forgotten about the link, then ~/local/bin/prog has broken without me realising it.
Having ~/local/bin/prog link to the live checked-out files means that I can't hack away at those and be sure that the 'stable' version in ~/local/bin/prog is still working.
None of the above are grievous problems -- I could live with all of them -- but they're less neat than 'here is a script file; put it somewhere in your path'.
Perhaps the concatenate-with-rewriting is the best solution here, after all.
All the best,
Norman
--
Norman Gray : http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK