class Protobox::Util::Platform

Public Class Methods

git() click to toggle source
# File lib/protobox/util.rb, line 8
def git
  @git ||= if ENV['GIT'] and File.executable?(ENV['GIT'])
    ENV['GIT']
  elsif Context.command?('git')
    'git'
  else
    s = `xcrun -find git 2>/dev/null`.chomp
    s if $? and not s.empty?
  end

  return unless @git

  # Github only supports HTTPS fetches on 1.7.10 or later:
  # https://help.github.com/articles/https-cloning-errors
  `#{@git} --version` =~ /git version (\d\.\d+\.\d+)/
  return if $1.nil? or $1 < "1.7.10"

  @git
end
vagrant() click to toggle source
# File lib/protobox/util.rb, line 28
def vagrant
  @vagrant ||= if ENV['VAGRANT'] and File.executable(ENV['VAGRANT'])
    ENV['VAGRANT']
  elsif Context.command?('vagrant')
    'vagrant'
  else
    s = `xcrun -find vagrant 2>/dev/null`.chomp
    s if $? and not s.empty?
  end

  return unless @vagrant

  @vagrant
end