Windows: uru can't locate .ruby-version

Issue #62 resolved
Former user created an issue

Uru only locates .ruby-version when called from its install location. .ruby-version is in the uru install directory:

  • C:\Open\path
    • .ruby-version
    • uru.bat
    • uru.ps1
    • uru_rt.exe

Calls from any other directory raise an error:

PS C:\Users\Luis\git\wintersmith\ctsi> uru auto
---> unable to find or process a `.ruby-version` file

Comments (2)

  1. Jon repo owner

    This behavior is not a bug. You misunderstand how .ruby-version files and uru auto work.

    uru auto walks up from your current dir to the root directory looking for a .ruby-version file. If it finds the file, it tries to activate a ruby matching the version info in the file. If the dir walk ends at root (C:\ in your example) without finding a .ruby-version file, it does a final check in %USERPROFILE% (C:\Users\Luis in your example) before giving up.

    It doesn't walk up the dir tree, then check arbitrary dirs such as your C:\Open\path location. If you are familiar with go and interested, the uru auto code lives here

    In the following example the .ruby-version files lives two levels above the current dir

    PS sandbox> pwd
    
    Path
    ----
    C:\Users\Jon\Downloads\temp\sandbox
    
    PS sandbox> cat C:\Users\Jon\Downloads\.ruby-version
    2.1.5-p267
    
    PS sandbox> uru ls
        1715        : jruby 1.7.15 (1.9.3p392) 2014-09-03 82b5cc3 on Java HotSpot(TM) ...
        200p595-x32 : ruby 2.0.0p595 (2014-10-28 revision 48173) [i386-mingw32]
        215p267-x32 : ruby 2.1.5p267 (2014-10-28 revision 48177) [i386-mingw32]
    
    PS sandbox> uru auto
    ---> Now using ruby 2.1.5-p267 tagged as `215p267-x32`
    
    PS sandbox> uru ls
        1715        : jruby 1.7.15 (1.9.3p392) 2014-09-03 82b5cc3 on Java HotSpot(TM) ...
        200p595-x32 : ruby 2.0.0p595 (2014-10-28 revision 48173) [i386-mingw32]
     => 215p267-x32 : ruby 2.1.5p267 (2014-10-28 revision 48177) [i386-mingw32]
    

    In your example, you can place a .ruby-version at any level in your C:\Users\Luis\git\wintersmith\ctsi tree and uru auto should find and use it.

  2. Log in to comment