Sha256: 22ffe70eb3c0ccf0e6688557578f95926917116d9726dbb8b67297c0137807ee

Contents?: true

Size: 1.76 KB

Versions: 5

Compression:

Stored size: 1.76 KB

Contents

module Hem
  module Lib
    module HostCheck
      def vagrant_version opts
        require 'semantic'
        begin
          return unless get_run_environment == 'vm'

          version = shell "vagrant --version", :capture => true
          version.gsub!(/^Vagrant[^0-9]+/, '')
          version = ::Semantic::Version.new version.strip
          minimum_version = ::Semantic::Version.new "1.3.5"

          advice = <<-EOF
  The version of vagrant which you are using (#{version}) is less than the minimum required (#{minimum_version}).

  Please go to http://www.vagrantup.com/downloads.html and download the latest version for your platform.
  EOF
          raise Hem::HostCheckError.new("Vagrant is too old!", advice) if version < minimum_version
        rescue Errno::ENOENT
          advice = <<-EOF
Vagrant could not be detected on the path!

Please go to http://www.vagrantup.com/downloads.html and download the latest version for your platform.
EOF
          raise Hem::HostCheckError.new("Vagrant is not on the path", advice)
        rescue Hem::ExternalCommandError => error
          advice = <<-EOF
Vagrant produced an error while checking its presence.

This is usually caused by using the vagrant gem which is no longer supported.

Uninstall any gem version of vagrant with the following command selecting "yes" to any prompt:
  gem uninstall vagrant

You can then download and install the latest version from http://www.vagrantup.com/downloads.html

If you do not have any vagrant gems installed it may be possible that a gem such as vagrant-wrapper is installed and is failing.

Please seek assistance from #devops if this is the case.
EOF
          raise Hem::HostCheckError.new("Vagrant produced an error while checking presence", advice)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hem-1.0.1.beta6 lib/hem/lib/host_check/vagrant.rb
hem-1.0.1.beta5 lib/hem/lib/host_check/vagrant.rb
hem-1.0.1.beta4 lib/hem/lib/host_check/vagrant.rb
hem-1.0.1.beta3 lib/hem/lib/host_check/vagrant.rb
hem-1.0.1.beta2 lib/hem/lib/host_check/vagrant.rb