middleman-alias 0.0.8 → 0.0.9
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/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/README.md +18 -3
- data/Rakefile +12 -0
- data/features/alias.feature +6 -0
- data/features/support/env.rb +3 -0
- data/fixtures/alias-app/source/multi-foo.html.erb +6 -0
- data/lib/middleman-alias/extension.rb +14 -12
- data/lib/middleman-alias/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 236f7371e308cf9f35896c443e3cd0c6563aa340
|
4
|
+
data.tar.gz: a3c64c9371d89aad09893c0ec0947650b82e3806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2dad175c5219dfc2f53ca0cd7a3c3099fefab2cdf1a96ea88e115f2456ab024ee79c51a36d8b3b7a14c5bf01ea8b13c595ab713bed7bc1367b4fb30f36b183a
|
7
|
+
data.tar.gz: 2a7bbd096f4a80653f383d504b3c210bd9e9125db1b8f355972ef031647a2bee7ba99b47c4061aa604056a67d4e2763568a5b76ccdb8f7ce1527bdf25c3aed64
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
Add alias/redirect information to your middleman pages and posts.
|
4
4
|
|
5
|
+
[](http://badge.fury.io/rb/middleman-alias)
|
6
|
+
[](https://travis-ci.org/Octo-Labs/middleman-alias)
|
7
|
+
[](https://codeclimate.com/github/Octo-Labs/middleman-alias)
|
8
|
+
[](https://coveralls.io/r/Octo-Labs/middleman-alias?branch=master)
|
9
|
+
[](https://gemnasium.com/Octo-Labs/middleman-alias)
|
10
|
+
|
11
|
+
|
5
12
|
## Installation
|
6
13
|
|
7
14
|
Add this line to your application's Gemfile:
|
@@ -37,7 +44,7 @@ to the old address.
|
|
37
44
|
|
38
45
|
```
|
39
46
|
title : "A post about foo"
|
40
|
-
alias :
|
47
|
+
alias : old-foo.html
|
41
48
|
```
|
42
49
|
|
43
50
|
Now someone can visit your middleman site at `/old-foo.html` and they'll
|
@@ -48,15 +55,23 @@ directory.
|
|
48
55
|
|
49
56
|
```
|
50
57
|
title : "A post about foo"
|
51
|
-
alias :
|
58
|
+
alias : old-foo/
|
52
59
|
```
|
53
60
|
|
54
61
|
The example above will result in a redirect file being generated at
|
55
62
|
`/old-foo/index.html`, which will be accessible to browsers at `/old-foo/`.
|
56
63
|
|
64
|
+
```
|
65
|
+
title : "A post about foo"
|
66
|
+
alias : ["old-foo/", "older-foo/"]
|
67
|
+
```
|
68
|
+
|
69
|
+
Passing an array will allow you to redirect multiple old pages (or
|
70
|
+
directories) to your new page.
|
71
|
+
|
57
72
|
## Contributing
|
58
73
|
|
59
|
-
1. Fork it ( http://github.com
|
74
|
+
1. Fork it ( http://github.com/Octo-Labs/middleman-alias/fork )
|
60
75
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
76
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
77
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
@@ -1 +1,13 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
desc "Run tests for travis"
|
4
|
+
task :travis do
|
5
|
+
["cucumber"].each do |cmd|
|
6
|
+
puts "Starting to run #{cmd}..."
|
7
|
+
system("export DISPLAY=:99.0 && bundle exec #{cmd}")
|
8
|
+
raise "#{cmd} failed!" unless $?.exitstatus == 0
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
desc 'Default: run tests.'
|
13
|
+
task :default => ['travis']
|
data/features/alias.feature
CHANGED
@@ -10,3 +10,9 @@ Feature: Aliases
|
|
10
10
|
Then I should not see "You are being redirected"
|
11
11
|
Then I should see "This is a page about double foo."
|
12
12
|
|
13
|
+
Scenario: Aliases should generate multiple redirect pages
|
14
|
+
Given the Server is running at "alias-app"
|
15
|
+
When I go to "/foo-a.html"
|
16
|
+
Then I should see "You are being redirected"
|
17
|
+
When I go to "/foo-b.html"
|
18
|
+
Then I should see "You are being redirected"
|
data/features/support/env.rb
CHANGED
@@ -10,19 +10,21 @@ module Middleman
|
|
10
10
|
def manipulate_resource_list(resources)
|
11
11
|
resources.each do |resource|
|
12
12
|
if resource.data["alias"]
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
Array(resource.data["alias"]).each do |mm_alias|
|
14
|
+
alias_url = mm_alias
|
15
|
+
alias_url += "index.html" if alias_url.match(/\/$/)
|
16
|
+
existing_resource = resources.select{|r| r.destination_path == alias_url }.first
|
17
|
+
next if existing_resource
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
resources.push Middleman::Sitemap::AliasResource.new(@app.sitemap, alias_url, resource.url)
|
20
|
+
#Sitemap::Resource.new(@app.sitemap, alias_url).tap do |p|
|
21
|
+
#p.proxy_to("alias.html")
|
22
|
+
#p.add_metadata locals: {
|
23
|
+
#destination: resource.url
|
24
|
+
#}
|
25
|
+
#resources.push p
|
26
|
+
#end
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
resources
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-alias
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Green
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -88,6 +88,7 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
91
92
|
- Gemfile
|
92
93
|
- LICENSE.txt
|
93
94
|
- README.md
|
@@ -99,6 +100,7 @@ files:
|
|
99
100
|
- fixtures/alias-app/source/bar.html.erb
|
100
101
|
- fixtures/alias-app/source/double-foo.html.erb
|
101
102
|
- fixtures/alias-app/source/layout.html.erb
|
103
|
+
- fixtures/alias-app/source/multi-foo.html.erb
|
102
104
|
- fixtures/alias-app/source/virtual.html.erb
|
103
105
|
- fixtures/empty-alias-app/config.rb
|
104
106
|
- fixtures/empty-alias-app/source/.gitkeep
|
@@ -128,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
130
|
version: '0'
|
129
131
|
requirements: []
|
130
132
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.2.0
|
133
|
+
rubygems_version: 2.2.0
|
132
134
|
signing_key:
|
133
135
|
specification_version: 4
|
134
136
|
summary: Redirects for Middleman that are friendly to the Googles.
|
@@ -136,3 +138,4 @@ test_files:
|
|
136
138
|
- features/alias.feature
|
137
139
|
- features/support/env.rb
|
138
140
|
- features/virtual-directory.feature
|
141
|
+
has_rdoc:
|