Files
prodigyapi/Vagrantfile
Victor E F e546ad54c5 Fix vagrant issue: use exact version of bundler (#1355)
I was getting this error, ''Cant find gem bundler (>= 0.a) with
executable bundle', after I ran `vagrant up`. The version of RubyGem
installed in the vagrant box cannot find the exact version of Bundler
listed in Gemfile.lock. This solution ensures that the exact bundler
version installed in Gemfile.lock is installed before running `bundle
install`.

The issue is solved in RubyGems >= 2.7.10 and Ruby >=2.6.3. This
solution ensures a fix without requiring a more complicated upgrade.

More information found here: https://bundler.io/blog/2019/05/14/solutions-for-cant-find-gem-bundler-with-executable-bundle.html
2020-12-17 04:22:51 +02:00

48 lines
1.6 KiB
Ruby

Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.network :forwarded_port, guest: 4567, host: 4567
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provision "bootstrap",
type: "shell",
inline: <<-SHELL
# add nodejs v12 repository
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -yq ruby ruby-dev
sudo apt-get install -yq pkg-config build-essential nodejs git libxml2-dev libxslt-dev
sudo apt-get autoremove -yq
gem install --no-ri --no-rdoc bundler
SHELL
# add the local user git config to the vm
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
config.vm.provision "install",
type: "shell",
privileged: false,
inline: <<-SHELL
echo "=============================================="
echo "Installing app dependencies"
cd /vagrant
sudo gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"
bundle config build.nokogiri --use-system-libraries
bundle install
SHELL
config.vm.provision "run",
type: "shell",
privileged: false,
run: "always",
inline: <<-SHELL
echo "=============================================="
echo "Starting up middleman at http://localhost:4567"
echo "If it does not come up, check the ~/middleman.log file for any error messages"
cd /vagrant
bundle exec middleman server --watcher-force-polling --watcher-latency=1 &> ~/middleman.log &
SHELL
end