browserino 2.13.0 → 2.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -683
- data/browserino.gemspec +1 -1
- data/lib/browserino/version.rb +1 -1
- metadata +3 -9
- data/CHANGELOG.md +0 -206
- data/index.html +0 -719
- data/params.json +0 -6
- data/stylesheets/github-light.css +0 -124
- data/stylesheets/normalize.css +0 -424
- data/stylesheets/stylesheet.css +0 -245
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7199d14c4ac2db60bbc6ba1be03789ea29567cb
|
4
|
+
data.tar.gz: 5b028cf38dbc8d9ea29f68ba5ef60cafced8c931
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b23a6c4211ab6e8875e72e9fdf908a71b442ccee3a77cb846c76e8fb3729bdf3110bc359422a8537da628e0e44544e3c529bc5919325a4715dd8d4c6236a2cfe
|
7
|
+
data.tar.gz: c7b454d7eb0d602b634a6cddd73cccc4df9950cf3a62343b674939fc2da2caf31153c5bde1774ae3eb9f036be7f8f7f5b957ffdb488d72a248be1c4596ad52e9
|
data/README.md
CHANGED
@@ -1,684 +1,3 @@
|
|
1
|
-
#
|
1
|
+
# Readme
|
2
2
|
|
3
|
-
|
4
|
-
The sniffer can currently identify 22 bots (of which 6 social media and 5 search engines), 17 browsers, 11 operating systems, 6 programming language UA's and 4 consoles.
|
5
|
-
|
6
|
-
# DEPRECATION WARNING: Ruby < 2
|
7
|
-
|
8
|
-
Browserino will be dropping support for Ruby versions less than 2 with the release of version `3`
|
9
|
-
The planned release date for version `3` is on new years day (Jan 01, 2017).
|
10
|
-
|
11
|
-
This breaking update will also remove the deprecated (and no longer used) second value that can be passed to `Browserino.new` which allowed you to return a custom value instead of the default `nil` if a property isn't set.
|
12
|
-
**Rails** users can simply upgrade their version as long as they use Ruby `>= 2` or above since the custom return value was never used during initialization.
|
13
|
-
|
14
|
-
## Status
|
15
|
-
|
16
|
-
[![Gem Version](https://badge.fury.io/rb/browserino.svg)](http://badge.fury.io/rb/browserino)
|
17
|
-
[![Build Status](https://travis-ci.org/SidOfc/browserino.svg?branch=master)](https://travis-ci.org/SidOfc/browserino)
|
18
|
-
[![Coverage Status](https://coveralls.io/repos/SidOfc/browserino/badge.svg?branch=master&service=github)](https://coveralls.io/github/SidOfc/browserino?branch=master)
|
19
|
-
|
20
|
-
---
|
21
|
-
|
22
|
-
Useragent references:
|
23
|
-
|
24
|
-
* http://useragentstring.com/
|
25
|
-
* http://www.zytrax.com/tech/web/mobile_ids.html
|
26
|
-
* http://www.user-agents.org/
|
27
|
-
|
28
|
-
## Changelog
|
29
|
-
|
30
|
-
_dates are in dd-mm-yyyy format_
|
31
|
-
_older changes can be found in the [CHANGELOG.md](CHANGELOG.md)_
|
32
|
-
|
33
|
-
#### 09-12-2016 VERSION 2.13.0
|
34
|
-
|
35
|
-
- Added support for Colibri
|
36
|
-
- Added `colibri?` method
|
37
|
-
- Added support for `:colibri` (`Symbol` and `String`) in methods
|
38
|
-
- Added `agent.internet_explorer?` method as alias for `agent.ie?`
|
39
|
-
- Added support for `:internet_explorer` (`Symbol` and `String`) in methods
|
40
|
-
- Test aliasses if they exist for a certain browser (used to be tested by hand)
|
41
|
-
- Test aliasses if they exist for a certain user (used to be tested by hand)
|
42
|
-
- Add a roadmap
|
43
|
-
|
44
|
-
#### 14-11-2016 VERSION 2.12.0
|
45
|
-
|
46
|
-
- Added support for SamsungBrowser
|
47
|
-
- Added `samsungbrowser?` method
|
48
|
-
- Added support for `:samsungbrowser` (`Symbol` and `String`) in methods
|
49
|
-
- Added support for Tizen
|
50
|
-
- Added `tizen?` method
|
51
|
-
- Added support for `:tizen` (`Symbol` and `String`) in methods
|
52
|
-
- Added support for WebOS
|
53
|
-
- Added `webos?` method
|
54
|
-
- Added support for `:webos` (`Symbol` and `String`) in methods
|
55
|
-
- Added support for WebOSBrowser
|
56
|
-
- Added `webosbrowser?` method
|
57
|
-
- Added support for `:webosbrowser` (`Symbol` and `String`) in methods
|
58
|
-
- Added Android Nougat (7.0 and 7.1) detection
|
59
|
-
- merged OS map files into _/core/mappings.rb_ and removed the _lib/maps_ folder
|
60
|
-
- Reduced amount of (overkill) tests
|
61
|
-
|
62
|
-
#### 13-11-2016 VERSION 2.11.0
|
63
|
-
|
64
|
-
- Add `:macos` alias for `:macintosh` systems.
|
65
|
-
- Added support for MacOS `:sierra` alias in methods.
|
66
|
-
- Added deprecation notice for dropping support of Ruby < 2.0.0
|
67
|
-
|
68
|
-
## Installation
|
69
|
-
|
70
|
-
Add the following to your applications Gemfile:
|
71
|
-
|
72
|
-
```ruby
|
73
|
-
gem 'browserino'
|
74
|
-
```
|
75
|
-
|
76
|
-
And then execute:
|
77
|
-
|
78
|
-
```
|
79
|
-
$ bundle
|
80
|
-
```
|
81
|
-
|
82
|
-
Or install it yourself with:
|
83
|
-
|
84
|
-
```
|
85
|
-
$ gem install browserino
|
86
|
-
```
|
87
|
-
|
88
|
-
Browserino is tested with the following ruby versions
|
89
|
-
|
90
|
-
* 1.9.3 - **SUPPORT WILL BE DROPPED IN THE NEXT MAJOR VERSION RELEASE**
|
91
|
-
* 2.0.0
|
92
|
-
* 2.1.0
|
93
|
-
* 2.2.1
|
94
|
-
* 2.3.0
|
95
|
-
* 2.3.1
|
96
|
-
|
97
|
-
## Usage
|
98
|
-
|
99
|
-
After installing the gem globally or in your application you'll have to `require` the gem before being able to use it.
|
100
|
-
|
101
|
-
```ruby
|
102
|
-
require 'browserino'
|
103
|
-
```
|
104
|
-
Afterwards, the gem is loaded and you can proceed by calling:
|
105
|
-
|
106
|
-
```ruby
|
107
|
-
Browserino.parse '<user agent>'
|
108
|
-
```
|
109
|
-
|
110
|
-
Browserino is also usable in the command line
|
111
|
-
|
112
|
-
```
|
113
|
-
~$ browserino parse <ua>
|
114
|
-
```
|
115
|
-
|
116
|
-
Output
|
117
|
-
```
|
118
|
-
name: chrome, browser_version: 50.0.2661.102, engine_name: webkit, engine_version: 537.36, system_name: macintosh, system_architecture: nil
|
119
|
-
```
|
120
|
-
|
121
|
-
### Rails (>= 3.2.0)
|
122
|
-
|
123
|
-
If you're using Rails (>= 3.2.0) you'll have access to an `agent` object. Browserino will initialize itself using the `request.headers['User-Agent']`
|
124
|
-
|
125
|
-
|
126
|
-
A quick example on how to get going:
|
127
|
-
```ruby
|
128
|
-
class ApplicationController < ActionController::Base
|
129
|
-
def some_method
|
130
|
-
render json: agent
|
131
|
-
end
|
132
|
-
end
|
133
|
-
```
|
134
|
-
|
135
|
-
### General
|
136
|
-
|
137
|
-
the `parse` method will **always** return a `Browserino::Agent` object.
|
138
|
-
|
139
|
-
```ruby
|
140
|
-
Browserino.parse '<user agent>' # => #<Browserino::Agent:0x007f9b09b1fae8 ... >
|
141
|
-
```
|
142
|
-
|
143
|
-
### Default return values
|
144
|
-
|
145
|
-
If a property isn't available or not known to Browserino it's return value will always be `nil`, this can be tested by supplying an empty string (`''`) to `parse`:
|
146
|
-
|
147
|
-
```ruby
|
148
|
-
agent = Browserino.parse ''
|
149
|
-
agent.name
|
150
|
-
# => nil
|
151
|
-
```
|
152
|
-
|
153
|
-
If a value *is* found then you'll recieve a *lowercase string* containing the information:
|
154
|
-
|
155
|
-
```ruby
|
156
|
-
agent = Browserino.parse 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) brave/0.7.7 Chrome/47.0.2526.73 Electron/0.36.2 Safari/537.36'
|
157
|
-
|
158
|
-
agent.name
|
159
|
-
# => 'brave'
|
160
|
-
|
161
|
-
# or using browser_name
|
162
|
-
|
163
|
-
agent.browser_name
|
164
|
-
# => 'brave'
|
165
|
-
|
166
|
-
agent.browser_version
|
167
|
-
# => '0.7.7'
|
168
|
-
|
169
|
-
agent.engine_name
|
170
|
-
# => 'webkit'
|
171
|
-
```
|
172
|
-
|
173
|
-
Browserino also has some question methods, these will always return either `true` or `false`. The exceptions to this rule are methods that can take a name, for instance the `bot?` method:
|
174
|
-
|
175
|
-
```ruby
|
176
|
-
agent = Browserino.parse ''
|
177
|
-
agent.bot?
|
178
|
-
# => true (empty UA's count as anonymous bots)
|
179
|
-
|
180
|
-
agent.googlebot?
|
181
|
-
# => false
|
182
|
-
|
183
|
-
agent.non_supported_bot?
|
184
|
-
# => NoMethodError
|
185
|
-
|
186
|
-
agent.bot? :non_supported_bot
|
187
|
-
# => NoMethodError
|
188
|
-
```
|
189
|
-
|
190
|
-
### Functions
|
191
|
-
|
192
|
-
The samples below are all valid calls with their respective outputs, using the `agent` defined below.
|
193
|
-
|
194
|
-
```ruby
|
195
|
-
agent = Browserino.parse 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko'
|
196
|
-
```
|
197
|
-
|
198
|
-
#### Note
|
199
|
-
|
200
|
-
The methods `social_media_name`, `search_engine_name`, `bot_name` and `browser_name`
|
201
|
-
are *all* aliasses of the general `name` method.
|
202
|
-
|
203
|
-
The exceptions to this rule are `system_name` and `console_name`. They each have their own method.
|
204
|
-
|
205
|
-
##### Quick usage
|
206
|
-
|
207
|
-
```ruby
|
208
|
-
agent.name
|
209
|
-
# => 'ie'
|
210
|
-
|
211
|
-
# always returns real version, also when IE is in compat
|
212
|
-
agent.browser_version
|
213
|
-
# => '11.0'
|
214
|
-
|
215
|
-
# to get the compat version that IE is running in
|
216
|
-
# returns real version if not in compat mode
|
217
|
-
agent.browser_version compat: true
|
218
|
-
# => '11.0'
|
219
|
-
|
220
|
-
agent.library_name
|
221
|
-
# => nil
|
222
|
-
|
223
|
-
agent.library_version
|
224
|
-
# => nil
|
225
|
-
|
226
|
-
agent.engine_name
|
227
|
-
# => 'trident'
|
228
|
-
|
229
|
-
agent.engine_version
|
230
|
-
# => '7.0'
|
231
|
-
|
232
|
-
agent.system_name
|
233
|
-
# => 'windows'
|
234
|
-
|
235
|
-
# system_name attempts to find the operating systems version name
|
236
|
-
# when full: true is used
|
237
|
-
# returning an array with either the version name or nil if not found
|
238
|
-
agent.system_name full: true
|
239
|
-
# => ['windows', '7']
|
240
|
-
|
241
|
-
agent.system_version
|
242
|
-
# => '6.1'
|
243
|
-
|
244
|
-
agent.system_architecture
|
245
|
-
# => 'x64'
|
246
|
-
|
247
|
-
agent.console_name
|
248
|
-
# => nil
|
249
|
-
|
250
|
-
# two formats possible: 'aa' or `aa-bb`
|
251
|
-
agent.locale
|
252
|
-
# => 'as'
|
253
|
-
```
|
254
|
-
|
255
|
-
##### Question methods
|
256
|
-
|
257
|
-
Browserino also provides some question methods.
|
258
|
-
|
259
|
-
```ruby
|
260
|
-
# only for Internet Explorer
|
261
|
-
agent.compat?
|
262
|
-
# => false
|
263
|
-
|
264
|
-
# returns true if name is present
|
265
|
-
agent.known?
|
266
|
-
# => true
|
267
|
-
|
268
|
-
# returns true if browser is known
|
269
|
-
agent.browser?
|
270
|
-
# => true
|
271
|
-
|
272
|
-
# returns true if specific browser
|
273
|
-
agent.browser? :ie
|
274
|
-
# => true
|
275
|
-
|
276
|
-
# returns true if specific browser and version
|
277
|
-
agent.browser? :ie, version: '11.0'
|
278
|
-
|
279
|
-
# returns true if library is known
|
280
|
-
agent.library?
|
281
|
-
|
282
|
-
# returns true if specific library
|
283
|
-
agent.library? :php
|
284
|
-
|
285
|
-
# returns true if specific library and version
|
286
|
-
agent.library? :php, version: '5.9.0'
|
287
|
-
|
288
|
-
# returns true if there is a social media bot on your website
|
289
|
-
agent.social_media?
|
290
|
-
# => false
|
291
|
-
|
292
|
-
# returns true if platform is known
|
293
|
-
agent.platform?
|
294
|
-
# => true
|
295
|
-
|
296
|
-
# returns true if specific platform
|
297
|
-
agent.platform? :windows
|
298
|
-
# => true
|
299
|
-
|
300
|
-
# returns true if specific platform and version
|
301
|
-
agent.platform? :windows, version: '7'
|
302
|
-
# => true
|
303
|
-
|
304
|
-
# returns true if console is known
|
305
|
-
agent.console?
|
306
|
-
# => false
|
307
|
-
|
308
|
-
# returns true if specific console
|
309
|
-
agent.console? :xbox
|
310
|
-
# => false
|
311
|
-
|
312
|
-
# returns true if user agent is empty or a bot is recognized
|
313
|
-
agent.bot?
|
314
|
-
# => false
|
315
|
-
|
316
|
-
agent.x64?
|
317
|
-
# => true
|
318
|
-
|
319
|
-
agent.x32?
|
320
|
-
# => false
|
321
|
-
|
322
|
-
agent.mobile?
|
323
|
-
# => false
|
324
|
-
```
|
325
|
-
|
326
|
-
The above methods are the base questions you can ask but there are a lot more methods you can call on the `agent`. Every supported browser, operating system or bot is basically a question method so you could do this:
|
327
|
-
|
328
|
-
```ruby
|
329
|
-
agent.windows?
|
330
|
-
# => true
|
331
|
-
|
332
|
-
# based on full name
|
333
|
-
agent.windows? '7'
|
334
|
-
# => true
|
335
|
-
|
336
|
-
# NT versions also work
|
337
|
-
agent.windows? 6.1
|
338
|
-
# => true
|
339
|
-
```
|
340
|
-
|
341
|
-
##### Transformation
|
342
|
-
|
343
|
-
Browserino implements `to_a`, `to_h` and `to_s` to allow for collected data to be moved around without attaching the entire object with methods.
|
344
|
-
|
345
|
-
**to_s**
|
346
|
-
|
347
|
-
Returns a compiled string of properties based on available information.
|
348
|
-
|
349
|
-
```ruby
|
350
|
-
agent.to_s
|
351
|
-
# => 'ie ie11 trident trident7 windows x64'
|
352
|
-
|
353
|
-
# a seperator can be passed to format the name + version combo's
|
354
|
-
agent.to_s '-'
|
355
|
-
# => 'ie ie-11 trident trident-7 windows x64'
|
356
|
-
```
|
357
|
-
|
358
|
-
If the agent object can't find a property in the user agent, that property will be excluded from the string.
|
359
|
-
For instance, if the `browser_version` and `engine_version` of the `agent` object are `nil` then the following will be returned:
|
360
|
-
|
361
|
-
```ruby
|
362
|
-
agent.to_s
|
363
|
-
# => ie trident windows x64
|
364
|
-
```
|
365
|
-
|
366
|
-
**to_a**
|
367
|
-
|
368
|
-
Returns an array with key => value pairs.
|
369
|
-
|
370
|
-
```ruby
|
371
|
-
agent.to_a
|
372
|
-
# => [[:name, "ie"],
|
373
|
-
# [:browser_version, "11.0"],
|
374
|
-
# [:engine_name, "trident"],
|
375
|
-
# [:engine_version, "7.0"],
|
376
|
-
# [:system_name, "windows"],
|
377
|
-
# [:system_version, "6.1"],
|
378
|
-
# [:system_architecture, "x64"],
|
379
|
-
# [:console_name, nil],
|
380
|
-
# [:locale, "as"]]
|
381
|
-
```
|
382
|
-
|
383
|
-
**to_h**
|
384
|
-
|
385
|
-
Returns a hash with key => value pairs.
|
386
|
-
|
387
|
-
```ruby
|
388
|
-
agent.to_h
|
389
|
-
# => {:name=>"ie",
|
390
|
-
# :browser_version=>"11.0",
|
391
|
-
# :engine_name=>"trident",
|
392
|
-
# :engine_version=>"7.0",
|
393
|
-
# :system_name=>"windows",
|
394
|
-
# :system_version=>"6.1",
|
395
|
-
# :system_architecture=>"x64",
|
396
|
-
# :console_name => nil,
|
397
|
-
# :locale=>"as"}
|
398
|
-
```
|
399
|
-
|
400
|
-
##### Supplying versions
|
401
|
-
|
402
|
-
Consider this parsed string:
|
403
|
-
|
404
|
-
```ruby
|
405
|
-
agent = Browserino.parse 'Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; SM-T210R Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30 UCBrowser/2.3.2.300'
|
406
|
-
|
407
|
-
# output for system_name
|
408
|
-
agent.system_name
|
409
|
-
# => 'android'
|
410
|
-
|
411
|
-
# output for system_name full: true
|
412
|
-
agent.system_name full: true
|
413
|
-
# => ['android', 'Jelly Bean 16']
|
414
|
-
```
|
415
|
-
|
416
|
-
When supplying a version to a method that supports it, you have multiple options for the format of that version.
|
417
|
-
|
418
|
-
* Using a symbol or string without version: `:jelly_bean` or `'jelly_bean'`
|
419
|
-
* Using a symbol or string with version: `:jelly_bean_16` or `'jelly_bean_16'`
|
420
|
-
* Using a string: `'4.1.2'`
|
421
|
-
* Using a float: `4.1`
|
422
|
-
* Using an int: `4`
|
423
|
-
|
424
|
-
When calling the `platform?` or `android?` functions with the above examples, they would all match since the method that compares versions also checks how specific the version is that you want to compare against.
|
425
|
-
|
426
|
-
If you pass in `4.1` as a version the matcher will look for `x.x` in the extracted version and discard the unspecified value, this allows for you to be explicitly less specific to allow for a greater range of systems to be matched.
|
427
|
-
|
428
|
-
* `4.1.2` will match `4.1.2`
|
429
|
-
* `4.1` will match `4.1.x`
|
430
|
-
* `4` will match `4.x.x`
|
431
|
-
|
432
|
-
**Examples using `platform?`**
|
433
|
-
|
434
|
-
```ruby
|
435
|
-
agent.platform? :android, version: '4.1.2'
|
436
|
-
# => true
|
437
|
-
|
438
|
-
agent.platform? :android, version: 4.1
|
439
|
-
# => true
|
440
|
-
|
441
|
-
agent.platform? :android, version: 4
|
442
|
-
# => true
|
443
|
-
|
444
|
-
agent.platform? :android, version: :jelly_bean
|
445
|
-
# => true
|
446
|
-
|
447
|
-
agent.platform? :android, version: :jelly_bean_16
|
448
|
-
# => true
|
449
|
-
```
|
450
|
-
|
451
|
-
##### `platform?`, `browser?`, `bot?`, `console?`, `search_engine?`, `library` and `social_media?` methods
|
452
|
-
|
453
|
-
As you've seen above, the `platform?` function can take two arguments, a symbol with the system name and optionally a hash with a `:version` key to supply a version, the `browser?` and `library?` method works in exactly the same way.
|
454
|
-
|
455
|
-
The `bot?` and `social_media?` methods however aren't that complex since you don't need to know a bot / social media version or anything other than it's name so inside these methods, only a name can be passed:
|
456
|
-
|
457
|
-
*Every social media match is automatically a bot, but a bot isn't automatically social media, __This is also true for the `search_engine?` method__*
|
458
|
-
|
459
|
-
```ruby
|
460
|
-
# when a bot UA gets parsed
|
461
|
-
agent = Browserino.parse 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
|
462
|
-
|
463
|
-
agent.bot?
|
464
|
-
# => true
|
465
|
-
|
466
|
-
agent.social_media?
|
467
|
-
# => true
|
468
|
-
|
469
|
-
agent.bot? :facebook
|
470
|
-
# => true
|
471
|
-
|
472
|
-
agent.social_media? :facebook
|
473
|
-
# => true
|
474
|
-
|
475
|
-
agent.bot? :facebook, version: 1.1
|
476
|
-
# => ArgumentError
|
477
|
-
```
|
478
|
-
|
479
|
-
##### Checking a specific browser, system, bot, library or social media
|
480
|
-
|
481
|
-
Every name you see in the below lists can be passed as symbol or string to their respective method
|
482
|
-
|
483
|
-
**search engine**
|
484
|
-
* `google`
|
485
|
-
* `bing`
|
486
|
-
* `yahoo_slurp`
|
487
|
-
* `baiduspider`
|
488
|
-
* `duckduckgo` or `ddg`
|
489
|
-
|
490
|
-
Examples:
|
491
|
-
|
492
|
-
```ruby
|
493
|
-
agent.google?
|
494
|
-
agent.baiduspider?
|
495
|
-
|
496
|
-
# using the search_engine? method
|
497
|
-
agent.search_engine? :google
|
498
|
-
|
499
|
-
# using shorthand
|
500
|
-
agent.search_engine? :ddg
|
501
|
-
```
|
502
|
-
|
503
|
-
**consoles**
|
504
|
-
|
505
|
-
* `xbox`
|
506
|
-
* `nintendo_ds`
|
507
|
-
* `wii`
|
508
|
-
* `playstation`
|
509
|
-
|
510
|
-
Examples:
|
511
|
-
|
512
|
-
```ruby
|
513
|
-
agent.playstation?
|
514
|
-
agent.wii?
|
515
|
-
|
516
|
-
agent.console?
|
517
|
-
|
518
|
-
agent.console? :facebook
|
519
|
-
```
|
520
|
-
|
521
|
-
**social media**
|
522
|
-
|
523
|
-
* `facebook` or `fb`
|
524
|
-
* `twitter`
|
525
|
-
* `linkedin`
|
526
|
-
* `instagram`
|
527
|
-
* `pinterest`
|
528
|
-
* `tumblr`
|
529
|
-
|
530
|
-
Examples:
|
531
|
-
|
532
|
-
```ruby
|
533
|
-
agent.facebook?
|
534
|
-
agent.tumblr?
|
535
|
-
|
536
|
-
# using the social_media? method
|
537
|
-
agent.social_media? :facebook
|
538
|
-
|
539
|
-
# using shorthand
|
540
|
-
agent.social_media? :fb
|
541
|
-
|
542
|
-
agent.social_media? :tumblr
|
543
|
-
```
|
544
|
-
|
545
|
-
**bot**
|
546
|
-
|
547
|
-
* `google`
|
548
|
-
* `msn`
|
549
|
-
* `bing`
|
550
|
-
* `yahoo_slurp`
|
551
|
-
* `baiduspider`
|
552
|
-
* `yandex`
|
553
|
-
* `sosospider`
|
554
|
-
* `exa`
|
555
|
-
* `sogou_spider`
|
556
|
-
|
557
|
-
Examples:
|
558
|
-
|
559
|
-
```ruby
|
560
|
-
agent.google?
|
561
|
-
agent.exa?
|
562
|
-
|
563
|
-
# using the bot? method
|
564
|
-
agent.bot? :google
|
565
|
-
agent.bot? :exa
|
566
|
-
```
|
567
|
-
|
568
|
-
**library**
|
569
|
-
|
570
|
-
* `php`
|
571
|
-
* `perl`
|
572
|
-
* `curl`
|
573
|
-
* `python`
|
574
|
-
* `java`
|
575
|
-
* `pycurl`
|
576
|
-
|
577
|
-
Examples:
|
578
|
-
|
579
|
-
```ruby
|
580
|
-
agent.php?
|
581
|
-
agent.pycurl?
|
582
|
-
|
583
|
-
agent.library?
|
584
|
-
|
585
|
-
agent.library? :curl
|
586
|
-
|
587
|
-
agent.library? :curl, version: 7.21
|
588
|
-
```
|
589
|
-
|
590
|
-
**browser**
|
591
|
-
|
592
|
-
* `chrome`
|
593
|
-
* `firefox` or `ff`
|
594
|
-
* `servo`
|
595
|
-
* `seamonkey`
|
596
|
-
* `opera`
|
597
|
-
* `opera_mini`
|
598
|
-
* `vivaldi`
|
599
|
-
* `ucbrowser`
|
600
|
-
* `maxthon`
|
601
|
-
* `bolt`
|
602
|
-
* `brave`
|
603
|
-
* `safari`
|
604
|
-
* `ie`
|
605
|
-
* `edge`
|
606
|
-
* `samsungbrowser`
|
607
|
-
* `webosbrowser`
|
608
|
-
* `colibri`
|
609
|
-
|
610
|
-
Examples:
|
611
|
-
|
612
|
-
```ruby
|
613
|
-
agent.firefox?
|
614
|
-
agent.chrome? 42
|
615
|
-
|
616
|
-
# using the browser? method
|
617
|
-
agent.browser? :firefox
|
618
|
-
|
619
|
-
# using shorthand
|
620
|
-
agent.browser? :ff
|
621
|
-
|
622
|
-
agent.browser? :chrome, version: 42
|
623
|
-
```
|
624
|
-
|
625
|
-
**operating system**
|
626
|
-
|
627
|
-
* `windows` or `win`
|
628
|
-
* `macintosh` or `osx`
|
629
|
-
* `linux`
|
630
|
-
* `bsd`
|
631
|
-
* `solaris`
|
632
|
-
* `android`
|
633
|
-
* `ios`
|
634
|
-
* `blackberry` or `bb`
|
635
|
-
* `windows_phone`
|
636
|
-
* `tizen`
|
637
|
-
* `webos`
|
638
|
-
|
639
|
-
Examples:
|
640
|
-
|
641
|
-
```ruby
|
642
|
-
agent.macintosh?
|
643
|
-
agent.windows_phone? 7
|
644
|
-
|
645
|
-
# to check for windows vista one could do
|
646
|
-
agent.windows? 6
|
647
|
-
|
648
|
-
# a more readable equivelant
|
649
|
-
agent.windows? :vista
|
650
|
-
|
651
|
-
# using the platform? method
|
652
|
-
agent.platform? :macintosh
|
653
|
-
|
654
|
-
# using shorthand
|
655
|
-
agent.platform? :osx
|
656
|
-
|
657
|
-
agent.platform? :windows_phone, version: 7
|
658
|
-
```
|
659
|
-
|
660
|
-
Notes:
|
661
|
-
|
662
|
-
* `linux?` doesn't support any versions
|
663
|
-
* `bsd?` doesn't support any versions
|
664
|
-
* `solaris?` only supports numeric versions
|
665
|
-
* *named versions* are only supported if they are present in a [map](https://github.com/SidOfc/browserino/tree/master/lib/browserino/core/mapping.rb)
|
666
|
-
|
667
|
-
## Roadmap
|
668
|
-
|
669
|
-
Browserino will always be a work in progress, I will do my best to maintain and update the gem regularly as I have so far, below are some points of interest on what could / should be improved, rewritten or removed.
|
670
|
-
There is no steady schedule for these changes however these are the changes I deemed most important, the value in them being here is that you, as a developer using Browserino have the possibility to see what might be added, changed or removed in the near(est) future of change.
|
671
|
-
|
672
|
-
* Drop ruby `< 2` support and remove custom return value from constructor
|
673
|
-
* Refactor test suite entirely to improve readability and structure of tests.
|
674
|
-
* Add more bot identification
|
675
|
-
* Rewrite aliassing and UA lie detection
|
676
|
-
|
677
|
-
## Contributing
|
678
|
-
|
679
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/SidOfc/browserino. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
680
|
-
|
681
|
-
|
682
|
-
## License
|
683
|
-
|
684
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
3
|
+
The documentation has been moved here: [https://sidofc.github.io/projects/browserino/](https://sidofc.github.io/projects/browserino/)
|
data/browserino.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["sidneyliebrand@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{A browser identification gem with command line and Rails (>= 3.2.0) integration}
|
13
|
-
spec.homepage = "
|
13
|
+
spec.homepage = "https://sidofc.github.io/projects/browserino/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
data/lib/browserino/version.rb
CHANGED