jekyll-redirect-from 0.5.0 → 0.6.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/History.markdown +4 -0
- data/lib/jekyll-redirect-from/redirector.rb +1 -0
- data/lib/jekyll-redirect-from/version.rb +1 -1
- data/spec/fixtures/_articles/redirect-me-plz.md +6 -0
- data/spec/fixtures/_authors/kansaichris.md +5 -0
- data/spec/fixtures/_config.yml +3 -0
- data/spec/integrations_spec.rb +13 -0
- data/spec/jekyll_redirect_from/redirector_spec.rb +5 -0
- data/spec/spec_helper.rb +19 -7
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d84d547b4d8f64485f2a7628b4efe3a639f0e6b
|
4
|
+
data.tar.gz: 91b3cd70189abca2abc17040958303931e84e0ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 478002c1287ff8cb0f7c6d5f43c37d64f80036d04a252b15964b715ffee0eb591bf6656695068097c7e9c3aa38fde573de0a63480694b431a47e6e8d3ce795c9
|
7
|
+
data.tar.gz: 24b635e5e0ea0195a5423dce18f826d5ea767adc5b2dd701322810933b52b5c67d9681612c7a4ed191c9fdf05c4017d7dd52570c2177af96f0486b51bb5e1dee
|
data/History.markdown
CHANGED
data/spec/fixtures/_config.yml
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe("Integration Tests") do
|
4
|
+
it "writes the redirect pages for collection items which are outputted" do
|
5
|
+
expect(@dest.join("articles", "redirect-me-plz.html")).to exist
|
6
|
+
expect(@dest.join("articles", "23128432159832", "mary-had-a-little-lamb")).to exist
|
7
|
+
end
|
8
|
+
|
9
|
+
it "doesn't write redirect pages for collection items which are not outputted" do
|
10
|
+
expect(@dest.join("authors")).not_to exist
|
11
|
+
expect(@dest.join("kansaichris")).not_to exist
|
12
|
+
end
|
13
|
+
end
|
@@ -3,6 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe JekyllRedirectFrom::Redirector do
|
4
4
|
let(:redirector) { described_class.new }
|
5
5
|
let(:post_to_redirect) { setup_post("2014-01-03-redirect-me-plz.md") }
|
6
|
+
let(:doc_to_redirect) { setup_doc }
|
6
7
|
let(:page_with_one) { setup_page("one_redirect_url.md") }
|
7
8
|
let(:page_with_many) { setup_page("multiple_redirect_urls.md") }
|
8
9
|
let(:page_with_one_redirect_to) { setup_page("one_redirect_to.md") }
|
@@ -12,6 +13,10 @@ describe JekyllRedirectFrom::Redirector do
|
|
12
13
|
expect(redirector.has_alt_urls?(post_to_redirect)).to be_truthy
|
13
14
|
end
|
14
15
|
|
16
|
+
it "knows if a document is requesting a redirect page" do
|
17
|
+
expect(redirector.has_alt_urls?(doc_to_redirect)).to be_truthy
|
18
|
+
end
|
19
|
+
|
15
20
|
it "handles one redirect path" do
|
16
21
|
expect(redirector.alt_urls(page_with_one)).to eql(["mencius/was/my/father"])
|
17
22
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -14,15 +14,19 @@ RSpec.configure do |config|
|
|
14
14
|
Jekyll.logger.log_level = :error
|
15
15
|
|
16
16
|
@fixtures_path = Pathname.new(__FILE__).parent.join("fixtures")
|
17
|
-
@dest
|
18
|
-
@posts_src
|
19
|
-
@layouts_src =
|
20
|
-
@plugins_src =
|
17
|
+
@dest = @fixtures_path.join("_site")
|
18
|
+
@posts_src = @fixtures_path.join("_posts")
|
19
|
+
@layouts_src = @fixtures_path.join("_layouts")
|
20
|
+
@plugins_src = @fixtures_path.join("_plugins")
|
21
21
|
|
22
22
|
@site = Jekyll::Site.new(Jekyll.configuration({
|
23
23
|
"source" => @fixtures_path.to_s,
|
24
24
|
"destination" => @dest.to_s,
|
25
|
-
"plugins" => @plugins_src
|
25
|
+
"plugins" => @plugins_src.to_s,
|
26
|
+
"collections" => {
|
27
|
+
"articles" => {"output" => true},
|
28
|
+
"authors" => {}
|
29
|
+
}
|
26
30
|
}))
|
27
31
|
|
28
32
|
@dest.rmtree if @dest.exist?
|
@@ -33,12 +37,20 @@ RSpec.configure do |config|
|
|
33
37
|
@dest.rmtree if @dest.exist?
|
34
38
|
end
|
35
39
|
|
40
|
+
def unpublished_doc
|
41
|
+
@site.collections["authors"].docs.first
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup_doc
|
45
|
+
@site.collections["articles"].docs.first
|
46
|
+
end
|
47
|
+
|
36
48
|
def setup_post(file)
|
37
|
-
Jekyll::Post.new(@site, @fixtures_path, '', file)
|
49
|
+
Jekyll::Post.new(@site, @fixtures_path.to_s, '', file)
|
38
50
|
end
|
39
51
|
|
40
52
|
def setup_page(file)
|
41
|
-
Jekyll::Page.new(@site, @fixtures_path, File.dirname(file), File.basename(file))
|
53
|
+
Jekyll::Page.new(@site, @fixtures_path.to_s, File.dirname(file), File.basename(file))
|
42
54
|
end
|
43
55
|
|
44
56
|
def destination_file_exists?(file)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-redirect-from
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -89,12 +89,15 @@ files:
|
|
89
89
|
- script/bootstrap
|
90
90
|
- script/cibuild
|
91
91
|
- script/release
|
92
|
+
- spec/fixtures/_articles/redirect-me-plz.md
|
93
|
+
- spec/fixtures/_authors/kansaichris.md
|
92
94
|
- spec/fixtures/_config.yml
|
93
95
|
- spec/fixtures/_posts/2014-01-03-redirect-me-plz.md
|
94
96
|
- spec/fixtures/multiple_redirect_tos.md
|
95
97
|
- spec/fixtures/multiple_redirect_urls.md
|
96
98
|
- spec/fixtures/one_redirect_to.md
|
97
99
|
- spec/fixtures/one_redirect_url.md
|
100
|
+
- spec/integrations_spec.rb
|
98
101
|
- spec/jekyll_redirect_from/redirect_page_spec.rb
|
99
102
|
- spec/jekyll_redirect_from/redirector_spec.rb
|
100
103
|
- spec/spec_helper.rb
|
@@ -123,12 +126,15 @@ signing_key:
|
|
123
126
|
specification_version: 4
|
124
127
|
summary: Seamlessly specify multiple redirection URLs for your pages and posts
|
125
128
|
test_files:
|
129
|
+
- spec/fixtures/_articles/redirect-me-plz.md
|
130
|
+
- spec/fixtures/_authors/kansaichris.md
|
126
131
|
- spec/fixtures/_config.yml
|
127
132
|
- spec/fixtures/_posts/2014-01-03-redirect-me-plz.md
|
128
133
|
- spec/fixtures/multiple_redirect_tos.md
|
129
134
|
- spec/fixtures/multiple_redirect_urls.md
|
130
135
|
- spec/fixtures/one_redirect_to.md
|
131
136
|
- spec/fixtures/one_redirect_url.md
|
137
|
+
- spec/integrations_spec.rb
|
132
138
|
- spec/jekyll_redirect_from/redirect_page_spec.rb
|
133
139
|
- spec/jekyll_redirect_from/redirector_spec.rb
|
134
140
|
- spec/spec_helper.rb
|