#!/bin/sh

set -ex

if [ -z "$AUTOPKGTEST_TMP" ]; then
  AUTOPKGTEST_TMP=$(mktemp -d)
  trap "rm -rf $AUTOPKGTEST_TMP" INT TERM EXIT
fi

cd $AUTOPKGTEST_TMP
cat > Gemfile <<EOF
source 'https://rubygems.org'
gem 'dotenv'
EOF
cat > .env <<EOF
FOO=BAR
EOF
ruby-standalone bundle install
ruby-standalone bundle exec gem list dotenv
ruby-standalone bundle exec dotenv ruby -e 'puts ENV["FOO"]' | grep BAR
