Allow `uru .` to use .ruby-version

Issue #23 resolved
Luis Lavena created an issue

chruby, rvm and rbenv have normalized in the .ruby-version schema:

https://gist.github.com/fnichol/1912050

Since version activation is on-demand, I thought the usage of uru . could trigger the parsing of .ruby-version file found in current directory.

In rbenv for example, it will lookup for .ruby-version in current or parent directories until it reaches $HOME

This will allow easy switching to a particular version when moving between projects.

Thank you.

Comments (5)

  1. Jon repo owner

    I also like what I've read on .ruby-version and think uru . is a very clever idea.

    I originally was thinking about if/how to hook cd, but this looks much cleaner

  2. Jon repo owner
    • write private walkUp helper similar to go's filepath.Walk()
    • walk up from . to root (no cross volume skipping for windows) and use contents from first .ruby-version found; look in $HOME | %UserProfile% as the final location check.
    • exact match (no fuzzy matching) on ruby registry ID and Exe fields to support the following (single line) .ruby-version styles:
    2.0.0-p457
    ruby-1.9.3-p430
    jruby-1.7.4
    
    • since ID and Exe don't uniquely identify a ruby, ensure support for multiple exact matches, i.e ruby-2.0.0-p197 could match both x86 and x64 registered rubies.
    • get real-world .ruby-version samples from chruby/rbenv/rvm users to see if previous support needs changed. update: appears chruby and others use fuzzy mapping.
    • ensure a corresponding GEM_HOME is generated for the switch
    • TODO: how to handle jruby and ruby 1.8.7 version wackiness; their ID values look like 1.7.4 and 1.8.7 and don't contain patch info because the current regex parsing doesn't grok their funky version strings. Revisit current regex
  3. Jon repo owner

    Initial .ruby-version support. Closes #23

    Support exact matching against ID and fuzzy matching against TagLabel when .ruby-version contains single line contents such as:

    200 1.7.4 2.0.0-p197 200p197-x64 system

    → <<cset bbc050626fcc>>

  4. Log in to comment