core: Kick off a vagrant-backports lib with method for verifying vagrant version

This commit is contained in:
Fabio Rehm 2014-03-11 20:37:47 -03:00
parent 1072a42ed2
commit f5661280bc
4 changed files with 24 additions and 9 deletions

View file

@ -0,0 +1,10 @@
# vagrant-backports
<!--
[![Build Status](https://travis-ci.org/fgrehm/vagrant-backports.png?branch=master)](https://travis-ci.org/fgrehm/vagrant-backports) [![Gem Version](https://badge.fury.io/rb/vagrant-backports.png)](http://badge.fury.io/rb/vagrant-backports) [![Code Climate](https://codeclimate.com/github/fgrehm/vagrant-backports.png)](https://codeclimate.com/github/fgrehm/vagrant-backports) [![Coverage Status](https://coveralls.io/repos/fgrehm/vagrant-backports/badge.png?branch=master)](https://coveralls.io/r/fgrehm/vagrant-backports) [![Gittip](http://img.shields.io/gittip/fgrehm.svg)](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...

View 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

View file

@ -20,9 +20,8 @@ require 'vagrant-lxc/action/setup_package_files'
require 'vagrant-lxc/action/share_folders'
require 'vagrant-lxc/action/warn_networks'
unless Vagrant::LXC.vagrant_1_3_or_later
require 'vagrant-lxc/action/wait_for_communicator'
Vagrant::Action::Builtin.const_set :WaitForCommunicator, Vagrant::LXC::Action::WaitForCommunicator
unless Vagrant::Backports.vagrant_1_3_or_later?
require 'vagrant-backports/action/wait_for_communicator'
end
module Vagrant
@ -157,7 +156,7 @@ module Vagrant
b3.use Builtin::EnvSet, :force_halt => true
b3.use action_halt
b3.use Destroy
if Vagrant::LXC.vagrant_1_3_or_later
if Vagrant::Backports.vagrant_1_3_or_later?
b3.use Builtin::ProvisionerCleanup
end
else

View file

@ -1,4 +1,5 @@
require "vagrant"
require 'vagrant'
require 'vagrant-backports/utils'
module Vagrant
module LXC
@ -23,9 +24,5 @@ module Vagrant
Config
end
end
def self.vagrant_1_3_or_later
Gem::Version.new(Vagrant::VERSION) >= Gem::Version.new('1.3.0')
end
end
end