browser 2.7.1 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/workflows/tests.yml +57 -0
- data/.gitignore +1 -0
- data/.prettierignore +1 -0
- data/.rubocop.yml +13 -1
- data/CHANGELOG.md +122 -13
- data/FUNDING.yml +3 -0
- data/README.md +134 -88
- data/Rakefile +8 -1
- data/bot_exceptions.yml +1 -0
- data/bots.yml +300 -293
- data/browser.gemspec +4 -1
- data/gemfiles/{rails5.gemfile → rails6_1.gemfile} +1 -1
- data/lib/browser/accept_language.rb +4 -4
- data/lib/browser/aliases.rb +1 -1
- data/lib/browser/alipay.rb +1 -1
- data/lib/browser/base.rb +82 -18
- data/lib/browser/blackberry.rb +1 -1
- data/lib/browser/bot/empty_user_agent_matcher.rb +11 -0
- data/lib/browser/bot/keyword_matcher.rb +11 -0
- data/lib/browser/bot/known_bots_matcher.rb +11 -0
- data/lib/browser/bot.rb +34 -26
- data/lib/browser/browser.rb +59 -56
- data/lib/browser/chrome.rb +13 -3
- data/lib/browser/device/android.rb +1 -1
- data/lib/browser/device/blackberry_playbook.rb +1 -1
- data/lib/browser/device/ipad.rb +1 -1
- data/lib/browser/device/iphone.rb +1 -1
- data/lib/browser/device/ipod_touch.rb +1 -1
- data/lib/browser/device/kindle.rb +1 -1
- data/lib/browser/device/kindle_fire.rb +1 -1
- data/lib/browser/device/playstation3.rb +1 -1
- data/lib/browser/device/playstation4.rb +1 -1
- data/lib/browser/device/psp.rb +1 -1
- data/lib/browser/device/psvita.rb +1 -1
- data/lib/browser/device/samsung.rb +33 -0
- data/lib/browser/device/surface.rb +1 -1
- data/lib/browser/device/switch.rb +1 -1
- data/lib/browser/device/tv.rb +1 -1
- data/lib/browser/device/unknown.rb +1 -1
- data/lib/browser/device/wii.rb +1 -1
- data/lib/browser/device/wiiu.rb +1 -1
- data/lib/browser/device/xbox_360.rb +1 -1
- data/lib/browser/device/xbox_one.rb +1 -1
- data/lib/browser/device.rb +37 -27
- data/lib/browser/duck_duck_go.rb +22 -0
- data/lib/browser/edge.rb +3 -3
- data/lib/browser/electron.rb +1 -1
- data/lib/browser/facebook.rb +1 -1
- data/lib/browser/firefox.rb +1 -1
- data/lib/browser/google_search_app.rb +21 -0
- data/lib/browser/huawei_browser.rb +21 -0
- data/lib/browser/instagram.rb +1 -1
- data/lib/browser/internet_explorer.rb +2 -2
- data/lib/browser/maxthon.rb +21 -0
- data/lib/browser/meta/base.rb +0 -1
- data/lib/browser/meta.rb +12 -13
- data/lib/browser/micro_messenger.rb +1 -1
- data/lib/browser/middleware/context/additions.rb +1 -1
- data/lib/browser/middleware.rb +1 -1
- data/lib/browser/miui_browser.rb +21 -0
- data/lib/browser/nokia.rb +1 -1
- data/lib/browser/opera.rb +1 -1
- data/lib/browser/otter.rb +1 -1
- data/lib/browser/phantom_js.rb +1 -1
- data/lib/browser/platform/adobe_air.rb +1 -1
- data/lib/browser/platform/android.rb +1 -1
- data/lib/browser/platform/base.rb +3 -2
- data/lib/browser/platform/blackberry.rb +1 -1
- data/lib/browser/platform/chrome_os.rb +1 -1
- data/lib/browser/platform/firefox_os.rb +1 -1
- data/lib/browser/platform/ios.rb +2 -2
- data/lib/browser/platform/kai_os.rb +23 -0
- data/lib/browser/platform/linux.rb +1 -1
- data/lib/browser/platform/mac.rb +5 -3
- data/lib/browser/platform/{other.rb → unknown.rb} +3 -3
- data/lib/browser/platform/windows.rb +2 -2
- data/lib/browser/platform/windows_mobile.rb +1 -1
- data/lib/browser/platform/windows_phone.rb +1 -1
- data/lib/browser/platform.rb +37 -28
- data/lib/browser/qq.rb +1 -1
- data/lib/browser/rails.rb +3 -3
- data/lib/browser/safari.rb +16 -1
- data/lib/browser/samsung_browser.rb +21 -0
- data/lib/browser/snapchat.rb +1 -1
- data/lib/browser/sougou_browser.rb +24 -0
- data/lib/browser/sputnik.rb +2 -5
- data/lib/browser/uc_browser.rb +1 -1
- data/lib/browser/{generic.rb → unknown.rb} +3 -3
- data/lib/browser/version.rb +1 -1
- data/lib/browser/weibo.rb +1 -1
- data/lib/browser/yandex.rb +1 -1
- data/lib/browser.rb +2 -2
- data/samsung.yml +138 -0
- data/test/browser_test.rb +37 -10
- data/test/test_helper.rb +8 -0
- data/test/ua.yml +26 -3
- data/test/ua_bots.yml +9 -2
- data/test/ua_search_engines.yml +1 -0
- data/test/unit/accept_language_test.rb +6 -0
- data/test/unit/adobe_air_test.rb +1 -1
- data/test/unit/alipay_test.rb +6 -0
- data/test/unit/blackberry_test.rb +0 -6
- data/test/unit/bots_test.rb +26 -39
- data/test/unit/chrome_test.rb +8 -3
- data/test/unit/console_test.rb +2 -2
- data/test/unit/device_test.rb +30 -3
- data/test/unit/duck_duck_go_test.rb +37 -0
- data/test/unit/edge_test.rb +34 -6
- data/test/unit/firefox_test.rb +0 -3
- data/test/unit/google_search_app_test.rb +54 -0
- data/test/unit/huawei_browser_test.rb +25 -0
- data/test/unit/internet_explorer_test.rb +0 -12
- data/test/unit/ios_test.rb +0 -5
- data/test/unit/kai_os_test.rb +31 -0
- data/test/unit/kindle_test.rb +0 -2
- data/test/unit/maxthon_test.rb +25 -0
- data/test/unit/meta_test.rb +10 -2
- data/test/unit/micro_messenger_test.rb +21 -6
- data/test/unit/miui_browser_test.rb +25 -0
- data/test/unit/opera_test.rb +1 -2
- data/test/unit/platform_test.rb +13 -8
- data/test/unit/qq_test.rb +12 -0
- data/test/unit/safari_test.rb +12 -7
- data/test/unit/samsung_browser_test.rb +23 -0
- data/test/unit/sougou_browser_test.rb +41 -0
- data/test/unit/sputnik_test.rb +1 -0
- metadata +46 -16
- data/.bundle/config +0 -2
- data/.travis.yml +0 -23
- data/lib/browser/meta/modern.rb +0 -11
- /data/gemfiles/{rails6.gemfile → rails6_0.gemfile} +0 -0
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Browser
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Tests](https://github.com/fnando/browser/workflows/Tests/badge.svg)](https://github.com/fnando/browser)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/fnando/browser/badges/gpa.svg)](https://codeclimate.com/github/fnando/browser)
|
5
|
-
[![Test Coverage](https://codeclimate.com/github/fnando/browser/badges/coverage.svg)](https://codeclimate.com/github/fnando/browser/coverage)
|
6
5
|
[![Gem](https://img.shields.io/gem/v/browser.svg)](https://rubygems.org/gems/browser)
|
7
6
|
[![Gem](https://img.shields.io/gem/dt/browser.svg)](https://rubygems.org/gems/browser)
|
8
7
|
|
@@ -25,6 +24,7 @@ browser = Browser.new("Some User Agent", accept_language: "en-us")
|
|
25
24
|
browser.bot?
|
26
25
|
browser.chrome?
|
27
26
|
browser.core_media?
|
27
|
+
browser.duck_duck_go?
|
28
28
|
browser.edge? # Newest MS browser
|
29
29
|
browser.electron? # Electron Framework
|
30
30
|
browser.firefox?
|
@@ -33,8 +33,8 @@ browser.ie?
|
|
33
33
|
browser.ie?(6) # detect specific IE version
|
34
34
|
browser.ie?([">8", "<10"]) # detect specific IE (IE9).
|
35
35
|
browser.known? # has the browser been successfully detected?
|
36
|
+
browser.unknown? # the browser wasn't detected.
|
36
37
|
browser.meta # an array with several attributes
|
37
|
-
browser.modern? # Webkit, Firefox 17+, IE 9+ and Opera 12+
|
38
38
|
browser.name # readable browser name
|
39
39
|
browser.nokia?
|
40
40
|
browser.opera?
|
@@ -43,6 +43,7 @@ browser.phantom_js?
|
|
43
43
|
browser.quicktime?
|
44
44
|
browser.safari?
|
45
45
|
browser.safari_webapp_mode?
|
46
|
+
browser.samsung_browser?
|
46
47
|
browser.to_s # the meta info joined by space
|
47
48
|
browser.uc_browser?
|
48
49
|
browser.version # major version number
|
@@ -50,20 +51,24 @@ browser.webkit?
|
|
50
51
|
browser.webkit_full_version
|
51
52
|
browser.yandex?
|
52
53
|
browser.wechat?
|
54
|
+
browser.qq?
|
53
55
|
browser.weibo?
|
54
56
|
browser.yandex?
|
55
57
|
browser.sputnik?
|
58
|
+
browser.sougou_browser?
|
56
59
|
|
57
60
|
# Get bot info
|
58
61
|
browser.bot.name
|
59
62
|
browser.bot.search_engine?
|
60
63
|
browser.bot?
|
61
|
-
|
64
|
+
browser.bot.why? # shows which matcher detected this user agent as a bot.
|
65
|
+
Browser::Bot.why?(ua)
|
62
66
|
|
63
67
|
# Get device info
|
64
68
|
browser.device
|
65
69
|
browser.device.id
|
66
70
|
browser.device.name
|
71
|
+
browser.device.unknown?
|
67
72
|
browser.device.blackberry_playbook?
|
68
73
|
browser.device.console?
|
69
74
|
browser.device.ipad?
|
@@ -84,6 +89,7 @@ browser.device.tv?
|
|
84
89
|
browser.device.vita?
|
85
90
|
browser.device.wii?
|
86
91
|
browser.device.wiiu?
|
92
|
+
browser.device.samsung?
|
87
93
|
browser.device.switch?
|
88
94
|
browser.device.xbox?
|
89
95
|
browser.device.xbox_360?
|
@@ -109,7 +115,7 @@ browser.platform.ios_app? # detect webview in an iOS app
|
|
109
115
|
browser.platform.ios_webview? # alias for ios_app?
|
110
116
|
browser.platform.linux?
|
111
117
|
browser.platform.mac?
|
112
|
-
browser.platform.
|
118
|
+
browser.platform.unknown?
|
113
119
|
browser.platform.windows10?
|
114
120
|
browser.platform.windows7?
|
115
121
|
browser.platform.windows8?
|
@@ -124,11 +130,14 @@ browser.platform.windows_wow64?
|
|
124
130
|
browser.platform.windows_x64?
|
125
131
|
browser.platform.windows_x64_inclusive?
|
126
132
|
browser.platform.windows_xp?
|
133
|
+
browser.platform.kai_os?
|
127
134
|
```
|
128
135
|
|
129
136
|
### Aliases
|
130
137
|
|
131
|
-
To add aliases like `mobile?` and `tablet?` to the base object (e.g
|
138
|
+
To add aliases like `mobile?` and `tablet?` to the base object (e.g
|
139
|
+
`browser.mobile?`), require the `browser/aliases` file and extend the
|
140
|
+
Browser::Base object like the following:
|
132
141
|
|
133
142
|
```ruby
|
134
143
|
require "browser/aliases"
|
@@ -140,27 +149,35 @@ browser.mobile? #=> false
|
|
140
149
|
|
141
150
|
### What's being detected?
|
142
151
|
|
143
|
-
- For a list of platform detections, check
|
144
|
-
|
145
|
-
- For a list of
|
152
|
+
- For a list of platform detections, check
|
153
|
+
[lib/browser/platform.rb](https://github.com/fnando/browser/blob/master/lib/browser/platform.rb)
|
154
|
+
- For a list of device detections, check
|
155
|
+
[lib/browser/device.rb](https://github.com/fnando/browser/blob/master/lib/browser/device.rb)
|
156
|
+
- For a list of bot detections, check
|
157
|
+
[bots.yml](https://github.com/fnando/browser/blob/master/bots.yml)
|
146
158
|
|
147
|
-
###
|
159
|
+
### Detecting modern browsers
|
148
160
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
* IE9+
|
153
|
-
* Microsoft Edge
|
154
|
-
* Firefox 17+
|
155
|
-
* Firefox Tablet 14+
|
156
|
-
* Opera 12+
|
157
|
-
|
158
|
-
You can define your own rules. A rule must be a proc/lambda or any object that implements the method === and accepts the browser object. To redefine all rules, clear the existing rules before adding your own.
|
161
|
+
To detect whether a browser can be considered as modern or not, create a method
|
162
|
+
that abstracts your versioning constraints. The following example will consider
|
163
|
+
any of the following browsers as a modern:
|
159
164
|
|
160
165
|
```ruby
|
161
|
-
#
|
162
|
-
Browser.
|
163
|
-
|
166
|
+
# Expects an Browser instance,
|
167
|
+
# like in `Browser.new(user_agent, accept_language: language)`.
|
168
|
+
def modern_browser?(browser)
|
169
|
+
[
|
170
|
+
browser.chrome?(">= 65"),
|
171
|
+
browser.safari?(">= 10"),
|
172
|
+
browser.firefox?(">= 52"),
|
173
|
+
browser.ie?(">= 11") && !browser.compatibility_view?,
|
174
|
+
browser.edge?(">= 15"),
|
175
|
+
browser.opera?(">= 50"),
|
176
|
+
browser.facebook?
|
177
|
+
&& browser.safari_webapp_mode?
|
178
|
+
&& browser.webkit_full_version.to_i >= 602
|
179
|
+
].any?
|
180
|
+
end
|
164
181
|
```
|
165
182
|
|
166
183
|
### Rails integration
|
@@ -171,7 +188,8 @@ Just add it to the Gemfile.
|
|
171
188
|
gem "browser"
|
172
189
|
```
|
173
190
|
|
174
|
-
This adds a helper method called `browser`, that inspects your current user
|
191
|
+
This adds a helper method called `browser`, that inspects your current user
|
192
|
+
agent.
|
175
193
|
|
176
194
|
```erb
|
177
195
|
<% if browser.ie?(6) %>
|
@@ -179,7 +197,8 @@ This adds a helper method called `browser`, that inspects your current user agen
|
|
179
197
|
<% end %>
|
180
198
|
```
|
181
199
|
|
182
|
-
If you want to use Browser on your Rails app but don't want to taint your
|
200
|
+
If you want to use Browser on your Rails app but don't want to taint your
|
201
|
+
controller, use the following line on your Gemfile:
|
183
202
|
|
184
203
|
```ruby
|
185
204
|
gem "browser", require: "browser/browser"
|
@@ -187,7 +206,8 @@ gem "browser", require: "browser/browser"
|
|
187
206
|
|
188
207
|
### Accept Language
|
189
208
|
|
190
|
-
Parses the accept-language header from an HTTP request and produces an array of
|
209
|
+
Parses the accept-language header from an HTTP request and produces an array of
|
210
|
+
language objects sorted by quality.
|
191
211
|
|
192
212
|
```ruby
|
193
213
|
browser = Browser.new("Some User Agent", accept_language: "en-us")
|
@@ -213,16 +233,22 @@ language.name
|
|
213
233
|
#=> "English/United States"
|
214
234
|
```
|
215
235
|
|
216
|
-
Result is always sorted in quality order from highest
|
236
|
+
Result is always sorted in quality order from highest to lowest. As per the HTTP
|
237
|
+
spec:
|
217
238
|
|
218
239
|
- omitting the quality value implies 1.0.
|
219
240
|
- quality value equal to zero means that is not accepted by the client.
|
220
241
|
|
221
242
|
### Internet Explorer
|
222
243
|
|
223
|
-
Internet Explorer has a compatibility view mode that allows newer versions
|
244
|
+
Internet Explorer has a compatibility view mode that allows newer versions
|
245
|
+
(IE8+) to run as an older version. Browser will always return the navigator
|
246
|
+
version, ignoring the compatibility view version, when defined. If you need to
|
247
|
+
get the engine's version, you have to use `Browser#msie_version` and
|
248
|
+
`Browser#msie_full_version`.
|
224
249
|
|
225
|
-
So, let's say an user activates compatibility view in a IE11 browser. This is
|
250
|
+
So, let's say an user activates compatibility view in a IE11 browser. This is
|
251
|
+
what you'll get:
|
226
252
|
|
227
253
|
```ruby
|
228
254
|
browser.version
|
@@ -239,16 +265,16 @@ browser.msie_full_version
|
|
239
265
|
|
240
266
|
browser.compatibility_view?
|
241
267
|
#=> true
|
242
|
-
|
243
|
-
browser.modern?
|
244
|
-
#=> false
|
245
268
|
```
|
246
269
|
|
247
|
-
This behavior changed in `v1.0.0`; previously there wasn't a way of getting the
|
270
|
+
This behavior changed in `v1.0.0`; previously there wasn't a way of getting the
|
271
|
+
real browser version.
|
248
272
|
|
249
273
|
### Safari
|
250
274
|
|
251
|
-
iOS webviews and web apps aren't detected as Safari anymore, so be aware of that
|
275
|
+
iOS webviews and web apps aren't detected as Safari anymore, so be aware of that
|
276
|
+
if that's your case. You can use a combination of platform and webkit detection
|
277
|
+
to do whatever you want.
|
252
278
|
|
253
279
|
```ruby
|
254
280
|
# iPad's Safari running as web app mode.
|
@@ -266,62 +292,78 @@ browser.platform.ios?
|
|
266
292
|
|
267
293
|
### Bots
|
268
294
|
|
269
|
-
|
295
|
+
The bot detection is quite aggressive. Anything that matches at least one of the
|
296
|
+
following requirements will be considered a bot.
|
297
|
+
|
298
|
+
- Empty user agent string
|
299
|
+
- User agent that matches `/crawl|fetch|search|monitoring|spider|bot/`
|
300
|
+
- Any known bot listed under
|
301
|
+
[bots.yml](https://github.com/fnando/browser/blob/master/bots.yml)
|
302
|
+
|
303
|
+
To add custom matchers, you can add a callable object to
|
304
|
+
`Browser::Bot.matchers`. The following example matches everything that has a
|
305
|
+
`externalhit` substring on it. The bot name will always be `General Bot`.
|
270
306
|
|
271
307
|
```ruby
|
272
|
-
Browser::Bot.
|
308
|
+
Browser::Bot.matchers << ->(ua, _browser) { ua.match?(/externalhit/i) }
|
273
309
|
```
|
274
310
|
|
275
|
-
|
311
|
+
To clear all matchers, including the ones that are bundled, use
|
312
|
+
`Browser::Bot.matchers.clear`. You can re-add built-in matchers by doing the
|
313
|
+
following:
|
276
314
|
|
277
|
-
|
315
|
+
```ruby
|
316
|
+
Browser::Bot.matchers += Browser::Bot.default_matchers
|
317
|
+
```
|
318
|
+
|
319
|
+
To restore v2's bot detection, remove the following matchers:
|
278
320
|
|
279
321
|
```ruby
|
280
|
-
|
281
|
-
|
282
|
-
end
|
322
|
+
Browser::Bot.matchers.delete(Browser::Bot::KeywordMatcher)
|
323
|
+
Browser::Bot.matchers.delete(Browser::Bot::EmptyUserAgentMatcher)
|
283
324
|
```
|
284
325
|
|
285
|
-
|
326
|
+
### Middleware
|
327
|
+
|
328
|
+
You can use the `Browser::Middleware` to redirect user agents.
|
286
329
|
|
287
330
|
```ruby
|
288
|
-
|
289
|
-
redirect_to
|
331
|
+
use Browser::Middleware do
|
332
|
+
redirect_to "/upgrade" if browser.ie?
|
290
333
|
end
|
291
334
|
```
|
292
335
|
|
293
|
-
|
336
|
+
If you're using Rails, you can use the route helper methods. Just add something
|
337
|
+
like the following to a initializer file (`config/initializers/browser.rb`).
|
294
338
|
|
295
339
|
```ruby
|
296
340
|
Rails.configuration.middleware.use Browser::Middleware do
|
297
|
-
|
298
|
-
redirect_to upgrade_path(browser: "oldie") if browser.ie? && !browser.modern?
|
299
|
-
redirect_to upgrade_path(browser: "oldfx") if browser.firefox? && !browser.modern?
|
341
|
+
redirect_to upgrade_path if browser.ie?
|
300
342
|
end
|
301
343
|
```
|
302
344
|
|
303
|
-
If you need access to the `Rack::Request` object (e.g. to exclude a path), you
|
345
|
+
If you need access to the `Rack::Request` object (e.g. to exclude a path), you
|
346
|
+
can do so with `request`.
|
304
347
|
|
305
348
|
```ruby
|
306
349
|
Rails.configuration.middleware.use Browser::Middleware do
|
307
|
-
redirect_to upgrade_path
|
350
|
+
redirect_to upgrade_path if browser.ie? && request.env["PATH_INFO"] != "/exclude_me"
|
308
351
|
end
|
309
352
|
```
|
310
353
|
|
311
|
-
###
|
312
|
-
|
313
|
-
#### Troubleshooting
|
314
|
-
|
315
|
-
##### `TypeError: no implicit conversion of Hash into String`
|
354
|
+
### Restrictions
|
316
355
|
|
317
|
-
|
356
|
+
- User agent has a size limit of 2048 bytes. This can be customized through
|
357
|
+
`Browser.user_agent_size_limit=(size)`.
|
358
|
+
- Accept-Language has a size limit of 2048 bytes. This can be customized through
|
359
|
+
`Browser.accept_language_size_limit=(size)`.
|
318
360
|
|
319
|
-
|
320
|
-
- `options`: must be a hash (for now it only accepts the `accept_language` option).
|
361
|
+
If size is not respected, then `Browser::Error` is raised.
|
321
362
|
|
322
|
-
|
323
|
-
|
324
|
-
|
363
|
+
```ruby
|
364
|
+
Browser.user_agent_size_limit = 4096
|
365
|
+
Browser.accept_language_size_limit = 4096
|
366
|
+
```
|
325
367
|
|
326
368
|
## Development
|
327
369
|
|
@@ -339,25 +381,28 @@ Once you've made your great commits (include tests, please):
|
|
339
381
|
4. Create a pull request
|
340
382
|
5. That's it!
|
341
383
|
|
342
|
-
Please respect the indentation rules and code style.
|
343
|
-
And
|
384
|
+
Please respect the indentation rules and code style. And use 2 spaces, not tabs.
|
385
|
+
And don't touch the version thing.
|
344
386
|
|
345
387
|
## Configuring environment
|
346
388
|
|
347
|
-
To configure your environment, you must have Ruby and bundler installed. Then
|
389
|
+
To configure your environment, you must have Ruby and bundler installed. Then
|
390
|
+
run `bundle install` to install all dependencies.
|
348
391
|
|
349
392
|
To run tests, execute `./bin/rake`.
|
350
393
|
|
351
394
|
### Adding new features
|
352
395
|
|
353
|
-
Before using your time to code a new feature, open a ticket asking if it makes
|
396
|
+
Before using your time to code a new feature, open a ticket asking if it makes
|
397
|
+
sense and if it's on this project's scope.
|
354
398
|
|
355
399
|
Don't forget to add a new entry to `CHANGELOG.md`.
|
356
400
|
|
357
401
|
#### Adding a new bot
|
358
402
|
|
359
403
|
1. Add the user agent to `test/ua_bots.yml`.
|
360
|
-
2. Add the readable name to `bots.yml`. The key must be something that matches
|
404
|
+
2. Add the readable name to `bots.yml`. The key must be something that matches
|
405
|
+
the user agent, in lowercased text.
|
361
406
|
3. Run tests.
|
362
407
|
|
363
408
|
Don't forget to add a new entry to `CHANGELOG.md`.
|
@@ -366,42 +411,43 @@ Don't forget to add a new entry to `CHANGELOG.md`.
|
|
366
411
|
|
367
412
|
1. Add the user agent to `test/ua_search_engines.yml`.
|
368
413
|
2. Add the same user agent to `test/ua_bots.yml`.
|
369
|
-
3. Add the readable name to `search_engines.yml`. The key must be something that
|
414
|
+
3. Add the readable name to `search_engines.yml`. The key must be something that
|
415
|
+
matches the user agent, in lowercased text.
|
370
416
|
4. Run tests.
|
371
417
|
|
372
418
|
Don't forget to add a new entry to `CHANGELOG.md`.
|
373
419
|
|
374
420
|
#### Wrong browser/platform/device detection
|
375
421
|
|
376
|
-
If you know how to fix it, follow the "Writing code" above. Open an issue
|
422
|
+
If you know how to fix it, follow the "Writing code" above. Open an issue
|
423
|
+
otherwise; make sure you fill in the issue template with all the required
|
424
|
+
information.
|
377
425
|
|
378
426
|
## Maintainer
|
379
427
|
|
380
|
-
|
428
|
+
- Nando Vieira - http://nandovieira.com
|
381
429
|
|
382
430
|
## Contributors
|
383
431
|
|
384
|
-
|
432
|
+
- https://github.com/fnando/browser/contributors
|
385
433
|
|
386
434
|
## License
|
387
435
|
|
388
436
|
(The MIT License)
|
389
437
|
|
390
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
IN
|
405
|
-
|
406
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
407
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
438
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
439
|
+
this software and associated documentation files (the 'Software'), to deal in
|
440
|
+
the Software without restriction, including without limitation the rights to
|
441
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
442
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
443
|
+
subject to the following conditions:
|
444
|
+
|
445
|
+
The above copyright notice and this permission notice shall be included in all
|
446
|
+
copies or substantial portions of the Software.
|
447
|
+
|
448
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
449
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
450
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
451
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
452
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
453
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -16,7 +16,14 @@ end
|
|
16
16
|
require "rubocop/rake_task"
|
17
17
|
desc "Run rubocop"
|
18
18
|
task :rubocop do
|
19
|
-
RuboCop::RakeTask.new
|
19
|
+
RuboCop::RakeTask.new do |t|
|
20
|
+
t.options += %w[
|
21
|
+
--display-style-guide
|
22
|
+
--display-cop-names
|
23
|
+
--extra-details
|
24
|
+
--auto-correct
|
25
|
+
]
|
26
|
+
end
|
20
27
|
end
|
21
28
|
|
22
29
|
desc "Run specs against all gemfiles"
|
data/bot_exceptions.yml
CHANGED