JamieFlournoy-UserAgent 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/README.txt +7 -10
- data/lib/user_agent.rb +2 -3
- metadata +2 -2
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= UserAgent
|
2
2
|
|
3
|
-
http://github.com/
|
3
|
+
http://github.com/JamieFlournoy/UserAgent/
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
@@ -14,25 +14,22 @@ All you can do at this point is call UserAgent.is_spider? and pass it the user a
|
|
14
14
|
|
15
15
|
If you're using Rails, require the gem in config/environment.rb like this:
|
16
16
|
|
17
|
-
config.gem '
|
17
|
+
config.gem 'JamieFlournoy-UserAgent', :lib => 'user_agent'
|
18
18
|
|
19
|
-
|
19
|
+
And put this in your ApplicationController:
|
20
20
|
|
21
|
-
class ApplicationController < ActionController::Base
|
22
21
|
session :off, :if => proc { |request| UserAgent.is_spider?(request.user_agent) }
|
23
|
-
end
|
24
22
|
|
25
|
-
Otherwise just ask UserAgent.is_spider? and pass it the user agent string.
|
26
23
|
|
27
|
-
|
24
|
+
If you're not using Rails then just call UserAgent.is_spider? and pass it the user agent string.
|
28
25
|
|
29
|
-
|
26
|
+
== REQUIREMENTS:
|
30
27
|
|
31
|
-
|
28
|
+
Ruby 1.8.6 (or similar).
|
32
29
|
|
33
30
|
== INSTALL:
|
34
31
|
|
35
|
-
sudo gem install
|
32
|
+
sudo gem install JamieFlournoy-UserAgent
|
36
33
|
|
37
34
|
== LICENSE:
|
38
35
|
|
data/lib/user_agent.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
class UserAgent
|
2
|
-
VERSION = '1.0.
|
2
|
+
VERSION = '1.0.1'
|
3
3
|
|
4
4
|
def self.is_spider?(user_agent_string)
|
5
|
-
user_agent_string =~ /(Baidu|bot|Google|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg)/i
|
5
|
+
user_agent_string =~ /(Baidu|bot|Google|SiteUptime|Slurp|Twiceler|WordPress|ZIBB|ZyBorg)/i
|
6
6
|
end
|
7
|
-
|
8
7
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: JamieFlournoy-UserAgent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Flournoy
|
@@ -41,7 +41,7 @@ files:
|
|
41
41
|
- lib/user_agent.rb
|
42
42
|
- test/test_user_agent.rb
|
43
43
|
has_rdoc: false
|
44
|
-
homepage: http://github.com/
|
44
|
+
homepage: http://github.com/JamieFlournoy/UserAgent/
|
45
45
|
licenses:
|
46
46
|
post_install_message:
|
47
47
|
rdoc_options:
|