cypher-rack-dickbarblocker 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +10 -2
- data/Rakefile +1 -0
- data/VERSION.yml +1 -1
- data/lib/rack/contrib/dick_bar_blocker.rb +22 -9
- data/test/spec_rack_dick_bar_blocker.rb +2 -2
- metadata +12 -3
data/README.markdown
CHANGED
@@ -6,7 +6,14 @@ Hat-tip to [rue](http://github.com/rue) for suggesting the name.
|
|
6
6
|
|
7
7
|
# Usage
|
8
8
|
|
9
|
-
*
|
9
|
+
* Install it via Rubygems:
|
10
|
+
|
11
|
+
# Add http://gems.github.com to your gem sources.
|
12
|
+
# (You only need to do this once)
|
13
|
+
gem sources -a http://gems.github.com
|
14
|
+
# Install the gem
|
15
|
+
sudo gem install cypher-rack-dickbarblocker
|
16
|
+
|
10
17
|
* Add this to your rack config:
|
11
18
|
|
12
19
|
require 'rack/contrib/dick_bar_blocker'
|
@@ -18,8 +25,9 @@ Hat-tip to [rue](http://github.com/rue) for suggesting the name.
|
|
18
25
|
require 'rack/contrib/dick_bar_blocker'
|
19
26
|
|
20
27
|
Rails::Initializer.run do |config|
|
28
|
+
config.gem 'cypher-rack-dickbarblocker', :lib => 'rack/contrib/dick_bar_blocker', :source => 'http://gems.github.com'
|
21
29
|
config.middleware.use 'Rack::Contrib::DickBarBlocker'
|
22
|
-
|
30
|
+
|
23
31
|
# rest of your config
|
24
32
|
end
|
25
33
|
|
data/Rakefile
CHANGED
@@ -9,6 +9,7 @@ begin
|
|
9
9
|
gem.email = "markus.prinz@nuclearsquid.com"
|
10
10
|
gem.homepage = "http://github.com/cypher/rack-dickbarblocker"
|
11
11
|
gem.authors = ["Markus Prinz"]
|
12
|
+
gem.add_dependency('rack', '>=0.9.1')
|
12
13
|
|
13
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
15
|
end
|
data/VERSION.yml
CHANGED
@@ -10,16 +10,29 @@ module Rack
|
|
10
10
|
# Regex courtesy of John Gruber: http://daringfireball.net/2009/04/how_to_block_the_diggbar
|
11
11
|
if referrer && referrer =~ %r{http://digg.com/\w{1,8}/*(\?.*)?$}
|
12
12
|
body = <<BODY
|
13
|
-
<!DOCTYPE html>
|
13
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
14
14
|
<html lang="en">
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
<head>
|
16
|
+
<meta charset="UTF-8" />
|
17
|
+
<title>Say no to the DiggBar</title>
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<p>
|
21
|
+
Dear Digg,<br>
|
22
|
+
Framing sites is bullshit.<br>
|
23
|
+
<br>
|
24
|
+
Your pal,<br>
|
25
|
+
—J.G.
|
26
|
+
</p>
|
27
|
+
<p>
|
28
|
+
p.s. Firefox users may enjoy the<br>
|
29
|
+
<a href='http://userscripts.org/scripts/show/45795'>DiggBar Killer script for Greasemonkey</a>.
|
30
|
+
</p>
|
31
|
+
<p>
|
32
|
+
p.p.s. Digg users can disable the DiggBar under<br>
|
33
|
+
My Profile → Settings → <a href='http://digg.com/settings/viewing'>Viewing Preferences</a>.
|
34
|
+
</p>
|
35
|
+
</body>
|
23
36
|
</html>
|
24
37
|
BODY
|
25
38
|
|
@@ -21,8 +21,8 @@ context "Rack::Contrib::DickBarBlocker" do
|
|
21
21
|
|
22
22
|
status.should.equal 200
|
23
23
|
headers['Content-Type'].should.equal 'text/html'
|
24
|
-
body.should =~ %r{<title>Say no to the DiggBar</title>}
|
25
|
-
body.should =~ %r{Dear Digg
|
24
|
+
body.should =~ %r{<title>Say no to the DiggBar</title>}i
|
25
|
+
body.should =~ %r{Dear Digg,.*Framing sites is bullshit\.}mi
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cypher-rack-dickbarblocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Prinz
|
@@ -11,8 +11,17 @@ cert_chain: []
|
|
11
11
|
|
12
12
|
date: 2009-04-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.1
|
24
|
+
version:
|
16
25
|
description:
|
17
26
|
email: markus.prinz@nuclearsquid.com
|
18
27
|
executables: []
|