middleman-alias 0.0.8 → 0.0.9

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: f99840444373ee02564cfb50610f11920273b8c9
4
- data.tar.gz: a234d966d34650a0954de7e087ce590241fb9017
3
+ metadata.gz: 236f7371e308cf9f35896c443e3cd0c6563aa340
4
+ data.tar.gz: a3c64c9371d89aad09893c0ec0947650b82e3806
5
5
  SHA512:
6
- metadata.gz: 4607577262b995a32bb5dcf0d3b42a0739ffa836f590a1216cc82f1a649e43cf767399174095eaa5af3f8c53f252a1347fc189adf4f13f78d02c18a21d31265e
7
- data.tar.gz: 617bbfeceaa6756fca69158cc7bada55191eb82e842c2bca20e9324dd676d57f99dfbfcda1a5d74967cce1b0280dc6d2454388fe66f8982798a7c0c8bb541fc9
6
+ metadata.gz: e2dad175c5219dfc2f53ca0cd7a3c3099fefab2cdf1a96ea88e115f2456ab024ee79c51a36d8b3b7a14c5bf01ea8b13c595ab713bed7bc1367b4fb30f36b183a
7
+ data.tar.gz: 2a7bbd096f4a80653f383d504b3c210bd9e9125db1b8f355972ef031647a2bee7ba99b47c4061aa604056a67d4e2763568a5b76ccdb8f7ce1527bdf25c3aed64
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in middleman-alias.gemspec
4
4
  gemspec
5
+
6
+ gem 'coveralls', require: false
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
+ [![Gem Version](https://badge.fury.io/rb/middleman-alias.png)](http://badge.fury.io/rb/middleman-alias)
6
+ [![Build Status](https://travis-ci.org/Octo-Labs/middleman-alias.png?branch=master)](https://travis-ci.org/Octo-Labs/middleman-alias)
7
+ [![Code Climate](https://codeclimate.com/github/Octo-Labs/middleman-alias.png)](https://codeclimate.com/github/Octo-Labs/middleman-alias)
8
+ [![Coverage Status](https://coveralls.io/repos/Octo-Labs/middleman-alias/badge.png?branch=master)](https://coveralls.io/r/Octo-Labs/middleman-alias?branch=master)
9
+ [![Dependency Status](https://gemnasium.com/Octo-Labs/middleman-alias.png)](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 : /old-foo.html
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 : /old-foo/
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/<my-github-username>/middleman-alias/fork )
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']
@@ -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"
@@ -5,3 +5,6 @@ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
5
5
  require "middleman-core"
6
6
  require "middleman-core/step_definitions"
7
7
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-alias')
8
+
9
+ require 'coveralls'
10
+ Coveralls.wear!
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: "Multi-foo"
3
+ alias: [foo-a.html, foo-b.html]
4
+ ---
5
+
6
+ This is the multi-foo page.
@@ -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
- alias_url = resource.data["alias"]
14
- alias_url += "index.html" if alias_url.match(/\/$/)
15
- existing_resource = resources.select{|r| r.destination_path == alias_url }.first
16
- next if existing_resource
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
- resources.push Middleman::Sitemap::AliasResource.new(@app.sitemap, alias_url, resource.url)
19
- #Sitemap::Resource.new(@app.sitemap, alias_url).tap do |p|
20
- #p.proxy_to("alias.html")
21
- #p.add_metadata locals: {
22
- #destination: resource.url
23
- #}
24
- #resources.push p
25
- #end
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
@@ -1,3 +1,3 @@
1
1
  module MiddlemanAlias
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
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.8
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-04 00:00:00.000000000 Z
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.rc.1
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: