compare_linker 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/compare_linker.gemspec +2 -0
- data/lib/compare_linker/formatter/base.rb +26 -2
- data/lib/compare_linker/formatter/markdown.rb +3 -18
- data/lib/compare_linker/formatter/text.rb +7 -12
- data/lib/compare_linker/lockfile_comparator.rb +1 -0
- data/lib/compare_linker/version.rb +1 -1
- data/spec/factories/gem_info.rb +172 -0
- data/spec/lib/compare_linker/formatter/markdown_spec.rb +73 -0
- data/spec/lib/compare_linker/formatter/text_spec.rb +73 -0
- data/spec/spec_helper.rb +7 -2
- metadata +36 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aef939118994b5fb0173c1ebda2ade1e4443c163
|
4
|
+
data.tar.gz: 023c4e1deca57013afdf6a4262e69c111f746daa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aac7dbc6e9270bec1b411e2155c939d1d8ffe6944b93b559b21bc97383c8374b93cc2c422721b82131f3e2db2743e3c532a3d34abc3fc3a83fc73b587cedd097
|
7
|
+
data.tar.gz: 4cb45a80a5cea8c4d91858380da7c0acfd19275e007e79e2d687545a67c277eac8eafde0c593b4dd2263eb1562ba38a680056fd3f7e6ce3d8b3bd667e6649a00
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
Create GitHub's compare view URLs for pull request from diff of `Gemfile.lock` (and post comment to pull request).
|
14
14
|
|
15
|
-
![screen shot
|
15
|
+
![screen shot 2016-10-09 at 7 53 23 pm](https://cloud.githubusercontent.com/assets/170014/19219899/fd06eab8-8e5a-11e6-95fb-3b467088a712.png)
|
16
16
|
|
17
17
|
[GitHub Compare View](https://github.com/blog/612-introducing-github-compare-view) rocks.But [diff of Gemfile.lock](https://github.com/kyanny/compare_linker_demo/pull/14/files) sucks. So I made Compare Linker.
|
18
18
|
|
data/compare_linker.gemspec
CHANGED
@@ -21,7 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency "octokit"
|
22
22
|
spec.add_dependency "httpclient"
|
23
23
|
|
24
|
+
spec.add_development_dependency "activesupport", "~> 4" # for ruby-2.[0-2].0 tests, required by factory_girl
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "factory_girl"
|
25
27
|
spec.add_development_dependency "rake"
|
26
28
|
spec.add_development_dependency "rspec"
|
27
29
|
end
|
@@ -1,16 +1,40 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
|
1
3
|
class CompareLinker
|
2
4
|
class Formatter
|
3
5
|
class Base
|
6
|
+
attr_reader :g, :downgraded
|
7
|
+
|
8
|
+
def format(gem_info)
|
9
|
+
@g = OpenStruct.new(gem_info)
|
10
|
+
@downgraded = downgrade?(g.old_ver, g.new_ver, g.old_tag, g.new_tag, g.old_rev, g.new_rev)
|
11
|
+
post_format
|
12
|
+
end
|
13
|
+
|
4
14
|
private
|
5
15
|
|
6
|
-
def
|
16
|
+
def post_format
|
17
|
+
raise NotImplementedError
|
18
|
+
end
|
19
|
+
|
20
|
+
def downgrade?(old_ver, new_ver, old_tag, new_tag, old_rev, new_rev)
|
7
21
|
Gem::Version.new(new_ver) < Gem::Version.new(old_ver) ||
|
8
|
-
(old_tag && new_tag && Gem::Version.new(to_ver(new_tag)) < Gem::Version.new(to_ver(old_tag)))
|
22
|
+
(old_tag && new_tag && Gem::Version.new(to_ver(new_tag)) < Gem::Version.new(to_ver(old_tag))) ||
|
23
|
+
(old_rev && new_rev && Gem::Version.new(to_ver(new_rev)) < Gem::Version.new(to_ver(old_rev)))
|
9
24
|
end
|
10
25
|
|
11
26
|
def to_ver(tag)
|
12
27
|
return $1 if tag =~ /(\d+(?:\.\d+)+)\z/
|
13
28
|
end
|
29
|
+
|
30
|
+
def github_url(repo_owner, repo_name)
|
31
|
+
"https://github.com/#{repo_owner}/#{repo_name}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def github_compare_url(repo_owner, repo_name, old_tag, new_tag)
|
35
|
+
range = downgraded ? "#{new_tag}...#{old_tag}" : "#{old_tag}...#{new_tag}"
|
36
|
+
"#{github_url(repo_owner, repo_name)}/compare/#{range}"
|
37
|
+
end
|
14
38
|
end
|
15
39
|
end
|
16
40
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require "ostruct"
|
2
|
-
|
3
1
|
class CompareLinker
|
4
2
|
class Formatter
|
5
3
|
class Markdown < Base
|
6
|
-
|
7
|
-
g = OpenStruct.new(gem_info)
|
4
|
+
private
|
8
5
|
|
6
|
+
def post_format
|
9
7
|
text = "* [ ] "
|
10
8
|
text += case
|
11
9
|
when g.owner && g.old_rev && g.new_rev
|
@@ -54,22 +52,9 @@ class CompareLinker
|
|
54
52
|
]
|
55
53
|
end
|
56
54
|
|
57
|
-
|
58
|
-
text += " (downgrade)"
|
59
|
-
end
|
60
|
-
|
55
|
+
text += " (downgrade)" if downgraded
|
61
56
|
text
|
62
57
|
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def github_url(repo_owner, repo_name)
|
67
|
-
"https://github.com/#{repo_owner}/#{repo_name}"
|
68
|
-
end
|
69
|
-
|
70
|
-
def github_compare_url(repo_owner, repo_name, old_tag, new_tag)
|
71
|
-
"#{github_url(repo_owner, repo_name)}/compare/#{old_tag}...#{new_tag}"
|
72
|
-
end
|
73
58
|
end
|
74
59
|
end
|
75
60
|
end
|
@@ -1,30 +1,25 @@
|
|
1
|
-
require "ostruct"
|
2
|
-
|
3
1
|
class CompareLinker
|
4
2
|
class Formatter
|
5
3
|
class Text < Base
|
6
|
-
|
7
|
-
g = OpenStruct.new(gem_info)
|
4
|
+
private
|
8
5
|
|
6
|
+
def post_format
|
9
7
|
text = case
|
10
8
|
when g.owner && g.old_rev && g.new_rev
|
11
|
-
"#{g.gem_name}:
|
9
|
+
"#{g.gem_name}: #{github_compare_url(g.owner, g.gem_name, g.old_rev, g.new_rev)}"
|
12
10
|
when g.homepage_uri && g.old_tag && g.new_tag
|
13
|
-
"#{g.gem_name} (#{g.homepage_uri}):
|
11
|
+
"#{g.gem_name} (#{g.homepage_uri}): #{github_compare_url(g.repo_owner, g.repo_name, g.old_tag, g.new_tag)}"
|
14
12
|
when g.homepage_uri
|
15
13
|
"#{g.gem_name} (#{g.homepage_uri}): #{g.old_ver}...#{g.new_ver}"
|
16
14
|
when g.old_tag && g.new_tag
|
17
|
-
"#{g.gem_name}:
|
15
|
+
"#{g.gem_name}: #{github_compare_url(g.repo_owner, g.repo_name, g.old_tag, g.new_tag)}"
|
18
16
|
when g.repo_owner && g.repo_name
|
19
|
-
"#{g.gem_name}:
|
17
|
+
"#{g.gem_name}: #{github_url(g.repo_owner, g.repo_name)} #{g.old_ver}...#{g.new_ver}"
|
20
18
|
else
|
21
19
|
"#{g.gem_name} (link not found): #{g.old_ver}...#{g.new_ver}"
|
22
20
|
end
|
23
21
|
|
24
|
-
|
25
|
-
text += " (downgrade)"
|
26
|
-
end
|
27
|
-
|
22
|
+
text += " (downgrade)" if downgraded
|
28
23
|
text
|
29
24
|
end
|
30
25
|
end
|
@@ -13,6 +13,7 @@ class CompareLinker
|
|
13
13
|
old_rev = old_spec.source.options["revision"]
|
14
14
|
new_rev = new_spec.source.options["revision"]
|
15
15
|
if old_rev && new_rev && (old_rev != new_rev)
|
16
|
+
# This section may be unnecessary?
|
16
17
|
_, owner, gem_name = old_spec.source.uri.match(/github\.com\/([^\/]+)\/([^.]+)/).to_a
|
17
18
|
updated_gems[old_spec.name] = {
|
18
19
|
owner: owner,
|
@@ -0,0 +1,172 @@
|
|
1
|
+
FactoryGirl.define do
|
2
|
+
factory :gem_info, class: Hash do
|
3
|
+
factory :g_owner__old_rev__new_rev do
|
4
|
+
defaults = {
|
5
|
+
owner: 'masutaka',
|
6
|
+
gem_name: 'compare_linker',
|
7
|
+
}
|
8
|
+
|
9
|
+
factory :g_upgrade__owner__old_rev__new_rev do
|
10
|
+
initialize_with do
|
11
|
+
defaults.merge(
|
12
|
+
old_rev: '1.1.1',
|
13
|
+
new_rev: '1.1.2'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
factory :g_downgrade__owner__old_rev__new_rev do
|
19
|
+
initialize_with do
|
20
|
+
defaults.merge(
|
21
|
+
old_rev: '1.1.2',
|
22
|
+
new_rev: '1.1.1'
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
factory :g_homepage_uri__old_tag__new_tag do
|
29
|
+
defaults = {
|
30
|
+
owner: nil,
|
31
|
+
gem_name: 'serverspec',
|
32
|
+
homepage_uri: 'http://serverspec.org/',
|
33
|
+
repo_owner: 'mizzy',
|
34
|
+
repo_name: 'serverspec',
|
35
|
+
}
|
36
|
+
|
37
|
+
factory :g_upgrade__homepage_uri__old_tag__new_tag do
|
38
|
+
initialize_with do
|
39
|
+
defaults.merge(
|
40
|
+
old_ver: '2.24.0',
|
41
|
+
new_ver: '2.24.1',
|
42
|
+
old_tag: 'v2.24.0',
|
43
|
+
new_tag: 'v2.24.1'
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
factory :g_downgrade__homepage_uri__old_tag__new_tag do
|
49
|
+
initialize_with do
|
50
|
+
defaults.merge(
|
51
|
+
old_ver: '2.24.1',
|
52
|
+
new_ver: '2.24.0',
|
53
|
+
old_tag: 'v2.24.1',
|
54
|
+
new_tag: 'v2.24.0'
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
factory :g_homepage_uri do
|
61
|
+
defaults = {
|
62
|
+
owner: nil,
|
63
|
+
gem_name: 'mixlib-shellout',
|
64
|
+
homepage_uri: 'https://www.chef.io/',
|
65
|
+
}
|
66
|
+
|
67
|
+
factory :g_upgrade__homepage_uri do
|
68
|
+
initialize_with do
|
69
|
+
defaults.merge(
|
70
|
+
old_ver: '2.1.0',
|
71
|
+
new_ver: '2.2.1'
|
72
|
+
)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
factory :g_downgrade__homepage_uri do
|
77
|
+
initialize_with do
|
78
|
+
defaults.merge(
|
79
|
+
old_ver: '2.2.1',
|
80
|
+
new_ver: '2.1.0'
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
factory :g_old_tag__new_tag do
|
87
|
+
defaults = {
|
88
|
+
owner: nil,
|
89
|
+
gem_name: 'chef',
|
90
|
+
homepage_uri: nil,
|
91
|
+
repo_owner: 'chef',
|
92
|
+
repo_name: 'chef',
|
93
|
+
}
|
94
|
+
|
95
|
+
factory :g_upgrade__old_tag__new_tag do
|
96
|
+
initialize_with do
|
97
|
+
defaults.merge(
|
98
|
+
old_ver: '12.4.1',
|
99
|
+
new_ver: '12.4.3',
|
100
|
+
old_tag: '12.4.1',
|
101
|
+
new_tag: '12.4.3'
|
102
|
+
)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
factory :g_downgrade__old_tag__new_tag do
|
107
|
+
initialize_with do
|
108
|
+
defaults.merge(
|
109
|
+
old_ver: '12.4.3',
|
110
|
+
new_ver: '12.4.1',
|
111
|
+
old_tag: '12.4.3',
|
112
|
+
new_tag: '12.4.1'
|
113
|
+
)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
factory :g_repo_owner__repo_name do
|
119
|
+
defaults = {
|
120
|
+
owner: nil,
|
121
|
+
gem_name: 'sfl',
|
122
|
+
homepage_uri: nil,
|
123
|
+
repo_owner: 'ujihisa',
|
124
|
+
repo_name: 'spawn-for-legacy',
|
125
|
+
}
|
126
|
+
|
127
|
+
factory :g_upgrade__repo_owner__repo_name do
|
128
|
+
initialize_with do
|
129
|
+
defaults.merge(
|
130
|
+
old_ver: '2.2',
|
131
|
+
new_ver: '2.3'
|
132
|
+
)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
factory :g_downgrade__repo_owner__repo_name do
|
137
|
+
initialize_with do
|
138
|
+
defaults.merge(
|
139
|
+
old_ver: '2.3',
|
140
|
+
new_ver: '2.2'
|
141
|
+
)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
factory :g_else do
|
147
|
+
defaults = {
|
148
|
+
owner: nil,
|
149
|
+
gem_name: 'json',
|
150
|
+
homepage_uri: nil,
|
151
|
+
}
|
152
|
+
|
153
|
+
factory :g_upgrade__else do
|
154
|
+
initialize_with do
|
155
|
+
defaults.merge(
|
156
|
+
old_ver: '1.8.1',
|
157
|
+
new_ver: '1.8.2'
|
158
|
+
)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
factory :g_downgrade__else do
|
163
|
+
initialize_with do
|
164
|
+
defaults.merge(
|
165
|
+
old_ver: '1.8.2',
|
166
|
+
new_ver: '1.8.1'
|
167
|
+
)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CompareLinker::Formatter::Markdown do
|
4
|
+
describe '#format' do
|
5
|
+
subject { described_class.new.format(gem_info) }
|
6
|
+
|
7
|
+
context 'given upgrade (normal)' do
|
8
|
+
context 'given owner && old_rev && new_rev' do
|
9
|
+
# This spec may be unnecessary.
|
10
|
+
let(:gem_info) { build(:g_upgrade__owner__old_rev__new_rev) }
|
11
|
+
it { is_expected.to eq '* [ ] [compare_linker](https://github.com/masutaka/compare_linker): [`1.1.1...1.1.2`](https://github.com/masutaka/compare_linker/compare/1.1.1...1.1.2)' }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'given homepage_uri && old_tag && new_tag' do
|
15
|
+
let(:gem_info) { build(:g_upgrade__homepage_uri__old_tag__new_tag) }
|
16
|
+
it { is_expected.to eq '* [ ] [serverspec](https://github.com/mizzy/serverspec): [`2.24.0...2.24.1`](https://github.com/mizzy/serverspec/compare/v2.24.0...v2.24.1)' }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'given homepage_uri' do
|
20
|
+
let(:gem_info) { build(:g_upgrade__homepage_uri) }
|
21
|
+
it { is_expected.to eq '* [ ] [mixlib-shellout](https://www.chef.io/): `2.1.0...2.2.1`' }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'given old_tag && new_tag' do
|
25
|
+
let(:gem_info) { build(:g_upgrade__old_tag__new_tag) }
|
26
|
+
it { is_expected.to eq '* [ ] [chef](https://github.com/chef/chef): [`12.4.1...12.4.3`](https://github.com/chef/chef/compare/12.4.1...12.4.3)' }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'given repo_owner && repo_name' do
|
30
|
+
let(:gem_info) { build(:g_upgrade__repo_owner__repo_name) }
|
31
|
+
it { is_expected.to eq '* [ ] [sfl](https://github.com/ujihisa/spawn-for-legacy): `2.2...2.3`' }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'given else' do
|
35
|
+
let(:gem_info) { build(:g_upgrade__else) }
|
36
|
+
it { is_expected.to eq '* [ ] json: (link not found) `1.8.1...1.8.2`' }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'given downgrade' do
|
41
|
+
context 'given owner && old_rev && new_rev' do
|
42
|
+
# This spec may be unnecessary.
|
43
|
+
let(:gem_info) { build(:g_downgrade__owner__old_rev__new_rev) }
|
44
|
+
it { is_expected.to eq '* [ ] [compare_linker](https://github.com/masutaka/compare_linker): [`1.1.2...1.1.1`](https://github.com/masutaka/compare_linker/compare/1.1.1...1.1.2) (downgrade)' }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'given homepage_uri && old_tag && new_tag' do
|
48
|
+
let(:gem_info) { build(:g_downgrade__homepage_uri__old_tag__new_tag) }
|
49
|
+
it { is_expected.to eq '* [ ] [serverspec](https://github.com/mizzy/serverspec): [`2.24.1...2.24.0`](https://github.com/mizzy/serverspec/compare/v2.24.0...v2.24.1) (downgrade)' }
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'given homepage_uri' do
|
53
|
+
let(:gem_info) { build(:g_downgrade__homepage_uri) }
|
54
|
+
it { is_expected.to eq '* [ ] [mixlib-shellout](https://www.chef.io/): `2.2.1...2.1.0` (downgrade)' }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'given old_tag && new_tag' do
|
58
|
+
let(:gem_info) { build(:g_downgrade__old_tag__new_tag) }
|
59
|
+
it { is_expected.to eq '* [ ] [chef](https://github.com/chef/chef): [`12.4.3...12.4.1`](https://github.com/chef/chef/compare/12.4.1...12.4.3) (downgrade)' }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'given repo_owner && repo_name' do
|
63
|
+
let(:gem_info) { build(:g_downgrade__repo_owner__repo_name) }
|
64
|
+
it { is_expected.to eq '* [ ] [sfl](https://github.com/ujihisa/spawn-for-legacy): `2.3...2.2` (downgrade)' }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'given else' do
|
68
|
+
let(:gem_info) { build(:g_downgrade__else) }
|
69
|
+
it { is_expected.to eq '* [ ] json: (link not found) `1.8.2...1.8.1` (downgrade)' }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CompareLinker::Formatter::Text do
|
4
|
+
describe '#format' do
|
5
|
+
subject { described_class.new.format(gem_info) }
|
6
|
+
|
7
|
+
context 'given upgrade (normal)' do
|
8
|
+
context 'given owner && old_rev && new_rev' do
|
9
|
+
# This spec may be unnecessary.
|
10
|
+
let(:gem_info) { build(:g_upgrade__owner__old_rev__new_rev) }
|
11
|
+
it { is_expected.to eq 'compare_linker: https://github.com/masutaka/compare_linker/compare/1.1.1...1.1.2' }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'given homepage_uri && old_tag && new_tag' do
|
15
|
+
let(:gem_info) { build(:g_upgrade__homepage_uri__old_tag__new_tag) }
|
16
|
+
it { is_expected.to eq 'serverspec (http://serverspec.org/): https://github.com/mizzy/serverspec/compare/v2.24.0...v2.24.1' }
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'given homepage_uri' do
|
20
|
+
let(:gem_info) { build(:g_upgrade__homepage_uri) }
|
21
|
+
it { is_expected.to eq 'mixlib-shellout (https://www.chef.io/): 2.1.0...2.2.1' }
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'given old_tag && new_tag' do
|
25
|
+
let(:gem_info) { build(:g_upgrade__old_tag__new_tag) }
|
26
|
+
it { is_expected.to eq 'chef: https://github.com/chef/chef/compare/12.4.1...12.4.3' }
|
27
|
+
end
|
28
|
+
|
29
|
+
context 'given repo_owner && repo_name' do
|
30
|
+
let(:gem_info) { build(:g_upgrade__repo_owner__repo_name) }
|
31
|
+
it { is_expected.to eq 'sfl: https://github.com/ujihisa/spawn-for-legacy 2.2...2.3' }
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'given else' do
|
35
|
+
let(:gem_info) { build(:g_upgrade__else) }
|
36
|
+
it { is_expected.to eq 'json (link not found): 1.8.1...1.8.2' }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'given downgrade' do
|
41
|
+
context 'given owner && old_rev && new_rev' do
|
42
|
+
# This spec may be unnecessary.
|
43
|
+
let(:gem_info) { build(:g_downgrade__owner__old_rev__new_rev) }
|
44
|
+
it { is_expected.to eq 'compare_linker: https://github.com/masutaka/compare_linker/compare/1.1.1...1.1.2 (downgrade)' }
|
45
|
+
end
|
46
|
+
|
47
|
+
context 'given homepage_uri && old_tag && new_tag' do
|
48
|
+
let(:gem_info) { build(:g_downgrade__homepage_uri__old_tag__new_tag) }
|
49
|
+
it { is_expected.to eq 'serverspec (http://serverspec.org/): https://github.com/mizzy/serverspec/compare/v2.24.0...v2.24.1 (downgrade)' }
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'given homepage_uri' do
|
53
|
+
let(:gem_info) { build(:g_downgrade__homepage_uri) }
|
54
|
+
it { is_expected.to eq 'mixlib-shellout (https://www.chef.io/): 2.2.1...2.1.0 (downgrade)' }
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'given old_tag && new_tag' do
|
58
|
+
let(:gem_info) { build(:g_downgrade__old_tag__new_tag) }
|
59
|
+
it { is_expected.to eq 'chef: https://github.com/chef/chef/compare/12.4.1...12.4.3 (downgrade)' }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'given repo_owner && repo_name' do
|
63
|
+
let(:gem_info) { build(:g_downgrade__repo_owner__repo_name) }
|
64
|
+
it { is_expected.to eq 'sfl: https://github.com/ujihisa/spawn-for-legacy 2.3...2.2 (downgrade)' }
|
65
|
+
end
|
66
|
+
|
67
|
+
context 'given else' do
|
68
|
+
let(:gem_info) { build(:g_downgrade__else) }
|
69
|
+
it { is_expected.to eq 'json (link not found): 1.8.2...1.8.1 (downgrade)' }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
require 'compare_linker'
|
2
|
+
require 'factory_girl'
|
1
3
|
require 'rspec'
|
2
|
-
require "compare_linker"
|
3
|
-
|
4
4
|
|
5
5
|
Dir["#{__dir__}/support/**/*.rb"].each do |f|
|
6
6
|
require f
|
7
7
|
end
|
8
8
|
|
9
9
|
RSpec.configure do |config|
|
10
|
+
config.include FactoryGirl::Syntax::Methods
|
10
11
|
config.include LoadFixtureHelper
|
12
|
+
|
13
|
+
config.before(:suite) do
|
14
|
+
FactoryGirl.find_definitions
|
15
|
+
end
|
11
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: compare_linker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kensuke Nagae
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,20 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '1.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: factory_girl
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,9 +138,12 @@ files:
|
|
110
138
|
- lib/compare_linker/webhook_payload.rb
|
111
139
|
- payload.rb
|
112
140
|
- runner.rb
|
141
|
+
- spec/factories/gem_info.rb
|
113
142
|
- spec/fixtures/coffee-script-source.json
|
114
143
|
- spec/fixtures/rails.json
|
115
144
|
- spec/fixtures/web_translate_it.json
|
145
|
+
- spec/lib/compare_linker/formatter/markdown_spec.rb
|
146
|
+
- spec/lib/compare_linker/formatter/text_spec.rb
|
116
147
|
- spec/lib/compare_linker/gem_dictionary_spec.rb
|
117
148
|
- spec/lib/compare_linker/github_link_finder_spec.rb
|
118
149
|
- spec/spec_helper.rb
|
@@ -142,9 +173,12 @@ signing_key:
|
|
142
173
|
specification_version: 4
|
143
174
|
summary: Create GitHub's compare view URLs for pull request
|
144
175
|
test_files:
|
176
|
+
- spec/factories/gem_info.rb
|
145
177
|
- spec/fixtures/coffee-script-source.json
|
146
178
|
- spec/fixtures/rails.json
|
147
179
|
- spec/fixtures/web_translate_it.json
|
180
|
+
- spec/lib/compare_linker/formatter/markdown_spec.rb
|
181
|
+
- spec/lib/compare_linker/formatter/text_spec.rb
|
148
182
|
- spec/lib/compare_linker/gem_dictionary_spec.rb
|
149
183
|
- spec/lib/compare_linker/github_link_finder_spec.rb
|
150
184
|
- spec/spec_helper.rb
|