Bundler starter kit
Published:
Updated:
Bundler is a tool to manage Ruby gem dependencies, install them and setup the execution environment. The homepage shows how to use it to install the gems alongside the ruby installation/systemwide which is not so great. For some reason, I initially didn't find the option to install the gems locally (--path) and have been using horrible environment variable modifications to avoid the systemwide installation. In fact, this is quite simple…
Bundler
which bundle || sudo apt-get install bundler
mkdir foo/
cd foo/
cat <<EOF > Gemfile
source 'https://rubygems.org'
gem "kramdown"
EOF
bundle install --path vendor/bundle --binstubs
echo '#Hello' | ./bin/kramdown
echo '#Hello' | middleman exec kramdown
Explanations:
--pathsets the path where the gems are being installed. Here we use a path local within the project. By default, the gems might be installed in a system-wide path which might not be what you want (and it might callsudoin order to do this). Another solution is to use~/.gem(which is used by default): in order to use this by default, you might set theGEM_HOMEenvironment variable to~/.gem.--binstubs[=path]installs executables shipped by the gems (kramdownin your example).
git
git init .
cat <<EOF >> .gitignore
bin
vendor
.bundle
EOF
git add Gemfile Gemfile.lock .gitignore
git commit -m"First commit"
Issues
Provide path for dependencies for native extensions:
bundle config build.nokogiri\
"--use-system-libraries --with-xml2-include=/usr/local"