On 1/13/06, David Vallner wrote:
> On Fri, 13 Jan 2006 18:50:59 +0100, Thomas wrote:
>
> >> Thanks. I didn't think about creating another ruby.bat file. There's a
> >> "cygpath" utility in cygwin, but I didn't figure out yet how to use it
> >> to call another program an to tell him which paths to use.
> >
> > I think you can run ruby using something like
> >
> > bash -c "ruby '$(cygpath -u %1)' %2 %3 %4 %5 %6 %7 %8 %9"
> >
> > Maybe you could put this into some kind of ruby.bat. I don't know if
> > cmd.exe provided this kind of substitution which would make things
> > easier.

This command looks promising. I can't test it before monday, but I
hope that it will solve the problem. Thanks a lot.

> There might be issues if ConTeXt is hardcoded ro run "ruby.exe", instead
> of just "ruby" in a subshell. This is probably the first and last time I
> see something that could be done with exec() instead of spawning a
> subprocess...

It's not "ruby.exe", only "ruby". (If the problem was in ConTeXt, the
developer would fix it within a couple of minutes/hours. If some
software has to be installed by the admin on Windows on our computers,
there's very little chance that it would be done before the summer.)

> The above command line should have "ruby.exe" instead of just ruby,
> otherwise the BAT script would recurse forever. It seems you have the
> Cygwin\bin on the path already, so that should be fine. Unfortunately,
> despite the fact CMD came pretty close to a usable shell in XP, you still
> have to do the batch argument hack there - it seems you can't specify "all
> arguments after and including the second".
>
> If by any chance the argument hack breaks ConTeXt, or that runs ruby with
> some switches before the script filename, you can always have ruby.bat do
> "ruby.js %*", and have the JScript play around with the arguments, like
> finding the one that ends with ".rb" and then have cygpath have a go at
> it. And afterwards, give your local admin a printout of this thread, and a
> five dollar note saying "here, go buy a clue".

Thanks for additional notes. I hope that I won't need such deeps hacks
as writing js code to parse the command line, but let's try the above
first and think further if it fails.

> >> I don't have ConTeXt installed under cygwin
> >
> > But which probably is the way to go here.
> >
> > Even if you don't have administration rights, you should be able to
> > compile it from source & install it in your user dir. (Maybe, somehow.)
> >
>
> It should be doable. Configure it with "./configure --prefix='~'" and it
> should work. You might want to modify .profile to put ~/bin at the start
> of PATH. And you also have to tell the linker where to find ~/lib, but
> someone else will have to elucidate on that, I'm not very (at all)
> experienced in ways *nixy that involve playing with the dynamic linking.

I don't doubt that it's doable, but I would prefer trying just
anything else before this. Besides I see no reason why to do it if the
current installation is generally working (except for some modules
which require additional libraries). I have enough problems with
MikTeX installation (which is tested pretty well) - I don't dare even
think about all the possible problems and bugs on cygwin (two were
already fixed during my last failures to make ConTeXt work on those
computers). Installing it on each single computer without an automated
update mechanism (and updates come out approximately every 10 days)?
If I ask the admin to install tetex under cygwin, it will interfere
with the existing MikTeX and so on ... It sounds more like a nightmare
than a serious alternative.

nobu / ruby-lang.org wrote:
> Hi,
>
> Mojca Miklavec wrote in [ruby-talk:175655]:
> > But if I execute the script from somewhere else, inclusion doesn't
> > work any more:
> >
> > C:/mypath/myscript.rb:10:in `require': No such file to load -- mylib (LoadError)
> >         from C:/mypath/myscript.rb:10
> >
> > since File.dirname(__FILE__) is now set to "c:\mypath" and this one
> > also gets included in $LOAD_PATH. But cygwin cannot access that path
> > by default.
>
> Sounds strange.  File.dirname("C:/mypath/myscript.rb") is
> "c:\mypath" but not "c:/mypath"?  How do you add it to
> $LOAD_PATH?

I guess these lines do it (http://source.contextgarden.net/newpstopdf.rb):

unless defined? ownpath
    ownpath = $0.sub(/[\\\/]\w*?\.rb/i,'')
    $: << ownpath
end

But it works ok on Windows (if there's no cygwin interference).

Thanks to everyone for suggestions, I'll report about success/failure
on Monday once I come back to the university,
    Mojca