Skip to content

Commit d461e97

Browse files
author
Noah Gibbs
committed
Add puts when MadScience gem version is hard to determine or too low
1 parent 302dfc7 commit d461e97

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Vagrantfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
55
VAGRANTFILE_API_VERSION = "2"
6+
MADSCIENCE_MINIMUM_GEM_VERSION = "0.0.25"
67

78
require_relative "config/madscience_config.rb"
89

@@ -12,6 +13,16 @@ UNSET_VARS = %w(_ORIGINAL_GEM_PATH GEM_PATH GEM_HOME GEM_ROOT
1213
BUNDLE_BIN_PATH BUNDLE_GEMFILE RUBYLIB RUBYOPT
1314
RUBY_ENGINE RUBY_ROOT RUBY_VERSION)
1415

16+
cloned_by = File.join(File.dirname(__FILE__), ".cloned_by")
17+
if File.exist?(cloned_by)
18+
ver = File.read(cloned_by).split("\n")[0].scan(/\d+\.\d+\.\d+/)[0]
19+
if !ver || ver < MADSCIENCE_MINIMUM_GEM_VERSION
20+
puts "Warning: make sure you've set up this machine with at least MadScience #{MADSCIENCE_MINIMUM_GEM_VERSION}!"
21+
end
22+
else
23+
puts "Warning: no .cloned_by file, can't determine MadScience gem version!"
24+
end
25+
1526
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
1627
# All Vagrant configuration is done here. The most common configuration
1728
# options are documented and commented below. For a complete reference,
@@ -40,7 +51,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
4051
# Workaround: avoids 'stdin: is not a tty' error.
4152
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
4253

43-
# First, locate this user's SSH key
54+
# Locate this user's SSH key
4455
home_dir = ENV['HOME'] || ENV['userdir'] || "/home/#{ENV['USER']}"
4556
ssh_dir = File.join(home_dir, ".ssh")
4657

0 commit comments

Comments
 (0)