jekyll-redirect-from 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00b63d3652670cb824eac206484575da47507dd7
4
- data.tar.gz: 4b21faeb8f35a76532c4473bf9df0fe79453b97a
3
+ metadata.gz: 5d84d547b4d8f64485f2a7628b4efe3a639f0e6b
4
+ data.tar.gz: 91b3cd70189abca2abc17040958303931e84e0ec
5
5
  SHA512:
6
- metadata.gz: 37a01d9e02364740b8f76373e8a3f987df5ab2c46625cd8372fd221a88194fae4be7812d4069a93784116ba735811b916e9d9b7f6301fa1f08b5adf494c1e92a
7
- data.tar.gz: af8280d5ab1735fdfc02dc1c3480b1ea514ef10c50e332bd97110537218b6a6ade3851ba47569135f82d43b80d33c05d3115d2f6853f1118e2be94dc40f98ca5
6
+ metadata.gz: 478002c1287ff8cb0f7c6d5f43c37d64f80036d04a252b15964b715ffee0eb591bf6656695068097c7e9c3aa38fde573de0a63480694b431a47e6e8d3ce795c9
7
+ data.tar.gz: 24b635e5e0ea0195a5423dce18f826d5ea767adc5b2dd701322810933b52b5c67d9681612c7a4ed191c9fdf05c4017d7dd52570c2177af96f0486b51bb5e1dee
data/History.markdown CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 0.6.0 / 2014-08-22
4
+
5
+ * Support redirecting to/from collection documents (#40)
6
+
3
7
  ## 0.5.0 / 2014-08-10
4
8
 
5
9
  ### Minor Enhancements
@@ -6,6 +6,7 @@ module JekyllRedirectFrom
6
6
  original_pages = site.pages.dup
7
7
  generate_alt_urls(site, site.posts)
8
8
  generate_alt_urls(site, original_pages)
9
+ generate_alt_urls(site, site.docs_to_write)
9
10
  end
10
11
 
11
12
  def generate_alt_urls(site, list)
@@ -1,3 +1,3 @@
1
1
  module JekyllRedirectFrom
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: Please redirect me, sir.
3
+ redirect_from: /articles/23128432159832/mary-had-a-little-lamb
4
+ ---
5
+
6
+ Yay.
@@ -0,0 +1,5 @@
1
+ ---
2
+ redirect_from: /kansaichris/
3
+ ---
4
+
5
+ Hi.
@@ -1,3 +1,6 @@
1
1
  url: http://jekyllrb.com
2
2
  gems:
3
3
  - jekyll-redirect-from
4
+ collections:
5
+ articles:
6
+ output: true
@@ -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 = @fixtures_path.join("_site")
18
- @posts_src = File.join(@fixtures_path, "_posts")
19
- @layouts_src = File.join(@fixtures_path, "_layouts")
20
- @plugins_src = File.join(@fixtures_path, "_plugins")
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.5.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 00:00:00.000000000 Z
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