gemdiff 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8be8bab433d81f4b0a02f483b0681fb27b325d0c
4
- data.tar.gz: 17359359391001fe7516596987837361988e3519
3
+ metadata.gz: 787b7db5d33503357d64c6b78073fb118ff7fe4b
4
+ data.tar.gz: 59443dc79126b937f258ed67d4679ae5e26e2eff
5
5
  SHA512:
6
- metadata.gz: ff589f3d0f4a1bb0d8401e93f09ed84f82448f2c4260546ef29c4524390dab6cd5aa045c602d4d99498b44b0893c719e843e4b5c96fae3d90df3e10365bf6dac
7
- data.tar.gz: d9fc01663466d43caed8ced02e19cfccc4897a0fd0f2abe891d9a7b9c24449da40b4edb3731d4ea39a352e25507eeea4d1255d699c0f6a9ecda0ca16505d9f58
6
+ metadata.gz: 45d4143f50286989cf7fe2b8dafcc4391fa12ae455c541e223545f590706ebcd3de76b26a653a3b3eaee75eacfb37c6c63c0503780526e89386bd13979b5de0b
7
+ data.tar.gz: aadbb1b076751d398ff25a54f39441e94020ab508e3d388883593d99fd4cd19bddf86666ecb423e96522a8151d4a7803a8751ce98ae7246a81c6e8ef63025599
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # gemdiff
2
2
 
3
- [![Gem Version](http://img.shields.io/gem/v/gemdiff.svg)](http://rubygems.org/gems/gemdiff)
4
- [![Build Status](http://img.shields.io/travis/teeparham/gemdiff.svg)](https://travis-ci.org/teeparham/gemdiff)
3
+ [![Gem Version](https://badge.fury.io/rb/gemdiff.svg)](http://rubygems.org/gems/gemdiff)
4
+ [![Build Status](https://api.travis-ci.org/teeparham/gemdiff.svg)](https://travis-ci.org/teeparham/gemdiff)
5
5
 
6
6
  `gemdiff` is a command-line utility to find and compare source code repositories
7
7
  associated with ruby gems. It makes it easy to compare source code differences
@@ -15,9 +15,7 @@ module Gemdiff
15
15
  end
16
16
 
17
17
  def set_versions(v_old, v_new)
18
- v_old, v_new = v_new, v_old if v_old && v_new && v_old > v_new # swap using parallel assignment
19
- @old_version = v_old
20
- @new_version = v_new
18
+ @old_version, @new_version = old_new(v_old, v_new)
21
19
  end
22
20
 
23
21
  def missing_versions?
@@ -98,5 +96,17 @@ module Gemdiff
98
96
  :default
99
97
  end
100
98
  end
99
+
100
+ # swap versions if needed
101
+ def old_new(v_old, v_new)
102
+ return [v_old, v_new] unless v_old && v_new
103
+ if v_old == 'master' || (Gem::Version.new(v_old) > Gem::Version.new(v_new))
104
+ [v_new, v_old]
105
+ else
106
+ [v_old, v_new]
107
+ end
108
+ rescue ArgumentError
109
+ [v_old, v_new]
110
+ end
101
111
  end
102
112
  end
@@ -1,3 +1,3 @@
1
1
  module Gemdiff
2
- VERSION = '0.6.5'
2
+ VERSION = '0.6.6'
3
3
  end
@@ -95,6 +95,20 @@ module Gemdiff
95
95
  assert_equal "1.2.34", gem.old_version
96
96
  assert_equal "2.34.56", gem.new_version
97
97
  end
98
+
99
+ it "swaps versions over 10 in the wrong order" do
100
+ gem = OutdatedGem.new("x")
101
+ gem.set_versions "1.10.0", "1.9.3"
102
+ assert_equal "1.9.3", gem.old_version
103
+ assert_equal "1.10.0", gem.new_version
104
+ end
105
+
106
+ it "swaps versions with master" do
107
+ gem = OutdatedGem.new("x")
108
+ gem.set_versions "master", "1.9.3"
109
+ assert_equal "1.9.3", gem.old_version
110
+ assert_equal "master", gem.new_version
111
+ end
98
112
  end
99
113
 
100
114
  describe "#master" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tee Parham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-30 00:00:00.000000000 Z
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit