Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcing jruby-complete to execute a command. #1218

Closed
blerins opened this issue Nov 12, 2013 · 3 comments
Closed

Forcing jruby-complete to execute a command. #1218

blerins opened this issue Nov 12, 2013 · 3 comments

Comments

@blerins
Copy link

blerins commented Nov 12, 2013

Hello!

I'm having some troubles with jruby-complete in environements with rbenv.

$ echo $PATH
/home/blerins/.rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$ java -Djruby.debug.scriptResolution=true -jar target/lib/jruby-complete.jar -S gem install bundler
Found: /home/blerins/.rbenv/shims/gem
SyntaxError: /home/blerins/.rbenv/shims/gem:3: syntax error, unexpected tSTRING_BEG

[ -n "$RBENV_DEBUG" ] && set -x
     ^
$ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$ java -Djruby.debug.scriptResolution=true -jar target/lib/jruby-complete.jar -S gem install bundler
Successfully installed bundler-1.3.5
1 gem installed

As seen at:

// run as a command if we couldn't find a script

JRuby always tries to find the script first, I was wondering if there is any possibility to force Jruby to ejecute a command.

related: rbenv/rbenv#467

Thanks!

@BanzaiMan
Copy link
Member

I think there is a bug where the files inside the JAR is not found correctly. Before searching in $PATH, we should be looking inside the JAR, and find META-INF/jruby.home/bin/gem, but aren't.

Quite possibly a different manifestation of #1031.

@mkristian
Copy link
Member

well, I do see that error quite regularly :(

but my setup is probably a bit unusual: I manage my MRI with rbenv but added jruby to PATH. that allows me to switch fast to jruby by adding 'j' and to call
jruby -S gem
jruby -S irb
etc

gem,irb, etc are usually a ruby scripts and things just work fine. with having $HOME/.rbenv/shims in the path those scripts are bash scripts :(

but looking through my
~/.rbenv/shims/
directory reveals a lot of scripts which very much look like they come from installed gems:
ast erb jbundle jruby rails rspec turn
autospec gem jgem jrubyc rake ruby
convert_to_should_syntax htmldiff jirb ldiff rdoc testrb
copyright-header irb jirb_swing nbundle ri thin

they all will fail like
java -jar jruby-complete.jar -S thin
because there will never be a thin bin stub within jruby-complete !

I agreee with @BanzaiMan that jruby should look first in the jar before looking on the PATH but it is only a partial solution for the above given problem.

@mkristian
Copy link
Member

fixed via fcec818

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants