Open kbrock opened 1 year ago
WIP: sorry, in zsh it worked for non-existing director, or a directory with rubies, but not for a directory that was empty
and zsh is complicated due to the default of blowing up when there is a bad glob
running setopt nonomatch
will get around this, but this started to get too complicated.
Since it is sourced, modifying that value in the parent shell is not so good.
@kbrock yep, we ended up using ls -A
to filter out non-existent directories or empty directories, and to behave consistently even if the user has enabled some weird glob-option mode.
In the 1.0.0 branch, I changed chruby
to lazy enumerate the directories on each call with an extra directory existence check which should filter out non-existent or empty directories.
ooh, sweet!
Ugh, I guess I have been living in the homebrew world and forgot about version 1.0.
I've been slowly working on 1.0.0 branch where I can make breaking changes. The last feature I was trying to work on is adding a auto.sh
like feature but for setting up alias
es for bundle exec
commands; had trouble finding all executables from bundler's API. I also plan on eventually releasing a 0.4.0 which adds some additional features and relieves some of the pain some users are feeling, such as the slow load times.
nvm
is slow and I was looking at chruby
as an example of how to make nvm
as quick as chruby
.be
or ber
/beer
(bundle exec
and bundle exec ruby
). I went a little too far and have a "smart" beer
command that calls ruby
, rails
, rake
, or rspec
depending upon the parameters. Since rails introduce something similar to their rails
command, it seems they felt a similar pain. Wonder if the added lines of code justify the additional functionality in chruby
?
before
after
why?
I was trying to figure out ways to make nvm.sh load faster on my system. chruby loads so much faster, and when I looked to see why, I was distracted by the call to
ls -A "$dir"
. It was using a builtin to list the files in the directory, but an external command to detect if there were files in the directory.So yea, I converted the already quick method to made it even faster.
~/.rubies
, and a non-existent/opt/rubies
.PREFIX
with a space in the name.This is yak shaving, and you probably can think up a better implementation. But it seems to work in
zsh
andbash
.If you prefer not to introduce change (because change always introduces risk), then that is cool. Just close. I just saw this change and wanted to share.
As you will note,
nvm
is noticeably slower and the reason for my original tangent:Thanks again for such a great tool. And it already performs heads and shoulders better than other tools out there. (ruby or other)
refs: