module Pebbles::Git

Public Class Methods

check_git_version() click to toggle source
# File lib/pebbles/git.rb, line 6
def self.check_git_version
  return unless running_on_windows? || running_on_a_mac?
  if git_is_insecure(git_version)
    warn_about_insecure_git
  end
end
git_is_insecure(version) click to toggle source
# File lib/pebbles/git.rb, line 13
def self.git_is_insecure(version)
  v = Version.parse(version)
  if v < Version.parse('1.8.5.6')
    return true
  end
  if v >= Version.parse('1.9') && v < Version.parse('1.9.5')
    return true
  end
  if v >= Version.parse('2.0') && v < Version.parse('2.0.5')
    return true
  end
  if v >= Version.parse('2.1') && v < Version.parse('2.1.4')
    return true
  end
  if v >= Version.parse('2.2') && v < Version.parse('2.2.1')
    return true
  end
  return false
end
warn_about_insecure_git() click to toggle source
# File lib/pebbles/git.rb, line 33
def self.warn_about_insecure_git
  warn "Your version of git is #{git_version}. Which has serious security vulnerabilities."
  warn "More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x"
end

Private Class Methods

git_version() click to toggle source
# File lib/pebbles/git.rb, line 40
def self.git_version
  version = /git version ([\d\.]+)/.match(`git --version`)
  error("Git appears to be installed incorrectly\nEnsure that `git --version` outputs the version correctly.") unless version
  version[1]
rescue Errno::ENOENT
  error("Git must be installed to use pebbles.\nSee instructions here: http://git-scm.com")
end