gemdiff 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gemdiff/repo_finder.rb +2 -0
- data/lib/gemdiff/version.rb +1 -1
- metadata +3 -20
- data/.gitignore +0 -6
- data/.travis.yml +0 -5
- data/Gemfile +0 -9
- data/Rakefile +0 -11
- data/gemdiff.gemspec +0 -31
- data/test/bundle_inspector_test.rb +0 -71
- data/test/cli_test.rb +0 -181
- data/test/gem_updater_test.rb +0 -68
- data/test/outdated_gem_test.rb +0 -150
- data/test/repo_finder_test.rb +0 -60
- data/test/test_helper.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a03730713468d8743f449dfd53a18b3ee0bf655
|
4
|
+
data.tar.gz: febf87d70534140aa95554abd0e3f97c413d63b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d130b4ca0a68aedb8df3477447fe8a0940b808ef10de57832c9b673eab88de2caa5bc4ee99325dec101de0d3dc6209410f4a377e2916ad4455e1839f47f9d3de
|
7
|
+
data.tar.gz: f9dbb4b968cafe1954e1e4ea5683e6314efeb78c70dbdf9097555dfc3d1f7da0f775f96ae180200560fd3c1df1013344123de73283abe8719a49c437f525b7e7
|
data/lib/gemdiff/repo_finder.rb
CHANGED
@@ -26,10 +26,12 @@ module Gemdiff
|
|
26
26
|
:"modular-scale" => 'Team-Sass/modular-scale',
|
27
27
|
nokogiri: 'sparklemotion/nokogiri',
|
28
28
|
passenger: 'phusion/passenger',
|
29
|
+
pg: 'ged/ruby-pg',
|
29
30
|
railties: 'rails/rails',
|
30
31
|
rake: 'ruby/rake',
|
31
32
|
resque: 'resque/resque',
|
32
33
|
:"resque-multi-job-forks" => 'stulentsev/resque-multi-job-forks',
|
34
|
+
rr: 'rr/rr',
|
33
35
|
SassyLists: 'Team-Sass/SassyLists',
|
34
36
|
:"Sassy-Maps" => 'Team-Sass/Sassy-Maps',
|
35
37
|
:"sassy-math" => 'Team-Sass/Sassy-math',
|
data/lib/gemdiff/version.rb
CHANGED
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.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tee Parham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -117,14 +117,9 @@ executables:
|
|
117
117
|
extensions: []
|
118
118
|
extra_rdoc_files: []
|
119
119
|
files:
|
120
|
-
- ".gitignore"
|
121
|
-
- ".travis.yml"
|
122
|
-
- Gemfile
|
123
120
|
- LICENSE.txt
|
124
121
|
- README.md
|
125
|
-
- Rakefile
|
126
122
|
- bin/gemdiff
|
127
|
-
- gemdiff.gemspec
|
128
123
|
- lib/gemdiff.rb
|
129
124
|
- lib/gemdiff/bundle_inspector.rb
|
130
125
|
- lib/gemdiff/cli.rb
|
@@ -133,12 +128,6 @@ files:
|
|
133
128
|
- lib/gemdiff/outdated_gem.rb
|
134
129
|
- lib/gemdiff/repo_finder.rb
|
135
130
|
- lib/gemdiff/version.rb
|
136
|
-
- test/bundle_inspector_test.rb
|
137
|
-
- test/cli_test.rb
|
138
|
-
- test/gem_updater_test.rb
|
139
|
-
- test/outdated_gem_test.rb
|
140
|
-
- test/repo_finder_test.rb
|
141
|
-
- test/test_helper.rb
|
142
131
|
homepage: https://github.com/teeparham/gemdiff
|
143
132
|
licenses:
|
144
133
|
- MIT
|
@@ -164,11 +153,5 @@ signing_key:
|
|
164
153
|
specification_version: 4
|
165
154
|
summary: Find source repositories for ruby gems. Open, compare, and update outdated
|
166
155
|
gem versions
|
167
|
-
test_files:
|
168
|
-
- test/bundle_inspector_test.rb
|
169
|
-
- test/cli_test.rb
|
170
|
-
- test/gem_updater_test.rb
|
171
|
-
- test/outdated_gem_test.rb
|
172
|
-
- test/repo_finder_test.rb
|
173
|
-
- test/test_helper.rb
|
156
|
+
test_files: []
|
174
157
|
has_rdoc:
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/gemdiff.gemspec
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'gemdiff/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "gemdiff"
|
8
|
-
spec.version = Gemdiff::VERSION
|
9
|
-
spec.authors = ["Tee Parham"]
|
10
|
-
spec.email = ["tee@neighborland.com"]
|
11
|
-
spec.summary = %q{Find source repositories for ruby gems. Open, compare, and update outdated gem versions}
|
12
|
-
spec.description = %q{Command-line utility to find source repositories for ruby gems, open common github pages, compare gem versions, and simplify gem update workflow in git}
|
13
|
-
spec.homepage = "https://github.com/teeparham/gemdiff"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = %w[gemdiff]
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test)/})
|
19
|
-
spec.require_paths = %w[lib]
|
20
|
-
|
21
|
-
spec.required_ruby_version = ">= 1.9.3"
|
22
|
-
|
23
|
-
spec.add_dependency "octokit", "~> 3.1"
|
24
|
-
spec.add_dependency "thor", "~> 0.19"
|
25
|
-
spec.add_dependency "launchy", "~> 2.4"
|
26
|
-
|
27
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
28
|
-
spec.add_development_dependency "minitest", "~> 5.4"
|
29
|
-
spec.add_development_dependency "mocha", "~> 1.1"
|
30
|
-
spec.add_development_dependency "rake", "~> 10.3"
|
31
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Gemdiff
|
4
|
-
class BundleInspectorTest < MiniTest::Spec
|
5
|
-
describe "#list" do
|
6
|
-
it "returns outdated gems" do
|
7
|
-
inspector = BundleInspector.new
|
8
|
-
inspector.stubs bundle_outdated_strict: fake_outdated
|
9
|
-
inspector.list.tap do |list|
|
10
|
-
assert_equal 2, list.size
|
11
|
-
assert_equal 'aws-sdk', list[0].name
|
12
|
-
assert_equal '1.34.1', list[0].old_version
|
13
|
-
assert_equal '1.35.0', list[0].new_version
|
14
|
-
assert_equal 'haml', list[1].name
|
15
|
-
assert_equal '4.0.4', list[1].old_version
|
16
|
-
assert_equal '4.0.5', list[1].new_version
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
it "returns empty list when bundle is up to date" do
|
21
|
-
inspector = BundleInspector.new
|
22
|
-
inspector.stubs bundle_outdated_strict: fake_up_to_date
|
23
|
-
assert_empty inspector.list
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe "#get" do
|
28
|
-
it "returns single outdated gem" do
|
29
|
-
inspector = BundleInspector.new
|
30
|
-
inspector.stubs bundle_outdated_strict: fake_outdated
|
31
|
-
inspector.get('haml').tap do |gem|
|
32
|
-
assert_equal 'haml', gem.name
|
33
|
-
assert_equal '4.0.4', gem.old_version
|
34
|
-
assert_equal '4.0.5', gem.new_version
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
it "returns nil when gem is not outdated" do
|
39
|
-
inspector = BundleInspector.new
|
40
|
-
inspector.stubs bundle_outdated_strict: fake_up_to_date
|
41
|
-
assert_nil inspector.get('notfound')
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def fake_outdated
|
48
|
-
<<OUT
|
49
|
-
Updating git://github.com/neighborland/active-something.git
|
50
|
-
Fetching gem metadata from https://rubygems.org/.......
|
51
|
-
Fetching additional metadata from https://rubygems.org/..
|
52
|
-
Resolving dependencies...
|
53
|
-
|
54
|
-
Outdated gems included in the bundle:
|
55
|
-
* active-something (0.7.0 99ddbc9 > 0.7.0 1da2295)
|
56
|
-
* aws-sdk (1.35.0 > 1.34.1)
|
57
|
-
* haml (4.0.5 > 4.0.4)
|
58
|
-
OUT
|
59
|
-
end
|
60
|
-
|
61
|
-
def fake_up_to_date
|
62
|
-
<<OUT
|
63
|
-
Fetching gem metadata from https://rubygems.org/.........
|
64
|
-
Fetching additional metadata from https://rubygems.org/..
|
65
|
-
Resolving dependencies...
|
66
|
-
|
67
|
-
Your bundle is up to date!
|
68
|
-
OUT
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/test/cli_test.rb
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Gemdiff
|
4
|
-
class CLITest < MiniTest::Spec
|
5
|
-
before do
|
6
|
-
@cli = CLI.new
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "#find" do
|
10
|
-
it "finds" do
|
11
|
-
mock_gem "haml"
|
12
|
-
@cli.expects(:puts).with("http://github.com/haml/haml")
|
13
|
-
@cli.find "haml"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "does not find" do
|
17
|
-
mock_missing_gem
|
18
|
-
@cli.expects(:puts).with("Could not find github repository for notfound.")
|
19
|
-
@cli.find "notfound"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#open" do
|
24
|
-
it "opens repo" do
|
25
|
-
outdated_gem = mock_gem("haml")
|
26
|
-
@cli.expects(:puts).with("http://github.com/haml/haml")
|
27
|
-
outdated_gem.expects :open
|
28
|
-
@cli.open "haml"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "#releases" do
|
33
|
-
it "opens releases page" do
|
34
|
-
outdated_gem = mock_gem("haml")
|
35
|
-
@cli.expects(:puts).with("http://github.com/haml/haml")
|
36
|
-
outdated_gem.expects :releases
|
37
|
-
@cli.releases "haml"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "#master" do
|
42
|
-
it "opens commits page" do
|
43
|
-
outdated_gem = mock_gem("haml")
|
44
|
-
@cli.expects(:puts).with("http://github.com/haml/haml")
|
45
|
-
outdated_gem.expects :master
|
46
|
-
@cli.master "haml"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#compare" do
|
51
|
-
it "opens compare view using bundle" do
|
52
|
-
outdated_gem = mock_gem("haml")
|
53
|
-
@cli.expects(:puts).with("http://github.com/haml/haml")
|
54
|
-
outdated_gem.expects(:set_versions).with(nil, nil)
|
55
|
-
outdated_gem.expects(:missing_versions?).returns(true)
|
56
|
-
@cli.expects(:puts).with(CLI::CHECKING_FOR_OUTDATED)
|
57
|
-
outdated_gem.expects(:load_bundle_versions).returns(true)
|
58
|
-
outdated_gem.expects(:compare_message).returns("compare message")
|
59
|
-
@cli.expects(:puts).with("compare message")
|
60
|
-
outdated_gem.expects :compare
|
61
|
-
@cli.compare "haml"
|
62
|
-
end
|
63
|
-
|
64
|
-
it "opens compare view with versions" do
|
65
|
-
outdated_gem = mock_gem("haml")
|
66
|
-
@cli.expects(:puts).with("http://github.com/haml/haml")
|
67
|
-
outdated_gem.expects(:set_versions).with("4.0.4", "4.0.5")
|
68
|
-
outdated_gem.expects(:missing_versions?).returns(false)
|
69
|
-
outdated_gem.expects(:compare_message).returns("compare message")
|
70
|
-
@cli.expects(:puts).with("compare message")
|
71
|
-
outdated_gem.expects :compare
|
72
|
-
@cli.compare "haml", "4.0.4", "4.0.5"
|
73
|
-
end
|
74
|
-
|
75
|
-
it "returns when the gem is not found" do
|
76
|
-
mock_missing_gem
|
77
|
-
@cli.expects(:puts).with("Could not find github repository for notfound.")
|
78
|
-
@cli.compare "notfound"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "#outdated" do
|
83
|
-
it "does nothing when nothing to update" do
|
84
|
-
mock_inspector = mock do
|
85
|
-
stubs list: []
|
86
|
-
stubs outdated: ""
|
87
|
-
end
|
88
|
-
BundleInspector.stubs new: mock_inspector
|
89
|
-
@cli.expects(:puts).with(CLI::CHECKING_FOR_OUTDATED)
|
90
|
-
@cli.expects(:puts).with("")
|
91
|
-
@cli.outdated
|
92
|
-
end
|
93
|
-
|
94
|
-
it "compares outdated gems with responses of y" do
|
95
|
-
outdated_gem = OutdatedGem.new("haml", "4.0.4", "4.0.5")
|
96
|
-
mock_inspector = mock do
|
97
|
-
stubs list: [outdated_gem]
|
98
|
-
stubs outdated: "outdated"
|
99
|
-
end
|
100
|
-
BundleInspector.stubs new: mock_inspector
|
101
|
-
@cli.stubs ask: 'y'
|
102
|
-
@cli.expects(:puts).with(CLI::CHECKING_FOR_OUTDATED)
|
103
|
-
@cli.expects(:puts).with("outdated")
|
104
|
-
@cli.expects(:puts).with("haml: 4.0.5 > 4.0.4")
|
105
|
-
outdated_gem.expects :compare
|
106
|
-
@cli.outdated
|
107
|
-
end
|
108
|
-
|
109
|
-
it "skips outdated gems without responses of y" do
|
110
|
-
outdated_gem = OutdatedGem.new("haml", "4.0.4", "4.0.5")
|
111
|
-
mock_inspector = mock do
|
112
|
-
stubs list: [outdated_gem]
|
113
|
-
stubs outdated: "outdated"
|
114
|
-
end
|
115
|
-
BundleInspector.stubs new: mock_inspector
|
116
|
-
@cli.stubs ask: ''
|
117
|
-
@cli.expects(:puts).with(CLI::CHECKING_FOR_OUTDATED)
|
118
|
-
@cli.expects(:puts).with("outdated")
|
119
|
-
@cli.expects(:puts).with("haml: 4.0.5 > 4.0.4")
|
120
|
-
outdated_gem.expects(:compare).never
|
121
|
-
@cli.outdated
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe "#update" do
|
126
|
-
before do
|
127
|
-
@mock_gem = mock do
|
128
|
-
stubs clean?: true
|
129
|
-
stubs diff: "le diff"
|
130
|
-
stubs show: "le show"
|
131
|
-
end
|
132
|
-
GemUpdater.stubs new: @mock_gem
|
133
|
-
end
|
134
|
-
|
135
|
-
it "updates the gem and returns with no response" do
|
136
|
-
@cli.stubs ask: ''
|
137
|
-
@cli.expects(:puts).with("Updating haml...")
|
138
|
-
@mock_gem.expects :update
|
139
|
-
@cli.expects(:puts).with("le diff")
|
140
|
-
@cli.update "haml"
|
141
|
-
end
|
142
|
-
|
143
|
-
it "updates the gem and commits with responses of c" do
|
144
|
-
@cli.stubs ask: 'c'
|
145
|
-
@cli.expects(:puts).with("Updating haml...")
|
146
|
-
@mock_gem.expects :update
|
147
|
-
@cli.expects(:puts).with("le diff")
|
148
|
-
@mock_gem.expects :commit
|
149
|
-
@cli.expects(:puts).with("\nle show")
|
150
|
-
@cli.update "haml"
|
151
|
-
end
|
152
|
-
|
153
|
-
it "updates the gem and resets with responses of r" do
|
154
|
-
@cli.stubs ask: 'r'
|
155
|
-
@cli.expects(:puts).with("Updating haml...")
|
156
|
-
@mock_gem.expects :update
|
157
|
-
@cli.expects(:puts).with("le diff")
|
158
|
-
@mock_gem.expects(:reset).returns("le reset")
|
159
|
-
@cli.expects(:puts).with("le reset")
|
160
|
-
@cli.update "haml"
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
private
|
165
|
-
|
166
|
-
def mock_gem(name)
|
167
|
-
outdated_gem = mock do
|
168
|
-
stubs repo?: true
|
169
|
-
stubs repo: "http://github.com/#{name}/#{name}"
|
170
|
-
end
|
171
|
-
OutdatedGem.stubs new: outdated_gem
|
172
|
-
outdated_gem
|
173
|
-
end
|
174
|
-
|
175
|
-
def mock_missing_gem
|
176
|
-
outdated_gem = mock { stubs repo?: false }
|
177
|
-
OutdatedGem.stubs new: outdated_gem
|
178
|
-
outdated_gem
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
data/test/gem_updater_test.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Gemdiff
|
4
|
-
class GemUpdaterTest < MiniTest::Spec
|
5
|
-
describe "#update" do
|
6
|
-
it "updates the gem" do
|
7
|
-
updater = GemUpdater.new("x")
|
8
|
-
updater.expects :bundle_update
|
9
|
-
updater.update
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#commit" do
|
14
|
-
it "adds a git commit for a gem update" do
|
15
|
-
updater = GemUpdater.new("aws-sdk")
|
16
|
-
updater.stubs git_changed_line: "+ aws-sdk (1.35.0)"
|
17
|
-
updater.expects(:git_add_and_commit_lockfile).with("1.35.0")
|
18
|
-
assert updater.commit
|
19
|
-
end
|
20
|
-
|
21
|
-
it "adds a git commit for an update from a specific ref" do
|
22
|
-
updater = GemUpdater.new("sass-rails")
|
23
|
-
updater.stubs git_changed_line: "+ sass-rails (4.0.3)\n+ sass-rails"
|
24
|
-
updater.expects(:git_add_and_commit_lockfile).with("4.0.3")
|
25
|
-
assert updater.commit
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "#reset" do
|
30
|
-
it "resets Gemfile.lock" do
|
31
|
-
updater = GemUpdater.new("x")
|
32
|
-
updater.expects :git_reset
|
33
|
-
updater.reset
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "#diff" do
|
38
|
-
it "returns git diff" do
|
39
|
-
updater = GemUpdater.new("x")
|
40
|
-
updater.expects :git_diff
|
41
|
-
updater.diff
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe "#show" do
|
46
|
-
it "returns git show" do
|
47
|
-
updater = GemUpdater.new("x")
|
48
|
-
updater.expects :git_show
|
49
|
-
updater.show
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "#clean?" do
|
54
|
-
it "returns true for empty diff" do
|
55
|
-
updater = GemUpdater.new("x")
|
56
|
-
updater.stubs git_diff: ""
|
57
|
-
assert updater.clean?
|
58
|
-
end
|
59
|
-
|
60
|
-
it "returns false for non-empty diff" do
|
61
|
-
updater = GemUpdater.new("x")
|
62
|
-
updater.stubs git_diff: "something"
|
63
|
-
refute updater.clean?
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
data/test/outdated_gem_test.rb
DELETED
@@ -1,150 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Gemdiff
|
4
|
-
class OutdatedGemTest < MiniTest::Spec
|
5
|
-
describe "#missing_versions?" do
|
6
|
-
it "returns true" do
|
7
|
-
assert OutdatedGem.new("x").missing_versions?
|
8
|
-
end
|
9
|
-
|
10
|
-
it "returns false" do
|
11
|
-
refute OutdatedGem.new("x", "1", "2").missing_versions?
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "#compare_url" do
|
16
|
-
it "returns compare url" do
|
17
|
-
outdated_gem = OutdatedGem.new("x", "1.0", "2.0")
|
18
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
19
|
-
assert_equal "http://github.com/x/x/compare/v1.0...v2.0", outdated_gem.compare_url
|
20
|
-
end
|
21
|
-
|
22
|
-
it "returns compare url with no v for exceptions" do
|
23
|
-
outdated_gem = OutdatedGem.new("haml", "4.0.0", "4.1.0")
|
24
|
-
outdated_gem.stubs repo: "http://github.com/haml/haml"
|
25
|
-
assert_equal "http://github.com/haml/haml/compare/4.0.0...4.1.0", outdated_gem.compare_url
|
26
|
-
end
|
27
|
-
|
28
|
-
it "returns compare url with branch name for new version" do
|
29
|
-
outdated_gem = OutdatedGem.new("x", "4.0.0", "master")
|
30
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
31
|
-
assert_equal "http://github.com/x/x/compare/v4.0.0...master", outdated_gem.compare_url
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "#releases_url" do
|
36
|
-
it "returns releases url" do
|
37
|
-
outdated_gem = OutdatedGem.new("x")
|
38
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
39
|
-
assert_equal "http://github.com/x/x/releases", outdated_gem.releases_url
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "#commits_url" do
|
44
|
-
it "returns commits url" do
|
45
|
-
outdated_gem = OutdatedGem.new("x")
|
46
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
47
|
-
assert_equal "http://github.com/x/x/commits/master", outdated_gem.commits_url
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "#compare_message" do
|
52
|
-
it "returns compare message" do
|
53
|
-
outdated_gem = OutdatedGem.new("x", "1", "2")
|
54
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
55
|
-
assert_equal "x: 2 > 1", outdated_gem.compare_message
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "#load_bundle_versions" do
|
60
|
-
it "returns false if not found" do
|
61
|
-
mock_inspector = mock { stubs :get }
|
62
|
-
BundleInspector.stubs new: mock_inspector
|
63
|
-
refute OutdatedGem.new("x").load_bundle_versions
|
64
|
-
end
|
65
|
-
|
66
|
-
it "sets versions from gem in bundle" do
|
67
|
-
mock_outdated_gem = OutdatedGem.new("y", "1.2.3", "2.3.4")
|
68
|
-
mock_inspector = mock { stubs get: mock_outdated_gem }
|
69
|
-
BundleInspector.stubs new: mock_inspector
|
70
|
-
outdated_gem = OutdatedGem.new("y")
|
71
|
-
assert outdated_gem.load_bundle_versions
|
72
|
-
assert_equal "1.2.3", outdated_gem.old_version
|
73
|
-
assert_equal "2.3.4", outdated_gem.new_version
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "#set_versions" do
|
78
|
-
it "sets nil versions" do
|
79
|
-
outdated_gem = OutdatedGem.new("x", "1", "2")
|
80
|
-
outdated_gem.set_versions nil, nil
|
81
|
-
assert_nil outdated_gem.old_version
|
82
|
-
assert_nil outdated_gem.new_version
|
83
|
-
end
|
84
|
-
|
85
|
-
it "sets old, new versions" do
|
86
|
-
outdated_gem = OutdatedGem.new("x")
|
87
|
-
outdated_gem.set_versions "1.2.34", "2.34.56"
|
88
|
-
assert_equal "1.2.34", outdated_gem.old_version
|
89
|
-
assert_equal "2.34.56", outdated_gem.new_version
|
90
|
-
end
|
91
|
-
|
92
|
-
it "swaps versions in the wrong order" do
|
93
|
-
outdated_gem = OutdatedGem.new("x")
|
94
|
-
outdated_gem.set_versions "2.34.56", "1.2.34"
|
95
|
-
assert_equal "1.2.34", outdated_gem.old_version
|
96
|
-
assert_equal "2.34.56", outdated_gem.new_version
|
97
|
-
end
|
98
|
-
|
99
|
-
it "swaps versions over 10 in the wrong order" do
|
100
|
-
outdated_gem = OutdatedGem.new("x")
|
101
|
-
outdated_gem.set_versions "1.10.0", "1.9.3"
|
102
|
-
assert_equal "1.9.3", outdated_gem.old_version
|
103
|
-
assert_equal "1.10.0", outdated_gem.new_version
|
104
|
-
end
|
105
|
-
|
106
|
-
it "swaps versions with master" do
|
107
|
-
outdated_gem = OutdatedGem.new("x")
|
108
|
-
outdated_gem.set_versions "master", "1.9.3"
|
109
|
-
assert_equal "1.9.3", outdated_gem.old_version
|
110
|
-
assert_equal "master", outdated_gem.new_version
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "#master" do
|
115
|
-
it "opens master commits url" do
|
116
|
-
outdated_gem = OutdatedGem.new("x")
|
117
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
118
|
-
outdated_gem.expects(:open_url).with("http://github.com/x/x/commits/master")
|
119
|
-
outdated_gem.master
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe "#releases" do
|
124
|
-
it "opens releases url" do
|
125
|
-
outdated_gem = OutdatedGem.new("x")
|
126
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
127
|
-
outdated_gem.expects(:open_url).with("http://github.com/x/x/releases")
|
128
|
-
outdated_gem.releases
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
describe "#compare" do
|
133
|
-
it "opens compare url" do
|
134
|
-
outdated_gem = OutdatedGem.new("x", "1.2.3", "2.3.4")
|
135
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
136
|
-
outdated_gem.expects(:open_url).with("http://github.com/x/x/compare/v1.2.3...v2.3.4")
|
137
|
-
outdated_gem.compare
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "#open" do
|
142
|
-
it "opens repo url" do
|
143
|
-
outdated_gem = OutdatedGem.new("x")
|
144
|
-
outdated_gem.stubs repo: "http://github.com/x/x"
|
145
|
-
outdated_gem.expects(:open_url).with("http://github.com/x/x")
|
146
|
-
outdated_gem.open
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
data/test/repo_finder_test.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Gemdiff
|
4
|
-
class RepoFinderTest < MiniTest::Spec
|
5
|
-
describe ".github_url" do
|
6
|
-
it "returns github url from local gemspec" do
|
7
|
-
RepoFinder.stubs find_local_gemspec: fake_gemspec("homepage: http://github.com/rails/arel")
|
8
|
-
RepoFinder.stubs last_shell_command_success?: true
|
9
|
-
assert_equal "http://github.com/rails/arel", RepoFinder.github_url("arel")
|
10
|
-
end
|
11
|
-
|
12
|
-
it "returns github url from remote gemspec" do
|
13
|
-
RepoFinder.stubs find_local_gemspec: ""
|
14
|
-
RepoFinder.stubs last_shell_command_success?: false
|
15
|
-
RepoFinder.stubs find_remote_gemspec: fake_gemspec("homepage: http://github.com/rails/arel")
|
16
|
-
assert_equal "http://github.com/rails/arel", RepoFinder.github_url("arel")
|
17
|
-
end
|
18
|
-
|
19
|
-
it "returns github url from github search" do
|
20
|
-
RepoFinder.stubs octokit_client: mock_octokit("haml/haml")
|
21
|
-
RepoFinder.stubs gemspec: fake_gemspec
|
22
|
-
assert_equal "http://github.com/haml/haml", RepoFinder.github_url("haml")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns nil when not found" do
|
26
|
-
RepoFinder.stubs octokit_client: mock_octokit(nil)
|
27
|
-
RepoFinder.stubs gemspec: fake_gemspec
|
28
|
-
assert_nil RepoFinder.github_url("not_found")
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns exception url" do
|
32
|
-
assert_equal "http://github.com/rails/rails", RepoFinder.github_url('activerecord')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def mock_octokit(full_name)
|
39
|
-
mock_items = if full_name.nil?
|
40
|
-
mock { stubs items: [] }
|
41
|
-
else
|
42
|
-
mock_item = mock { stubs full_name: full_name }
|
43
|
-
mock { stubs items: [mock_item] }
|
44
|
-
end
|
45
|
-
mock { stubs search_repositories: mock_items }
|
46
|
-
end
|
47
|
-
|
48
|
-
FAKE_GEMSPEC = %(
|
49
|
-
--- !ruby/object:Gem::Specification
|
50
|
-
name: fake
|
51
|
-
version: !ruby/object:Gem::Version
|
52
|
-
version: 1.2.3
|
53
|
-
description: fake
|
54
|
-
)
|
55
|
-
|
56
|
-
def fake_gemspec(extra = "")
|
57
|
-
[FAKE_GEMSPEC, extra].compact.join("\n")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|