rack-turing-test 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/README.md +9 -0
- data/Rakefile +1 -0
- data/lib/rack-turing-test.rb +27 -0
- data/lib/rack-turing-test/version.rb +5 -0
- data/rack-turing-test.gemspec +24 -0
- metadata +72 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rack-turing-test/version"
|
2
|
+
|
3
|
+
module Rack
|
4
|
+
module TuringTest
|
5
|
+
PATTERN = Regexp.union(
|
6
|
+
/googlebot/i,
|
7
|
+
/mediapartners-google/i,
|
8
|
+
/slurp/i,
|
9
|
+
/ask.com/i,
|
10
|
+
/crawler/i,
|
11
|
+
/nutch/i,
|
12
|
+
/msnbot/i,
|
13
|
+
/bingbot/i,
|
14
|
+
/baidu/i,
|
15
|
+
/yetibot/i,
|
16
|
+
/teoma/i,
|
17
|
+
).freeze
|
18
|
+
|
19
|
+
def bot?
|
20
|
+
!!user_agent.match(PATTERN)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Request
|
25
|
+
include TuringTest
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rack-turing-test/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rack-turing-test"
|
7
|
+
s.version = Rack::TuringTest::VERSION
|
8
|
+
s.authors = ["Genki Takiuchi"]
|
9
|
+
s.email = ["genki@s21g.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Bot detector for Rack::Request}
|
12
|
+
s.description = %q{You can test if sender of request has intelligence.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "rack-turing-test"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-turing-test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Genki Takiuchi
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-12-24 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: You can test if sender of request has intelligence.
|
22
|
+
email:
|
23
|
+
- genki@s21g.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- .gitignore
|
32
|
+
- Gemfile
|
33
|
+
- README.md
|
34
|
+
- Rakefile
|
35
|
+
- lib/rack-turing-test.rb
|
36
|
+
- lib/rack-turing-test/version.rb
|
37
|
+
- rack-turing-test.gemspec
|
38
|
+
homepage: ""
|
39
|
+
licenses: []
|
40
|
+
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
hash: 3
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
version: "0"
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
requirements: []
|
65
|
+
|
66
|
+
rubyforge_project: rack-turing-test
|
67
|
+
rubygems_version: 1.8.6
|
68
|
+
signing_key:
|
69
|
+
specification_version: 3
|
70
|
+
summary: Bot detector for Rack::Request
|
71
|
+
test_files: []
|
72
|
+
|