Created
September 22, 2011 05:04
-
-
Save timshadel/1234077 to your computer and use it in GitHub Desktop.
Ideas for eliminating 'bundle exec' when using rbenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Put this in ~/.rbenv/rbenv.d/init/ | |
# Based in part on http://twistedmind.com/bundle-exec-bash-shortcut | |
# For a completely different take, see https://github.com/carsomyr/rbenv-bundler | |
# | |
# Slower. More correct? Choosing faster one for now. | |
# echo bundled_bins=\(`rbenv exec ruby -rbundler/setup -e 'puts Bundler.rubygems.all_specs.map{|s| s.executables}.flatten.join(" ")'`\) | |
# Only aliases executable names of the global Ruby. Cheap way to `rbenv exec` in every version? | |
echo bundled_bins=\"`rbenv exec ruby -e 'puts Gem.path.inject([]) {|s,p| b = File.join(p,"bin"); (File.exists? b) ? s << Dir.entries(b).reject {|e| e =~ /\.\.?/ } : s }.flatten.join(" ")'`\" | |
cat <<EOS | |
for bin in \$bundled_bins; do | |
alias \$bin="bundle exec \$bin" | |
done | |
EOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# ... | |
# | |
# | |
# Add this to ~/.rbenv/libexec/rbenv-init to load the init plugin above | |
# | |
for script in $(rbenv-plugin-scripts init); do | |
source "$script" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment