www-redirect 0.0.1

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 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
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .idea
6
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in dynopoker.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,10 @@
1
+ WwwRedirect
2
+ =============
3
+
4
+ Redirect to non www url, so from `www.example.com` to `example.com`
5
+
6
+ Installation
7
+ -------
8
+ gem 'www-redirect', git: 'https://github.com/kubenstein/www-redirect'
9
+
10
+ (soon I'll push the gem to rubygems)
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
@@ -0,0 +1,9 @@
1
+ module WwwRedirect
2
+
3
+ class Railtie < Rails::Railtie
4
+ initializer "www-redirect.configure_rails_initialization" do |app|
5
+ app.middleware.use 'WwwRedirect::Middleware'
6
+ end
7
+ end
8
+
9
+ end
@@ -0,0 +1,3 @@
1
+ module WwwRedirect
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,3 @@
1
+ require 'www-redirect/version'
2
+ require 'www-redirect/middleware'
3
+ require 'www-redirect/railtie'
@@ -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: []