You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removed
-------
* `rack` as dependency
* Unused `config.ru`
Changed
-------
* Default path for cache is now in `./tmp` directory instead of `./config`
Added
-----
* Support of Rails 6
Development
-----------
* [EditorConfig](https://editorconfig.org/) added
* [RuboCop](https://github.com/rubocop-hq/rubocop) added and offenses fixed
* RuboCop task added for Travis CI
* Drop support for Ruby <= 2.2 (they even will not get security patches)
* Ignore built gems for git
Copy file name to clipboardExpand all lines: README.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,29 +15,32 @@ Configuration
15
15
16
16
A JSON file is used to match [user agent strings](http://simplyfast.info/browser) to a list of known bots.
17
17
18
-
If you'd like to use an [updated list](https://github.com/monperrus/crawler-user-agents) or make your own customizations, run `rake voight_kampff:import_user_agents`. This will download a `crawler-user-agents.json` file into the `./config` directory.
18
+
If you'd like to use an [updated list](https://github.com/monperrus/crawler-user-agents) or make your own customizations, run `rake voight_kampff:import_user_agents`. This will download a `crawler-user-agents.json` file into the `./tmp` directory.
19
19
20
20
__Note:__ The pattern entries in the JSON file are evaluated as [regular expressions](http://en.wikipedia.org/wiki/Regular_expression).
21
21
22
22
Usage
23
23
-----
24
24
There are three ways to use Voight-Kampff
25
25
26
-
1. Through Rack::Request such as in your [Ruby on Rails](http://rubyonrails.org) controllers:
27
-
`request.bot?`
26
+
1. Through `Rack::Request` in your app such as [Ruby on Rails](http://rubyonrails.org):
27
+
```ruby
28
+
request.bot?
29
+
```
28
30
29
-
2. Through the `VoightKampff` module:
31
+
2. Through the `VoightKampff` module:
30
32
`VoightKampff.bot? 'your user agent string'`
31
33
32
-
3. Through a `VoightKampff::Test` instance:
34
+
3. Through a `VoightKampff::Test` instance:
33
35
`VoightKampff::Test.new('your user agent string').bot?`
34
36
35
-
All of the above examples accept `human?` and `bot?` methods. All of these methods will return `true` or `false`.
37
+
All of the above examples accept `human?` and `bot?` methods.
38
+
All of these methods will return `true` or `false`.
36
39
37
40
Upgrading to version 1.0
38
41
------------------------
39
42
40
-
Version 1.0 uses a new source for a list of bot user agent strings since the old source was no longer maintained. This new source, unfortuately, does not include as much detail. Therefore the following methods have been deprecated:
43
+
Version 1.0 uses a new source for a list of bot user agent strings since the old source was no longer maintained. This new source, unfortunately, does not include as much detail. Therefore the following methods have been deprecated:
41
44
-`#browser?`
42
45
-`#checker?`
43
46
-`#downloader?`
@@ -51,10 +54,10 @@ Also, the gem no longer extends `ActionDispatch::Request` instead it extends `Ra
51
54
52
55
FAQ
53
56
---
54
-
__Q:____What's with the name?__
57
+
__Q:____What's with the name?__
55
58
__A:__ It's the [machine in Blade Runner](https://en.wikipedia.org/wiki/Blade_Runner#Voight-Kampff_machine) that is used to test whether someone is a human or a replicant.
56
59
57
-
__Q:____I've found a bot that isn't being matched__
60
+
__Q:____I've found a bot that isn't being matched__
58
61
__A:__ The list is being pulled from [github.com/monperrus/crawler-user-agents](https://github.com/monperrus/crawler-user-agents).
59
62
If you'd like to have entries added to the list, please create a pull request with that project. Once that pull request is merged, feel free to create an issue here and I'll release a new gem version with the updated list. In the meantime you can always run `rake voight_kampff:import_user_agents` on your project to get that updated list.
60
63
@@ -67,7 +70,7 @@ Thanks to [github.com/monperrus/crawler-user-agents](https://github.com/monperru
67
70
68
71
Contributing
69
72
------------
70
-
PR without tests will not get merged, Make sure you write tests for api and rails app.
73
+
PR without tests will not get merged, Make sure you write tests for API and Rails app.
71
74
Feel free to ask for help, if you do not know how to write a determined test.
0 commit comments