cylon 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -6,6 +6,8 @@ module Cylon
6
6
 
7
7
  end
8
8
 
9
- if defined?(Rails::Engine)
9
+ begin
10
10
  require 'cylon/rails'
11
+ rescue NameError
12
+ # Rails::Engine is not defined. This is not a rails engine.
11
13
  end
@@ -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)
@@ -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
- Object.send(:remove_const, :RACK_ENV)
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
- Object.send(:remove_const, :RACK_ENV)
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: /")
@@ -1,4 +1,4 @@
1
- RACK_ENV = "test"
1
+ ENV['RACK_ENV'] = "test"
2
2
 
3
3
  require 'rspec'
4
4
  require 'rack/test'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
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-15 00:00:00 +01:00
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