Plea for not having to put it in the path [again]

I am always surprised when I run into things like this:

$ ~/dev/downloads/jruby/bin/jirb
/usr/bin/env: jruby: No such file or directory

MRI doesn’t do this, so I think it’s something jruby should consider for
ease of use/testing.
Thanks!
-r

On Fri, Jan 15, 2010 at 9:36 PM, Roger P. [email protected]
wrote:

I am always surprised when I run into things like this:

$ ~/dev/downloads/jruby/bin/jirb
/usr/bin/env: jruby: No such file or directory

MRI doesn’t do this, so I think it’s something jruby should consider for
ease of use/testing.
Thanks!

There are a few reasons we do this:

  • You are not installing JRuby in a global location, so we don’t know
    where the jruby executable is located
  • Our jruby executable is a bash script, and you can’t put bash
    scripts directly in the shebang line of other scripts

As far as I know, there’s no other way to handle this situation since
the jirb script is just ruby code. Do you have any suggestions?

If we are able to get a native executable in place for JRuby 1.5, the
situation should improve somewhat.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Roger,

On Sat, Jan 16, 2010 at 4:36 AM, Roger P. [email protected]
wrote:

I am always surprised when I run into things like this:

$ ~/dev/downloads/jruby/bin/jirb
/usr/bin/env: jruby: No such file or directory

MRI doesn’t do this, so I think it’s something jruby should consider for
ease of use/testing.

For those who don’t want to put JRuby on PATH, and for those who must
make sure they run the scripts with the proper version, we always
recommend to use

path/to/jruby -S script-name

So, there is a rather simple workaround for this problem.

Plus, on Windows, jirb.BAT file actually will use jruby from the same
place where jirb is, so the problem doesn’t exist there :slight_smile:

Personally, I don’t find the PATH manipulation that bad. With tools
like pik on Windows and rvm on Unix/MacOS, switching between
implementations and adjusting the paths along the way is a trivial
(and convenient) task.

Thanks,
–Vladimir


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Sat, Jan 16, 2010 at 7:17 PM, Roger P. [email protected]
wrote:

Hmm.
question.
Why doesn’t jirb know what directory jruby was installed into? Â Is there
some reason why you don’t just hard-code it to the full path when they
run “rake build” or what not (this forces it to remain in just one
directory forever–but it’s what MRI does on Linux).

Many people installing JRuby installing JRuby never run anything other
than tar xzf…we ship a fully-functional JRuby in the tarball.

For people that actually do run something to install, we could
hardcode the paths in that case. How did you install JRuby in your
case?

hmm…
Sure, that would probably work fine for Windows, but there’s no easy
equivalent for *nix since the jirb script is just Ruby code, and you
can only fit so much logic into the shebang line. You’ll note that on
*nix it’s not possible to run MRI without installing it somehow,
since it does hardcode those paths when it installs:

~ âž” head -1 which irb
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Many people installing JRuby installing JRuby never run anything other
than tar xzf…we ship a fully-functional JRuby in the tarball.

For people that actually do run something to install, we could
hardcode the paths in that case. How did you install JRuby in your
case?

rake build :slight_smile:

Sure, that would probably work fine for Windows, but there’s no easy
equivalent for *nix since the jirb script is just Ruby code, and you
can only fit so much logic into the shebang line. You’ll note that on
*nix it’s not possible to run MRI without installing it somehow,
since it does hardcode those paths when it installs:

wrappers no? [like jirb => .jirb or what not]
-r

On Mon, Jan 18, 2010 at 9:58 PM, Roger P. [email protected]
wrote:

Many people installing JRuby installing JRuby never run anything other
than tar xzf…we ship a fully-functional JRuby in the tarball.

For people that actually do run something to install, we could
hardcode the paths in that case. How did you install JRuby in your
case?

rake build :slight_smile:

Certainly not our rake build…but I think we’d love to have an
install task that basically does the right thing. Maybe you can help
us put one together?

Sure, that would probably work fine for Windows, but there’s no easy
equivalent for *nix since the jirb script is just Ruby code, and you
can only fit so much logic into the shebang line. You’ll note that on
*nix it’s not possible to run MRI without installing it somehow,
since it does hardcode those paths when it installs:

wrappers no? [like jirb => .jirb or what not]

I don’t understand.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

If we are able to get a native executable in place for JRuby 1.5, the
situation should improve somewhat.

