bunto-redirect-from 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +18 -18
- data/.rspec +2 -2
- data/.travis.yml +26 -26
- data/Gemfile +8 -8
- data/History.markdown +4 -3
- data/LICENSE.txt +22 -22
- data/README.md +129 -128
- data/Rakefile +6 -6
- data/bunto-redirect-from.gemspec +27 -27
- data/lib/bunto-redirect-from.rb +11 -4
- data/lib/bunto-redirect-from/redirect_page.rb +42 -34
- data/lib/bunto-redirect-from/redirector.rb +90 -86
- data/lib/bunto-redirect-from/version.rb +3 -3
- data/script/bootstrap +3 -3
- data/script/cibuild +4 -4
- data/script/release +3 -3
- data/script/test +2 -0
- data/spec/bunto_redirect_from/redirect_page_spec.rb +76 -72
- data/spec/bunto_redirect_from/redirector_spec.rb +149 -116
- data/spec/fixtures/_articles/redirect-me-plz.md +6 -6
- data/spec/fixtures/_articles/redirect-somewhere-else-im-a-permalink.html +7 -0
- data/spec/fixtures/_articles/redirect-somewhere-else-plz.html +6 -6
- data/spec/fixtures/_authors/kansaichris.md +5 -5
- data/spec/fixtures/_config.yml +7 -7
- data/spec/fixtures/_layouts/layout.html +6 -0
- data/spec/fixtures/_posts/2014-01-03-redirect-me-plz.md +6 -6
- data/spec/fixtures/multiple_redirect_tos.md +9 -9
- data/spec/fixtures/multiple_redirect_urls.md +10 -10
- data/spec/fixtures/one_redirect_to.md +6 -6
- data/spec/fixtures/one_redirect_url.md +6 -6
- data/spec/fixtures/tags/how we work.md +4 -0
- data/spec/integrations_spec.rb +13 -13
- data/spec/spec_helper.rb +88 -91
- metadata +18 -11
data/spec/spec_helper.rb
CHANGED
@@ -1,91 +1,88 @@
|
|
1
|
-
require "bunto"
|
2
|
-
require File.expand_path("lib/bunto-redirect-from.rb")
|
3
|
-
|
4
|
-
RSpec.configure do |config|
|
5
|
-
config.run_all_when_everything_filtered = true
|
6
|
-
config.filter_run :focus
|
7
|
-
config.order = 'random'
|
8
|
-
|
9
|
-
config.expect_with :rspec do |c|
|
10
|
-
c.syntax = :expect
|
11
|
-
end
|
12
|
-
|
13
|
-
config.before(:each) do
|
14
|
-
Bunto.logger.log_level = :error
|
15
|
-
|
16
|
-
@fixtures_path = Pathname.new(__FILE__).parent.join("fixtures")
|
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
|
-
|
22
|
-
@site = Bunto::Site.new(Bunto.configuration({
|
23
|
-
"source" => @fixtures_path.to_s,
|
24
|
-
"destination" => @dest.to_s,
|
25
|
-
"plugins" => @plugins_src.to_s,
|
26
|
-
"collections" => {
|
27
|
-
"articles" => {"output" => true},
|
28
|
-
"authors" => {}
|
29
|
-
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
@
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def
|
45
|
-
@
|
46
|
-
end
|
47
|
-
|
48
|
-
def
|
49
|
-
@site.collections["
|
50
|
-
end
|
51
|
-
|
52
|
-
def
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
def
|
57
|
-
Bunto::
|
58
|
-
end
|
59
|
-
|
60
|
-
def
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
@val
|
90
|
-
end
|
91
|
-
end
|
1
|
+
require "bunto"
|
2
|
+
require File.expand_path("lib/bunto-redirect-from.rb")
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.run_all_when_everything_filtered = true
|
6
|
+
config.filter_run :focus
|
7
|
+
config.order = 'random'
|
8
|
+
|
9
|
+
config.expect_with :rspec do |c|
|
10
|
+
c.syntax = :expect
|
11
|
+
end
|
12
|
+
|
13
|
+
config.before(:each) do
|
14
|
+
Bunto.logger.log_level = :error
|
15
|
+
|
16
|
+
@fixtures_path = Pathname.new(__FILE__).parent.join("fixtures")
|
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
|
+
|
22
|
+
@site = Bunto::Site.new(Bunto.configuration({
|
23
|
+
"source" => @fixtures_path.to_s,
|
24
|
+
"destination" => @dest.to_s,
|
25
|
+
"plugins" => @plugins_src.to_s,
|
26
|
+
"collections" => {
|
27
|
+
"articles" => {"output" => true},
|
28
|
+
"authors" => {}
|
29
|
+
},
|
30
|
+
"defaults" => [{
|
31
|
+
"scope" => { "path" => "" },
|
32
|
+
"values" => { "layout" => "layout" }
|
33
|
+
}]
|
34
|
+
}))
|
35
|
+
|
36
|
+
@dest.rmtree if @dest.exist?
|
37
|
+
@site.process
|
38
|
+
end
|
39
|
+
|
40
|
+
config.after(:each) do
|
41
|
+
@dest.rmtree if @dest.exist?
|
42
|
+
end
|
43
|
+
|
44
|
+
def dest_dir(*paths)
|
45
|
+
@dest.join(*paths)
|
46
|
+
end
|
47
|
+
|
48
|
+
def unpublished_doc
|
49
|
+
@site.collections["authors"].docs.first
|
50
|
+
end
|
51
|
+
|
52
|
+
def setup_doc(doc_filename)
|
53
|
+
@site.collections["articles"].docs.find { |d| d.relative_path.match(doc_filename) }
|
54
|
+
end
|
55
|
+
|
56
|
+
def setup_post(file)
|
57
|
+
Bunto::Post.new(@site, @fixtures_path.to_s, '', file)
|
58
|
+
end
|
59
|
+
|
60
|
+
def setup_page(file)
|
61
|
+
Bunto::Page.new(@site, @fixtures_path.to_s, File.dirname(file), File.basename(file))
|
62
|
+
end
|
63
|
+
|
64
|
+
def new_redirect_page(permalink)
|
65
|
+
page = BuntoRedirectFrom::RedirectPage.new(@site, @site.source, "", "index.html")
|
66
|
+
page.data['permalink'] = permalink
|
67
|
+
page.data['sitemap'] = false
|
68
|
+
page
|
69
|
+
end
|
70
|
+
|
71
|
+
def destination_sitemap
|
72
|
+
@dest.join("sitemap.xml").read
|
73
|
+
end
|
74
|
+
|
75
|
+
def forced_output_ext
|
76
|
+
BuntoRedirectFrom.bunto_3? ? ".html" : ""
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class TestStringContainer
|
81
|
+
def initialize(strValue)
|
82
|
+
@val = strValue
|
83
|
+
end
|
84
|
+
|
85
|
+
def to_s
|
86
|
+
@val
|
87
|
+
end
|
88
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunto-redirect-from
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bunto
|
@@ -29,16 +29,16 @@ dependencies:
|
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,16 +71,16 @@ dependencies:
|
|
71
71
|
name: bunto-sitemap
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - ">="
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '0'
|
84
84
|
description: Seamlessly specify multiple redirection URLs for your pages and posts
|
85
85
|
email:
|
86
86
|
- parkrmoore@gmail.com
|
@@ -105,17 +105,21 @@ files:
|
|
105
105
|
- script/bootstrap
|
106
106
|
- script/cibuild
|
107
107
|
- script/release
|
108
|
+
- script/test
|
108
109
|
- spec/bunto_redirect_from/redirect_page_spec.rb
|
109
110
|
- spec/bunto_redirect_from/redirector_spec.rb
|
110
111
|
- spec/fixtures/_articles/redirect-me-plz.md
|
112
|
+
- spec/fixtures/_articles/redirect-somewhere-else-im-a-permalink.html
|
111
113
|
- spec/fixtures/_articles/redirect-somewhere-else-plz.html
|
112
114
|
- spec/fixtures/_authors/kansaichris.md
|
113
115
|
- spec/fixtures/_config.yml
|
116
|
+
- spec/fixtures/_layouts/layout.html
|
114
117
|
- spec/fixtures/_posts/2014-01-03-redirect-me-plz.md
|
115
118
|
- spec/fixtures/multiple_redirect_tos.md
|
116
119
|
- spec/fixtures/multiple_redirect_urls.md
|
117
120
|
- spec/fixtures/one_redirect_to.md
|
118
121
|
- spec/fixtures/one_redirect_url.md
|
122
|
+
- spec/fixtures/tags/how we work.md
|
119
123
|
- spec/integrations_spec.rb
|
120
124
|
- spec/spec_helper.rb
|
121
125
|
homepage: https://github.com/bunto/bunto-redirect-from
|
@@ -138,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
142
|
version: '0'
|
139
143
|
requirements: []
|
140
144
|
rubyforge_project:
|
141
|
-
rubygems_version: 2.
|
145
|
+
rubygems_version: 2.6.6
|
142
146
|
signing_key:
|
143
147
|
specification_version: 4
|
144
148
|
summary: Seamlessly specify multiple redirection URLs for your pages and posts
|
@@ -146,13 +150,16 @@ test_files:
|
|
146
150
|
- spec/bunto_redirect_from/redirect_page_spec.rb
|
147
151
|
- spec/bunto_redirect_from/redirector_spec.rb
|
148
152
|
- spec/fixtures/_articles/redirect-me-plz.md
|
153
|
+
- spec/fixtures/_articles/redirect-somewhere-else-im-a-permalink.html
|
149
154
|
- spec/fixtures/_articles/redirect-somewhere-else-plz.html
|
150
155
|
- spec/fixtures/_authors/kansaichris.md
|
151
156
|
- spec/fixtures/_config.yml
|
157
|
+
- spec/fixtures/_layouts/layout.html
|
152
158
|
- spec/fixtures/_posts/2014-01-03-redirect-me-plz.md
|
153
159
|
- spec/fixtures/multiple_redirect_tos.md
|
154
160
|
- spec/fixtures/multiple_redirect_urls.md
|
155
161
|
- spec/fixtures/one_redirect_to.md
|
156
162
|
- spec/fixtures/one_redirect_url.md
|
163
|
+
- spec/fixtures/tags/how we work.md
|
157
164
|
- spec/integrations_spec.rb
|
158
165
|
- spec/spec_helper.rb
|