Giter Site home page Giter Site logo

Comments (6)

nicholasjhenry avatar nicholasjhenry commented on May 6, 2024 2

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.

from asdf.

lobo-tuerto avatar lobo-tuerto commented on May 6, 2024 1

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

from asdf.

edjames avatar edjames commented on May 6, 2024 1

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.

from asdf.

HashNuke avatar HashNuke commented on May 6, 2024

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

from asdf.

ShallmentMo avatar ShallmentMo commented on May 6, 2024

Same problem here. Any progress?

from asdf.

ShallmentMo avatar ShallmentMo commented on May 6, 2024

@nicholasjhenry this work for me. Thanks a lot.

from asdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.