Module: Pebbles::Git

Extended by:
Helpers
Defined in:
lib/pebbles/git.rb

Defined Under Namespace

Classes: Version

Class Method Summary collapse

Methods included from Helpers

action, ask, confirm_command, create_git_remote, debug, debugging?, display, error, error_with_failure, error_with_failure=, flatten_hash, format_bytes, format_error, format_with_bang, git, has_git?, has_git_remote?, has_http_git_entry_in_netrc, home_directory, hputs, json_decode, launchy, line_formatter, longest, output_with_bang, running_on_a_mac?, running_on_windows?, styled_array, styled_error, styled_hash, styled_header, update_git_remote, with_tty

Class Method Details

.check_git_versionObject



6
7
8
9
10
11
# 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) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 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_gitObject



33
34
35
36
# 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