If you are using zsh and you have Gemfile
in the current directory, you want to put bundle exec
at the beginning of certain commands, such as rake
, so I installed zsh-bundle-exec
, but it didn't seem to be added automatically.
These are the actions you took to install:
Set the environment variables in .zshrc
to load zsh-bundle-exec.zsh
export BUNDLE_EXEC_GEMFILE_CURRENT_DIR_ONLY=yes
export BUNDLE_EXEC_COMMANDS = 'rails racerspec guard cap'
source to /.zsh/zsh-bundle-exec/zsh-bundle-exec.zsh
Reload settings in .~/.zshrc
The zsh version uses zsh 5.0.2 (x86_64-apple-darwin 13.0)
.
I registered with Issues a week ago, but I haven't received any response yet.
https://github.com/rhysd/zsh-bundle-exec/issues/4
Is there any other way to omit bundle exec
input in zsh
because it doesn't matter if it's configured correctly to use this plug-in or otherwise?
I tried the oh-my-zsh
that Kyohsuke told me about, but it didn't work well.
Specifically
alias|grepbi
displays bi=bundle_install
, so the installation is successfulbin
folder in the project, bin/rake
and so on will runrake
has alias of rake=_rake_command
which_rake_command
is the following result_rake_command(){
if [-e "bin/rake" ]
then
bin/rake$@
else
command lake$@
fi
}
I haven't tried it myself, but here's a solution using direnv.
http://mattn.kaoriya.net/software/lang/ruby/20140314032519.htm
Also, although it is not a perfect solution, I set the alias to ~/.zshrc
.
alias be="bundle exec"
This way you can run it like erspec
.
For your information.
It's another way, but how about using the oh-my-zsh bundle plug-in?
The wiki provides a list of commands in which bundle exec is automatically inserted in the bundleer plug-in.
If you use it, I think the following will be helpful.
·Wiki page(en)
about Bundler plug-in
·Until you create a zsh+oh-my-zsh environment on Mac OS X and set it all up
[Additional note]
After reviewing the questions added, Applicable actions are inserted into the rails plug-in of oh-my-zsh.
How about setting the plug-in settings to bundle only as shown below?
plugins=(bundler)
© 2024 OneMinuteCode. All rights reserved.