core: Kick off a vagrant-backports lib with method for verifying vagrant version
This commit is contained in:
parent
1072a42ed2
commit
f5661280bc
4 changed files with 24 additions and 9 deletions
10
lib/vagrant-backports/README.md
Normal file
10
lib/vagrant-backports/README.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# vagrant-backports
|
||||||
|
|
||||||
|
<!--
|
||||||
|
[](https://travis-ci.org/fgrehm/vagrant-backports) [](http://badge.fury.io/rb/vagrant-backports) [](https://codeclimate.com/github/fgrehm/vagrant-backports) [](https://coveralls.io/r/fgrehm/vagrant-backports) [](https://www.gittip.com/fgrehm/)
|
||||||
|
-->
|
||||||
|
|
||||||
|
A "soon to be extracted" gem that helps Vagrant plugin developers to stay sane
|
||||||
|
when keeping up with Vagrant improvements and backwards incompatible changes.
|
||||||
|
|
||||||
|
More information coming out soon...
|
9
lib/vagrant-backports/utils.rb
Normal file
9
lib/vagrant-backports/utils.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module Vagrant
|
||||||
|
module Backports
|
||||||
|
class << self
|
||||||
|
def vagrant_1_3_or_later?
|
||||||
|
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -20,9 +20,8 @@ require 'vagrant-lxc/action/setup_package_files'
|
||||||
require 'vagrant-lxc/action/share_folders'
|
require 'vagrant-lxc/action/share_folders'
|
||||||
require 'vagrant-lxc/action/warn_networks'
|
require 'vagrant-lxc/action/warn_networks'
|
||||||
|
|
||||||
unless Vagrant::LXC.vagrant_1_3_or_later
|
unless Vagrant::Backports.vagrant_1_3_or_later?
|
||||||
require 'vagrant-lxc/action/wait_for_communicator'
|
require 'vagrant-backports/action/wait_for_communicator'
|
||||||
Vagrant::Action::Builtin.const_set :WaitForCommunicator, Vagrant::LXC::Action::WaitForCommunicator
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
|
@ -157,7 +156,7 @@ module Vagrant
|
||||||
b3.use Builtin::EnvSet, :force_halt => true
|
b3.use Builtin::EnvSet, :force_halt => true
|
||||||
b3.use action_halt
|
b3.use action_halt
|
||||||
b3.use Destroy
|
b3.use Destroy
|
||||||
if Vagrant::LXC.vagrant_1_3_or_later
|
if Vagrant::Backports.vagrant_1_3_or_later?
|
||||||
b3.use Builtin::ProvisionerCleanup
|
b3.use Builtin::ProvisionerCleanup
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require "vagrant"
|
require 'vagrant'
|
||||||
|
require 'vagrant-backports/utils'
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
module LXC
|
module LXC
|
||||||
|
@ -23,9 +24,5 @@ module Vagrant
|
||||||
Config
|
Config
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.vagrant_1_3_or_later
|
|
||||||
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue