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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d577add5820b621392c3ab65a71319522e6209dc
4
- data.tar.gz: 42f85f98610070725bc02cb32a56bd3f966f69b3
3
+ metadata.gz: c039d85a194ef66692935ece9f322aa74312b735
4
+ data.tar.gz: 83636e6d83f61b0b7e510a95a05a12a6a12110bb
5
5
  SHA512:
6
- metadata.gz: 89e7224884cb4db66e5b17ef3f5a5aaa99b7585c3059c306bf56866cbc307eb20cbe3da691afec7858d944273f2074d375d7221fa0b7c9578b91fc5055f275bb
7
- data.tar.gz: de6bae83d8736adf99431ad7bdc3457319c84d4881245ac7c282a89bb79fca71d5da77a06b1665daa53801b37b99230ad7be70848934a71a1fa4ae25615b4db4
6
+ metadata.gz: cc606da75134d7dfb3d48a9d7ce6134300ed3cdcb42db6f501084b699d5353d03da99a866c64335a4901bbce178388aefffbd76c42f7a1980254c2f6a53a991f
7
+ data.tar.gz: 11b319b29d91a8fa3945c6d3f525d128a515aded241b90a1bf2e6b932e6d08c1bce350de9fc068578f71bdaecd1367a99f21b0ceefa69b5fdb401717ae2cd6c7
@@ -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/v#{old_version}...v#{new_version}"
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
@@ -1,3 +1,3 @@
1
1
  module Gemdiff
2
- VERSION = '0.0.2'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tee Parham