Created
November 13, 2013 13:31
-
-
Save petems/7449151 to your computer and use it in GitHub Desktop.
Check Vagrant version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIN_REQUIRED_VAGRANT_VERSION = '1.2.1' | |
if Vagrant::VERSION < MIN_REQUIRED_VAGRANT_VERSION | |
$stderr.puts "ERROR: We require Vagrant version >=#{min_required_vagrant_version}. Please upgrade. http://downloads.vagrantup.com/\n" | |
exit 1 | |
end | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64" | |
config.vm.hostname = 'foo' | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, this is pretty old at this point (2013?), I think this pre-dates the
Vagrant.version?
method:I later found that version comparisons in Ruby are fairly simple to do with the Gem library as well:
Gem::Version.new(Vagrant::VERSION) < Gem::Version.new(MIN_REQUIRED_VAGRANT_VERSION)