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

ruby: no Ruby script found in input (LoadError) when passing ruby -S #64

Closed
cmckni3 opened this issue Jun 16, 2016 · 6 comments
Closed

Comments

@cmckni3
Copy link

cmckni3 commented Jun 16, 2016

Having the same issue that rbenv/rbenv#622 describes. I'm trying to use ruby installed from asdf with SublimeLinter rubocop

@HashNuke
Copy link
Member

@cmckni3 Thanks for reporting. I'll look into it today.

@ShallmentMo
Copy link

Same problem here. Any progress?

@nicholasjhenry
Copy link

nicholasjhenry commented Nov 20, 2016

I've taken a look at this and here are my findings:

  • the error is easy to replicate with the following: ruby -S irb #=> no Ruby script found in input (LoadError)
  • from ruby --help the -S switch "look(s) for the script using PATH environment variable"
  • the PATH environment variable will start with $HOME/.asdf/bin:/$HOME/.asdf/shims
  • therefore the "script" irb it tries to invoke is the shim located in /Users/your_username/.asdf/shims
  • the script located at $HOME/.asdf/shims/irb is not a ruby script, it's a batch script -- as a shim it will call asdf-exec to execute the script against the version of ruby specified in .tool-versions
  • because it's not a ruby script (i.e. does not start with #!/usr/bin/env ruby), it results in the error no Ruby script found in input (LoadError)
  • what we really want is to execute the script, in the case irb, from the installed ruby e.g. $HOME/.asdf/installs/ruby/2.3.2/bin

I've come up with a solution that resolves the error, but unsure if this is the direction you would like to take. I've simply prepended the install_path of the desired ruby version to PATH at the end of $HOME/.asdf/plugins/ruby/bin/exec-env. This is the line I appended:

 export PATH=$install_path/bin:$PATH

The path could be prepended conditionally based on the -S switch being present. If this is acceptable solution I'm happy to create a PR for https://github.com/asdf-vm/asdf-ruby. Please let me know.

@ShallmentMo
Copy link

ShallmentMo commented Nov 21, 2016

@nicholasjhenry this work for me. Thanks a lot.

@lobo-tuerto
Copy link

Just found this issue when trying to run rake cucumber on a Rails project. Got around it meanwhile running cucumber directly without rake.

@edjames
Copy link

edjames commented Feb 9, 2017

Hi,

Please can someone kindly provide an update with regards to this issue?
The workaround suggested by @nicholasjhenry works perfectly well for me but I really don't like have to hack installed files in this way.

Given this was raised around 3 months ago can I be so bold as to suggest you either accept a pull request or you close this issue.

Keep up the fantastic work though - asdf is a fantastic tool!

Thanks.

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

No branches or pull requests

7 participants