Giter VIP home page Giter VIP logo

Comments (16)

postmodern avatar postmodern commented on June 29, 2024

Yes, this is because chruby loads Rubies at startup. I could add a chruby_load function?

from chruby.

teohm avatar teohm commented on June 29, 2024

Ya, that will be great!

Or is it possible to always reload the list, right before we run chruby to list the installed rubies?

from chruby.

postmodern avatar postmodern commented on June 29, 2024

Not currently, since users can explicitly define RUBIES with custom globs.

from chruby.

teohm avatar teohm commented on June 29, 2024

I see, what chruby_load function that you suggested will do?

from chruby.

postmodern avatar postmodern commented on June 29, 2024

Probably just these two lines. chruby_load would then be called at the bottom of the script.

from chruby.

teohm avatar teohm commented on June 29, 2024

Ah I see, that should work.

BTW, as I don't explicitly define RUBIES myself, each time I run: source ~/.bashrc, the items in RUBIES list will be doubled with duplicates.

from chruby.

postmodern avatar postmodern commented on June 29, 2024

ah good catch. I guess chruby_load should re-set RUBIES.

from chruby.

teohm avatar teohm commented on June 29, 2024

👍

from chruby.

postmodern avatar postmodern commented on June 29, 2024

0.3.3 will initialize RUBIES to () on load. I will probably add a reload.sh or refresh.sh file in 0.4.0 that users can load; since not everyone installs Rubies on the fly.

from chruby.

nengxu avatar nengxu commented on June 29, 2024

I'm still having this problem.

$ chruby --version
chruby version 0.3.4

I have to run this to get the newly installed ruby recognized by chruby:
source /usr/share/chruby/chruby.sh # archlinux

from chruby.

postmodern avatar postmodern commented on June 29, 2024

Sorry for the wait. There will be a chruby_install function in 0.4.0. Until then, simply restart the shell or re-load chruby.sh.

from chruby.

postmodern avatar postmodern commented on June 29, 2024

See #97.

from chruby.

hedgehog avatar hedgehog commented on June 29, 2024

Is this functionality still on the road map?

from chruby.

postmodern avatar postmodern commented on June 29, 2024

@hedgehog we'd have to replace $RUBIES with $RUBIES_DIRS or something similar, so not happening until 1.0.

from chruby.

habibalamin avatar habibalamin commented on June 29, 2024

This kept annoying me, and I couldn't wait, so I decided to just do it myself. I put this in my .zshrc (and I'm sure it can be adapted to other shells, too, though you might want to double check that the inlined Ruby code works for any version of Ruby you're likely to use or use an absolute path with a predictable Ruby version floor on your system):

chruby-reload () {
  eval "RUBIES=($(
    ruby -rshellwords -e '
      puts STDIN.read
        .split("\n")
        .grep_v(/^$/) # reject blank lines
        .grep_v(/^#/) # reject comments
        .flat_map { |path| Dir[File.expand_path(path)] }
        .map { |path| Shellwords.escape(path) }
        .join " "
    ' < ~/.rubiesrc
  ))"
}

alias chruby='chruby-reload && chruby '

and my .rubiesrc looks like this:

# migrating from rbenv
/usr/local/var/rbenv/versions/*

/usr/local/var/versions/ruby/*

from chruby.

willxy avatar willxy commented on June 29, 2024

Just ran into this myself.

Is still a DIY, or has something been implemented for this?

from chruby.

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.