core: Enable paralelization for Vagrant 1.2+ only

This commit is contained in:
Fabio Rehm 2014-03-12 23:09:34 -03:00
parent fb58d6c878
commit 9288d1e56c
2 changed files with 16 additions and 4 deletions

View file

@ -1,16 +1,26 @@
module Vagrant module Vagrant
module Backports module Backports
class << self class << self
def vagrant_1_2_or_later?
greater_than?('1.2.0')
end
def vagrant_1_3_or_later? def vagrant_1_3_or_later?
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0') greater_than?('1.3.0')
end end
def vagrant_1_4_or_later? def vagrant_1_4_or_later?
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.4.0') greater_than?('1.4.0')
end end
def vagrant_1_5_or_later? def vagrant_1_5_or_later?
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.5.0') greater_than?('1.5.0')
end
private
def greater_than?(version)
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new(version)
end end
end end
end end

View file

@ -10,7 +10,9 @@ module Vagrant
LXC-based virtual machines. LXC-based virtual machines.
EOF EOF
provider(:lxc, parallel: true) do extra = []
extra << {parallel: true} if Vagrant::Backports.vagrant_1_2_or_later?
provider(:lxc, *extra) do
require File.expand_path("../provider", __FILE__) require File.expand_path("../provider", __FILE__)
I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml') I18n.load_path << File.expand_path(File.dirname(__FILE__) + '/../../locales/en.yml')