Hmm.
question.
Why doesn’t jirb know what directory jruby was installed into? Is there
some reason why you don’t just hard-code it to the full path when they
run “rake build” or what not (this forces it to remain in just one
directory forever–but it’s what MRI does on Linux).

On windows, MRI doesn’t have this limitation, as it sets the path first.
Something like this might help (it causes an extra wrapper…windows
does it this way by having the .bat file wrap the rb file):

file bin/jirb2:
#!/usr/bin/env bash
WorkDir=dirname "$0"
export PATH=$WorkDir:$PATH
$WorkDir/jirb

hmm…

like jirb2 in this example:
http://www.ruby-forum.com/topic/202241#880805

You could conceivably use the -x command-line parameter when calling
jruby from the shell script, and then put the Ruby script in the same
file.

But wouldn’t it be even simpler to have the shell script execute jruby
-S irb ?

TX


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Jan 19, 2010 at 11:29 AM, Roger P. [email protected]
wrote:

rake build :slight_smile:

Certainly not our rake build…but I think we’d love to have an
install task that basically does the right thing. Maybe you can help
us put one together?

“Certainly not” meaning I didn’t use your rake build, or you won’t allow
it for your rake build?

Meaning our rake build doesn’t have any global install target right
now. It would be a nice thing to have, though, possibly with
appropriate patches from one of the Linux dists to bin/jruby so it
runs in an “exploded” form.

wrappers no? [like jirb => .jirb or what not]

like jirb2 in this example:
http://www.ruby-forum.com/topic/202241#880805

Ahh, sure…that would certainly be one way to handle it. In MRI, I
believe “irb” and friends are installed with hardcoded shebang paths,
right? If we had an installer and a native executable, that would be
the way to go; otherwise, we have the whole “bash scripts can’t be in
shebangs” issue.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

rake build :slight_smile:

Certainly not our rake build…but I think we’d love to have an
install task that basically does the right thing. Maybe you can help
us put one together?

“Certainly not” meaning I didn’t use your rake build, or you won’t allow
it for your rake build?

wrappers no? [like jirb => .jirb or what not]

like jirb2 in this example:
http://www.ruby-forum.com/topic/202241#880805

Thanks.
-r

On Mon, Feb 1, 2010 at 10:40 AM, Roger P. [email protected]
wrote:

Mmm. Â I will describe it thus, then. Â I go a git clone of the repo, go
into it, run “rake build”, then run jruby out of the /bin directory of
the repo (no install, per se).

Ok, then I agree…we should install the gems during whatever target
“rake” uses to “give me a fully-working jruby install from this
checkout”. File a bug please?

Ahh, sure…that would certainly be one way to handle it. In MRI, I
believe “irb” and friends are installed with hardcoded shebang paths,
right? If we had an installer and a native executable, that would be
the way to go; otherwise, we have the whole “bash scripts can’t be in
shebangs” issue.

That’s right for MRI–except for MRI on windows, which…uses a batch
file which runs the ruby.exe “from the same dir as the batch file is
in.”

On Windows, we should do the same thing (and maybe do already?) since
we have a native .exe now…

Native executable is the key to simplifying things on all platforms,
but we will still need solutions that work with bash script alone :frowning:
Makes my head hurt!

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Charles Nutter wrote:

On Tue, Jan 19, 2010 at 11:29 AM, Roger P. [email protected]
wrote:

rake build :slight_smile:

Certainly not our rake build…but I think we’d love to have an
install task that basically does the right thing. Maybe you can help
us put one together?

“Certainly not” meaning I didn’t use your rake build, or you won’t allow
it for your rake build?

Meaning our rake build doesn’t have any global install target right
now. It would be a nice thing to have, though, possibly with
appropriate patches from one of the Linux dists to bin/jruby so it
runs in an “exploded” form.

Mmm. I will describe it thus, then. I go a git clone of the repo, go
into it, run “rake build”, then run jruby out of the /bin directory of
the repo (no install, per se).

wrappers no? [like jirb => .jirb or what not]

like jirb2 in this example:
http://www.ruby-forum.com/topic/202241#880805

Ahh, sure…that would certainly be one way to handle it. In MRI, I
believe “irb” and friends are installed with hardcoded shebang paths,
right? If we had an installer and a native executable, that would be
the way to go; otherwise, we have the whole “bash scripts can’t be in
shebangs” issue.

That’s right for MRI–except for MRI on windows, which…uses a batch
file which runs the ruby.exe “from the same dir as the batch file is
in.”

HTH
-r

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs