git-up 0.5.3 → 0.5.4

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-up.rb +11 -3
  2. data/lib/git-up/version.rb +1 -1
  3. metadata +7 -7
@@ -233,14 +233,14 @@ EOS
233
233
  required_version = "1.6.6"
234
234
  config_value = config("fetch.prune")
235
235
 
236
- if git_version < required_version
236
+ if git_version_at_least?(required_version)
237
+ config_value != 'false'
238
+ else
237
239
  if config_value == 'true'
238
240
  puts "Warning: fetch.prune is set to 'true' but your git version doesn't seem to support it (#{git_version} < #{required_version}). Defaulting to 'false'.".yellow
239
241
  end
240
242
 
241
243
  false
242
- else
243
- config_value != 'false'
244
244
  end
245
245
  end
246
246
 
@@ -248,6 +248,14 @@ EOS
248
248
  repo.config["git-up.#{key}"]
249
249
  end
250
250
 
251
+ def git_version_at_least?(required_version)
252
+ (version_array(git_version) <=> version_array(required_version)) >= 0
253
+ end
254
+
255
+ def version_array(version_string)
256
+ version_string.split('.').map { |s| s.to_i }
257
+ end
258
+
251
259
  def git_version
252
260
  `git --version`[/\d+(\.\d+)+/]
253
261
  end
@@ -1,3 +1,3 @@
1
1
  class GitUp
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -16,7 +16,7 @@ date: 2012-04-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: thoughtbot-shoulda
19
- requirement: &70276083994300 !ruby/object:Gem::Requirement
19
+ requirement: &70134838021440 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: '0'
25
25
  type: :development
26
26
  prerelease: false
27
- version_requirements: *70276083994300
27
+ version_requirements: *70134838021440
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: colored
30
- requirement: &70276083993620 !ruby/object:Gem::Requirement
30
+ requirement: &70134838020640 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '1.2'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70276083993620
38
+ version_requirements: *70134838020640
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: grit
41
- requirement: &70276083992540 !ruby/object:Gem::Requirement
41
+ requirement: &70134838019620 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '0'
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70276083992540
49
+ version_requirements: *70134838019620
50
50
  description:
51
51
  email:
52
52
  - aanand.prasad@gmail.com