cylon 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/cylon.gemspec +17 -0
- data/lib/cylon.rb +3 -1
- data/lib/cylon/rack.rb +1 -1
- data/spec/rack_spec.rb +2 -4
- data/spec/spec_helper.rb +1 -1
- metadata +4 -3
data/cylon.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "cylon"
|
5
|
+
s.version = "0.0.2"
|
6
|
+
s.summary = "Rack middleware and Rails Engine to avoid indexing your application in staging"
|
7
|
+
s.email = "42@dmathieu.com"
|
8
|
+
s.homepage = "http://github.com/dmathieu/cylon"
|
9
|
+
s.description = "Rack middleware and Rails Engine to avoid indexing your application in staging"
|
10
|
+
s.authors = ['Damien Mathieu']
|
11
|
+
|
12
|
+
s.rubyforge_project = "cylon"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
end
|
data/lib/cylon.rb
CHANGED
data/lib/cylon/rack.rb
CHANGED
@@ -6,7 +6,7 @@ module Cylon
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def call(env)
|
9
|
-
if env["PATH_INFO"] == "/robots.txt" && RACK_ENV != "production"
|
9
|
+
if env["PATH_INFO"] == "/robots.txt" && ENV['RACK_ENV'] != "production"
|
10
10
|
[200, {"Content-Type" => "text/plain"}, ["User-Agent: *\nDisallow: /"]]
|
11
11
|
else
|
12
12
|
@app.call(env)
|
data/spec/rack_spec.rb
CHANGED
@@ -5,8 +5,7 @@ describe "Cylon Rack Middleware" do
|
|
5
5
|
let(:app) { Cylon::Rack.new(Cylon::TestingRackApp.new) }
|
6
6
|
|
7
7
|
before :each do
|
8
|
-
|
9
|
-
RACK_ENV = "test"
|
8
|
+
ENV['RACK_ENV'] = "test"
|
10
9
|
end
|
11
10
|
|
12
11
|
it "should not be indexable" do
|
@@ -26,8 +25,7 @@ describe "Cylon Rack Middleware" do
|
|
26
25
|
end
|
27
26
|
|
28
27
|
it "should be indexable if we are in production" do
|
29
|
-
|
30
|
-
RACK_ENV = "production"
|
28
|
+
ENV['RACK_ENV'] = "production"
|
31
29
|
get '/robots.txt'
|
32
30
|
last_response.should be_ok
|
33
31
|
last_response.body.should_not eql("User-Agent: *\nDisallow: /")
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Damien Mathieu
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-18 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- Gemfile
|
33
33
|
- Gemfile.lock
|
34
34
|
- Rakefile.rb
|
35
|
+
- cylon.gemspec
|
35
36
|
- lib/cylon.rb
|
36
37
|
- lib/cylon/rack.rb
|
37
38
|
- lib/cylon/rails.rb
|