Alternatywa dla RVM gemsets
Trójmiejska Grupa Użytkowników Ruby
Gdańsk, 22 Maja 2013
Trójmiejska Grupa Użytkowników Ruby
Gdańsk, 22 Maja 2013
pawelgoscicki.com
@pawelgoscicki
github.com/pjg
Pracuję w Exvo.com
Kto ręcznie wpisuje `bundle exec`?
Kto ma aliasybe
, bi
, ber
, brake
, itp.? bundler.plugin.zsh (z oh-my-zsh)
gem cleanup
) which rake
(może tylko ja je miałem...) (jest też wersja dla Basha: bundler-exec)
gem cleanup
) .rvmrc
export rvm_without_gems="rubygems-bundler"
.bundle/config
BUNDLE_PATH: .bundle BUNDLE_BIN: .bundle/bin
.bundle/
w projekcie (automatycznie) .bundle/bin/
.zshrc
Kod na następnym slajdzie...
export DEFAULT_GEM_HOME=$GEM_HOME autoload -U add-zsh-hook add-zsh-hook chpwd chpwd_add_binstubs_to_paths function chpwd_add_binstubs_to_paths { # always delete from $OLDPWD (.bundle/bin/ from $PATH and .bundle/ from $GEM_PATH) AND restore $GEM_HOME export PATH=${PATH//$OLDPWD\/\.bundle\/bin:} export GEM_PATH=${GEM_PATH//$OLDPWD\/\.bundle:} export GEM_HOME=$DEFAULT_GEM_HOME if [ -r $PWD/Gemfile.lock ] && [ -d $PWD/.bundle/bin ]; then # add .bundle/bin to $PATH and .bundle/ to $GEM_PATH (deleting existing entries first) AND set a new $GEM_HOME export PATH=$PWD/.bundle/bin:${PATH//$PWD\/\.bundle\/bin:} export GEM_PATH=$PWD/.bundle:${GEM_PATH//$PWD\/\.bundle:} export GEM_HOME=$PWD/.bundle fi } chpwd_add_binstubs_to_paths # initial execution
gemsety
z RVM niezależnie od RVM (każdy projekt ma osobny zestaw gemów z osobnymi ściekami do binarek, które są automatycznie dodawne do $PATH
po zrobieniu cd
) gem cleanup
działa ok