gemdiff 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gemdiff/outdated_gem.rb +25 -2
- data/lib/gemdiff/version.rb +1 -1
- data/test/outdated_gem_test.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c039d85a194ef66692935ece9f322aa74312b735
|
|
4
|
+
data.tar.gz: 83636e6d83f61b0b7e510a95a05a12a6a12110bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc606da75134d7dfb3d48a9d7ce6134300ed3cdcb42db6f501084b699d5353d03da99a866c64335a4901bbce178388aefffbd76c42f7a1980254c2f6a53a991f
|
|
7
|
+
data.tar.gz: 11b319b29d91a8fa3945c6d3f525d128a515aded241b90a1bf2e6b932e6d08c1bce350de9fc068578f71bdaecd1367a99f21b0ceefa69b5fdb401717ae2cd6c7
|
data/lib/gemdiff/outdated_gem.rb
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
module Gemdiff
|
|
2
2
|
class OutdatedGem
|
|
3
|
+
|
|
4
|
+
# gems that tag releases with tag names like 1.2.3
|
|
5
|
+
# keep it alphabetical
|
|
6
|
+
LIST_NO_V = %w[atomic haml thread_safe]
|
|
7
|
+
|
|
3
8
|
attr_accessor :name, :old_version, :new_version
|
|
4
9
|
|
|
5
|
-
def initialize(name, old_version=nil, new_version=nil)
|
|
10
|
+
def initialize(name, old_version = nil, new_version = nil)
|
|
6
11
|
@name = name
|
|
7
12
|
@old_version = old_version
|
|
8
13
|
@new_version = new_version
|
|
@@ -39,7 +44,7 @@ module Gemdiff
|
|
|
39
44
|
end
|
|
40
45
|
|
|
41
46
|
def compare_url
|
|
42
|
-
"#{repo}/compare
|
|
47
|
+
"#{repo}/compare/#{compare_part}"
|
|
43
48
|
end
|
|
44
49
|
|
|
45
50
|
def compare
|
|
@@ -49,5 +54,23 @@ module Gemdiff
|
|
|
49
54
|
def open
|
|
50
55
|
`open #{repo}` if repo?
|
|
51
56
|
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
def compare_part
|
|
61
|
+
if compare_type == :no_v
|
|
62
|
+
"#{old_version}...#{new_version}"
|
|
63
|
+
else
|
|
64
|
+
"v#{old_version}...v#{new_version}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def compare_type
|
|
69
|
+
if LIST_NO_V.include?(@name)
|
|
70
|
+
:no_v
|
|
71
|
+
else
|
|
72
|
+
:default
|
|
73
|
+
end
|
|
74
|
+
end
|
|
52
75
|
end
|
|
53
76
|
end
|
data/lib/gemdiff/version.rb
CHANGED
data/test/outdated_gem_test.rb
CHANGED
|
@@ -14,9 +14,15 @@ module Gemdiff
|
|
|
14
14
|
|
|
15
15
|
describe "#compare_url" do
|
|
16
16
|
it "returns compare url" do
|
|
17
|
-
gem = OutdatedGem.new("x", "1", "2")
|
|
17
|
+
gem = OutdatedGem.new("x", "1.0", "2.0")
|
|
18
18
|
gem.stubs repo: "http://github.com/x/x"
|
|
19
|
-
assert_equal "http://github.com/x/x/compare/v1...v2", gem.compare_url
|
|
19
|
+
assert_equal "http://github.com/x/x/compare/v1.0...v2.0", gem.compare_url
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "returns compare url with no v for exceptions" do
|
|
23
|
+
gem = OutdatedGem.new("haml", "4.0.0", "4.1.0")
|
|
24
|
+
gem.stubs repo: "http://github.com/haml/haml"
|
|
25
|
+
assert_equal "http://github.com/haml/haml/compare/4.0.0...4.1.0", gem.compare_url
|
|
20
26
|
end
|
|
21
27
|
end
|
|
22
28
|
|