schacon-git 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/git.rb +3 -7
  2. data/lib/git/lib.rb +15 -1
  3. metadata +1 -1
data/lib/git.rb CHANGED
@@ -26,13 +26,9 @@ require 'git/author'
26
26
  require 'git/stashes'
27
27
  require 'git/stash'
28
28
 
29
- minimum_version = [1, 6, 0, 0]
30
- current_version = Git::Lib.new(nil, nil).command_version
31
- if current_version[0] < minimum_version[0] ||
32
- current_version[1] < minimum_version[1] ||
33
- current_version[2] < minimum_version[2] ||
34
- current_version[3] < minimum_version[3]
35
- $stderr.puts "The git gem requires git #{minimum_version.join('.')} or later, but only found #{current_version.join('.')}. You should probably upgrad.e"
29
+ lib = Git::Lib.new(nil, nil)
30
+ unless lib.meets_required_version?
31
+ $stderr.puts "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade."
36
32
  end
37
33
 
38
34
  # Git/Ruby Library
data/lib/git/lib.rb CHANGED
@@ -645,12 +645,26 @@ module Git
645
645
  end
646
646
 
647
647
  # returns the current version of git, as an Array of Fixnums.
648
- def command_version
648
+ def current_command_version
649
649
  output = command('version', [], false)
650
650
  version = output[/(\d+)\.(\d+)\.(\d+)\.(\d+)/]
651
651
  version.split('.').collect {|i| i.to_i}
652
652
  end
653
653
 
654
+ def required_command_version
655
+ [1, 6, 0, 0]
656
+ end
657
+
658
+ def meets_required_version?
659
+ current_version = self.current_command_version
660
+ required_version = self.required_command_version
661
+ return current_version[0] >= required_version[0] &&
662
+ current_version[1] >= required_version[1] &&
663
+ current_version[2] >= required_version[2] &&
664
+ current_version[3] >= required_version[3]
665
+ end
666
+
667
+
654
668
  private
655
669
 
656
670
  def command_lines(cmd, opts = [], chdir = true, redirect = '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schacon-git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon