/dev/posts/

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:

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"

References