lib/kitchen/driver/vagrant.rb in kitchen-vagrant-1.7.0 vs lib/kitchen/driver/vagrant.rb in kitchen-vagrant-1.7.1

- old
+ new

@@ -1,6 +1,5 @@ -# -*- encoding: utf-8 -*- # # Author:: Fletcher Nichol (<fnichol@nichol.ca>) # # Copyright (C) 2012, Fletcher Nichol # @@ -14,12 +13,12 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -require "erb" -require "fileutils" +require "erb" unless defined?(Erb) +require "fileutils" unless defined?(FileUtils) require "rubygems/version" require "kitchen" require_relative "vagrant_version" require_relative "helpers" @@ -253,11 +252,11 @@ # by matching against a whitelist of bento boxes # @return [TrueClass,FalseClass] whether or not the box shoud work with # shared folders # @api private def safe_share?(box) - return false if config[:provider] =~ /(hyperv|libvirt)/ + return false if /(hyperv|libvirt)/.match?(config[:provider]) box =~ %r{^bento/(centos|debian|fedora|opensuse|ubuntu|oracle|amazonlinux)-} end # Return true if we found the criteria to enable the cache_directory @@ -309,17 +308,17 @@ # Create vagrant command to update box to the latest version def finalize_box_auto_update! return if config[:box_auto_update].nil? - config[:box_auto_update] = "vagrant box update #{'--insecure ' if config[:box_download_insecure]}--box #{config[:box]}" + config[:box_auto_update] = "vagrant box update #{"--insecure " if config[:box_download_insecure]}--box #{config[:box]}" end # Create vagrant command to remove older versions of the box def finalize_box_auto_prune! return if config[:box_auto_prune].nil? - config[:box_auto_prune] = "vagrant box prune --name #{config[:box]}" + config[:box_auto_prune] = "vagrant box prune --keep-active-boxes --name #{config[:box]}" end # Replaces any `{{vagrant_root}}` tokens in the pre create command. # # @api private