www-redirect 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/README.md +10 -0
- data/Rakefile +1 -0
- data/lib/www-redirect/middleware.rb +16 -0
- data/lib/www-redirect/railtie.rb +9 -0
- data/lib/www-redirect/version.rb +3 -0
- data/lib/www-redirect.rb +3 -0
- data/www-redirect.gemspec +19 -0
- metadata +52 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b2692a49a9eb0a553d2a01ef1c6aaff3720c6c9b
|
4
|
+
data.tar.gz: 30c39867db0fbc6acd1d251f4272e6347167de5e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2987cbcaa0a3bda311a645bcef0d160e684441faded34a73e0c9ab6889afd3bc0c2838e197483466fc0b88c8cafa73729a12671f101c5b3217dfc2ab98696c47
|
7
|
+
data.tar.gz: 163bb443721c84b9e8155d04d9a531f52538d9bb8cb0077e75ccd83923f67951ded2a65aca69cafcc682e6513ca107fb2d5db8e329b0d0b6938890b5512ef09d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WwwRedirect
|
2
|
+
class Middleware
|
3
|
+
|
4
|
+
def initialize(app)
|
5
|
+
@app = app
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
request = Rack::Request.new(env)
|
10
|
+
return [301, {"Location" => request.url.sub("//www.", "//")}, []] if request.host.starts_with?("www.")
|
11
|
+
|
12
|
+
@app.call(env)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/www-redirect.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "www-redirect/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "www-redirect"
|
7
|
+
s.version = WwwRedirect::VERSION
|
8
|
+
s.authors = ["kubenstein"]
|
9
|
+
s.email = ["niewczas.jakub@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/kubenstein/www-redirect"
|
11
|
+
s.summary = %q{Redirect to non www url of your page}
|
12
|
+
s.description = %q{Redirect to non www url of your page}
|
13
|
+
|
14
|
+
s.rubyforge_project = "www_redirect"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: www-redirect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kubenstein
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Redirect to non www url of your page
|
14
|
+
email:
|
15
|
+
- niewczas.jakub@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- .gitignore
|
21
|
+
- Gemfile
|
22
|
+
- README.md
|
23
|
+
- Rakefile
|
24
|
+
- lib/www-redirect.rb
|
25
|
+
- lib/www-redirect/middleware.rb
|
26
|
+
- lib/www-redirect/railtie.rb
|
27
|
+
- lib/www-redirect/version.rb
|
28
|
+
- www-redirect.gemspec
|
29
|
+
homepage: https://github.com/kubenstein/www-redirect
|
30
|
+
licenses: []
|
31
|
+
metadata: {}
|
32
|
+
post_install_message:
|
33
|
+
rdoc_options: []
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
requirements: []
|
47
|
+
rubyforge_project: www_redirect
|
48
|
+
rubygems_version: 2.1.11
|
49
|
+
signing_key:
|
50
|
+
specification_version: 4
|
51
|
+
summary: Redirect to non www url of your page
|
52
|
+
test_files: []
|