rack-noindex 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODkzMTVlYzVlYzZhOTY1MDY4NDFmMGEwNTc3ZjYyN2E2NTI1YjRlYw==
5
+ data.tar.gz: !binary |-
6
+ NWRkODg2YzI3MmNmZDJlZWZmYmE5NTdhM2U1YTk5NDhlODE2NjQxOA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ NzgzZWU2NjE3NDk4OTRlYjNhN2NhNDNiYzczMjI4OGFlN2Y3YTFkYWRkNjZk
10
+ NDdkMzI5ZjU0MmJkOTU0NmRiODg0N2ExMzgyYjM4M2MwMjNkODMwMWY5M2Nj
11
+ NzgyNDllNTBhNjI2NTE3Y2FkNTMxYzhiNGY0MzZjMDdhY2RjY2U=
12
+ data.tar.gz: !binary |-
13
+ MmI1YzM3MTQ3YjExYzE2ZjM0Y2QxMDc0ODY5ZWY0ODQyOTU3MGU3OGIxMjEy
14
+ NDU0MThmMmRjZjYxMzI5NTc3MmFjNGI0OGQ3N2RmNGRkMTVhOGQ0ZTQ4MWRi
15
+ MDIwYjQxMTNmZWM0MTg0ODg0MTEyYTJiZGZkZDQ5ZTcyODI1NDg=
@@ -0,0 +1 @@
1
+ require 'rack/noindex'
@@ -0,0 +1,16 @@
1
+ require 'rack/noindex/version'
2
+ require 'rack'
3
+
4
+ module Rack
5
+ module Noindex
6
+ autoload :Base, 'rack/noindex/base'
7
+
8
+ def self.new(app, condition = nil)
9
+ Rack::Builder.new do
10
+ use ::Rack::Noindex::Base, condition
11
+ run app
12
+ end.to_app
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ require 'rack/noindex'
2
+
3
+ module Rack
4
+ module Noindex
5
+ class Base
6
+ def initialize(app, condition)
7
+ if condition.nil?
8
+ condition = lambda { |env| env['SERVER_NAME'] =~ /\.herokuapp\.com$/ }
9
+ end
10
+ @app = app
11
+ @condition = condition
12
+ end
13
+
14
+ def call(env)
15
+ status, headers, response = @app.call(env)
16
+ headers['X-Robots-Tag'] = 'noindex' if @condition.call(env)
17
+ [status, headers, response]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module Rack
2
+ module Noindex
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-noindex
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jean-Philippe Doyle
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-05-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack-test
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: contest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: ! 'Add a X-Robots-Tag: noindex header on a given condition.'
70
+ email:
71
+ - jeanphilippe.doyle@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - lib/rack-noindex.rb
77
+ - lib/rack/noindex.rb
78
+ - lib/rack/noindex/base.rb
79
+ - lib/rack/noindex/version.rb
80
+ homepage: https://github.com/j15e/rack-noindex
81
+ licenses: []
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project: ! '[none]'
99
+ rubygems_version: 2.0.3
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Rack middleware to add noindex on a given condition.
103
+ test_files: []