browserino 2.4.1.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77b6b295f92200f6249f408dba494a0421b176ca
4
- data.tar.gz: 2959b955792fbdacdee617cc2837fcef98a8737d
3
+ metadata.gz: 2154862ebf93207956b1180fb504e6fc3cb2efd7
4
+ data.tar.gz: 3260046c27e73c1ea236f1af819290b6777f85e4
5
5
  SHA512:
6
- metadata.gz: c79f999a64ccabe72150f1a790db60da0ed2b97e68b3203f662a72ca311478faead63e36f4a9f0e5e888fb30f4c20ca8828d681d1ca50b7da4a65d6fbd67bacd
7
- data.tar.gz: 523dd68aa5e405e98f3a2fd5723a58557bd7e13218c3f14a0833c8ac6af700ba31fbdec64d42a1e152a64abd198a986718f5f824663bea3e2c85bddd2af5c604
6
+ metadata.gz: 84e21cba9010e33635e6d58cda913519248e495bd230f9d8347a800c5b55aff6d15ddde3ca383ebef8ce9409b86f3297ea617e586806b9780eeefabb4d961c3c
7
+ data.tar.gz: 766ca8f0f6ec8d4e55a7c272b34c245d7f6b868f1c9c7042c531418b935ed20a087993d0495e245fe41d3e6b99d641efa84f36a1ebe8d8e9951c0c029407d398
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  ## CHANGELOG
2
2
  _dates are in dd-mm-yyyy format_
3
3
 
4
+ #### 06-01-2016 VERSION 2.3.0
5
+
6
+ - Added `#compat?` method to test if IE is in compatibility mode
7
+ - Extended `#browser_version` to now also take an argument
8
+ - Added `#locale` method
9
+ - Empty UA's are identified as bots through `#bot?`
10
+
4
11
  #### 04-01-2016 VERSION 2.2.0
5
12
 
6
13
  - Added more bots
data/README.md CHANGED
@@ -10,7 +10,15 @@ This gem aims to provide information about the browser that your visitor is usin
10
10
  _dates are in dd-mm-yyyy format_
11
11
  _older changes can be found in the [CHANGELOG.md](https://github.com/SidOfc/browserino/blob/master/CHANGELOG.md)_
12
12
 
13
- #### 11-01-2016 VERSION 2.4.1
13
+ #### 12-01-2016 VERSION 2.5.0
14
+
15
+ - Added support for the Vivaldi browser
16
+ - New method `#vivaldi?`
17
+ - Added support for the bsd family of operating systems
18
+ - New method `#bsd?`
19
+ - Fixed using symbols for system version identification (e.g. `:vista` or `:el_capitan`) without a version number
20
+
21
+ #### 11-01-2016 VERSION 2.4.1(.1)
14
22
 
15
23
  - Caching the agent object in Rails
16
24
  - **DEPRECATE** Using a custom return value for when a property isn't found
@@ -19,13 +27,6 @@ _older changes can be found in the [CHANGELOG.md](https://github.com/SidOfc/brow
19
27
 
20
28
  - Added rails integration
21
29
 
22
- #### 06-01-2016 VERSION 2.3.0
23
-
24
- - Added `#compat?` method to test if IE is in compatibility mode
25
- - Extended `#browser_version` to now also take an argument
26
- - Added `#locale` method
27
- - Empty UA's are identified as bots through `#bot?`
28
-
29
30
  ## Installation
30
31
 
31
32
  *supports ruby 1.9.3+*
@@ -220,7 +221,9 @@ agent.macintosh?
220
221
 
221
222
  agent.blackberry?
222
223
 
223
- agent.linux?
224
+ agent.linux? # linux doesn't have versions
225
+
226
+ agent.bsd? # bsd also doesn't have versions
224
227
  ```
225
228
 
226
229
  You could also invert these questions by using the `.not` method
@@ -254,6 +257,8 @@ agent.not.macintosh?
254
257
  agent.not.blackberry?
255
258
 
256
259
  agent.not.linux?
260
+
261
+ agent.not.bsd?
257
262
  ```
258
263
 
259
264
  The `#windows?`, `#macintosh?` and `#blackberry?` each have a shortcut method to allow for easier access, `#win?`, `#osx?`, `#bb?`
@@ -261,6 +266,8 @@ The `#windows?`, `#macintosh?` and `#blackberry?` each have a shortcut method to
261
266
  ##### Supported browsers
262
267
 
263
268
  ```ruby
269
+ agent.vivaldi?
270
+
264
271
  agent.opera?
265
272
 
266
273
  agent.opera_mini?
@@ -284,6 +291,7 @@ agent.seamonkey?
284
291
  agent.safari?
285
292
 
286
293
  # or with the .not method (>= 1.4.0)
294
+ agent.not.vivaldi?
287
295
 
288
296
  agent.not.opera?
289
297
 
@@ -361,10 +369,14 @@ Valid browser names are defined by __/lib/browserino/patterns.rb__ (the keys are
361
369
  ```ruby
362
370
  'ie'
363
371
 
372
+ `edge`
373
+
364
374
  'firefox'
365
375
 
366
376
  'chrome'
367
377
 
378
+ `vivaldi`
379
+
368
380
  'opera'
369
381
 
370
382
  'opera_mini'
@@ -428,7 +440,9 @@ Valid browser names are defined by __/lib/browserino/patterns.rb__ (the keys are
428
440
 
429
441
  'ios'
430
442
 
431
- 'linux' # => doesn't have versions
443
+ 'linux'
444
+
445
+ `bsd`
432
446
  ```
433
447
 
434
448
  #### system_architecture examples
data/bin/console CHANGED
@@ -3,7 +3,7 @@
3
3
  require "bundler/setup"
4
4
  require "browserino"
5
5
  require "pry"
6
- ua = 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.450 Mobile Safari/534.8+'
6
+ ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 Vivaldi/1.0.344.37'
7
7
  @agent = Browserino::parse(ua)
8
8
 
9
9
  puts "> @agent variable available parsed with: '#{ua}'\n\n"
@@ -5,7 +5,7 @@ module Browserino
5
5
  @unknown = unknown
6
6
  @not = false
7
7
 
8
- cleansed_ua = Browserino::cleanse @ua
8
+ cleansed_ua = Browserino::strip_lies @ua
9
9
  name = Browserino::agent_id cleansed_ua
10
10
  info = {
11
11
  browser_name: name,
@@ -197,8 +197,7 @@ module Browserino
197
197
  def correct_system?(name, version = nil)
198
198
  sys_name = name.to_s.downcase.gsub(/\s/, '_')
199
199
  sys_name_compare = system_name(full: true).join.downcase.gsub(/\s/, '_')
200
- name_variations = [sys_name_compare, sys_name_compare.gsub(/^[\s_]+|\d|[\s_]+$/, '')]
201
-
200
+ name_variations = [sys_name_compare, sys_name_compare.gsub(/^[\s_]+|[\d\.\s_]+$/, '')]
202
201
  if (name_variations.include?((sys_name + version.to_s).gsub(/\s/, '_').downcase) ||
203
202
  (sys_name == system_name.gsub(/\s/, '_') && compare_versions(version, system_version)) ||
204
203
  (!version && sys_name == system_name.gsub(/\s/, '_')))
@@ -14,7 +14,7 @@ module Browserino
14
14
  system_version: {},
15
15
  system_architecture: {
16
16
  'x64' => ['64', 'x86_64', 'amd64', 'wow64'],
17
- 'x32' => ['32', 'i686', 'i383', 'x86_32']
17
+ 'x32' => ['32', 'i686', 'i383', 'i386', 'x86_32']
18
18
  },
19
19
  bot_name: {},
20
20
  locale: {}
@@ -3,8 +3,24 @@ module Browserino
3
3
  BLACKBERRY = {
4
4
  '9900' => [9900],
5
5
  '9860' => [9860],
6
+ '9810' => [9810],
6
7
  '9800' => [9800],
7
- '9700' => [9700]
8
+ '9790' => [9790],
9
+ '9780' => [9780],
10
+ '9700' => [9700],
11
+ '9650' => [9650],
12
+ '9380' => [9380],
13
+ '9360' => [9360],
14
+ '9320' => [9320],
15
+ '9300' => [9300],
16
+ '9220' => [9220],
17
+ '9000' => [9000],
18
+ '8900' => [8900],
19
+ '8800' => [8800],
20
+ '8530' => [8530],
21
+ '8520' => [8520],
22
+ '8320' => [8320],
23
+ '8300' => [8300]
8
24
  }
9
25
  end
10
26
  end
@@ -0,0 +1,5 @@
1
+ module Browserino
2
+ module Mapping
3
+ BSD = {}
4
+ end
5
+ end
@@ -1,6 +1,11 @@
1
1
  module Browserino
2
2
  PATTERNS = {
3
3
  browser: {
4
+ vivaldi: {
5
+ name: /(?<name>vivaldi)/i,
6
+ version: /vivaldi\/(?<version>[\d\.]+)/i
7
+ },
8
+
4
9
  ucbrowser: {
5
10
  name: /(?<name>ucbrowser)/i,
6
11
  version: /ucbrowser\/?(?<version>[\d\.]+)/i
@@ -79,7 +84,7 @@ module Browserino
79
84
  },
80
85
 
81
86
  operating_system: {
82
- name: /(?<name>windows|macintosh|android|ios|blackberry|linux|ubuntu|x11)/i,
87
+ name: /(?<name>windows|macintosh|android|ios|blackberry|linux|ubuntu|x11|bsd)/i,
83
88
  version: /(?:nt|mac\sos\sx|android|(cpu\s|i)os|blackberry)\s?(?<version>[\d\._]+)/i,
84
89
  architecture: /(?<architecture>((?:x|x86_|amd|wow)64)|i(3|6)86)/i,
85
90
  mobile: /bolt|nokia|samsung|mobi(?:le)?|android|ip(?:[ao]d|hone)|bb\d+|blackberry|iemobile|fennec|bada|meego|vodafone|t\-mobile|opera\sm(?:ob|in)i/i,
@@ -1,3 +1,3 @@
1
1
  module Browserino
2
- VERSION = "2.4.1.1"
2
+ VERSION = "2.5.0"
3
3
  end
data/lib/browserino.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "browserino/maps/macintosh"
2
2
  require "browserino/maps/blackberry"
3
3
  require "browserino/maps/ios"
4
+ require "browserino/maps/bsd"
4
5
  require "browserino/maps/linux"
5
6
  require "browserino/maps/android"
6
7
  require "browserino/maps/windows"
@@ -31,7 +32,7 @@ module Browserino
31
32
 
32
33
  private
33
34
 
34
- def self.cleanse(ua)
35
+ def self.strip_lies(ua)
35
36
  #make iphone / ipad / ipod consistent
36
37
  ua = ua.gsub(/ip((a|o)d|hone)/i, 'ios')
37
38
  ua = ua.gsub(/(Mozilla\/[\d\.]+)/i, '')
@@ -39,6 +40,7 @@ module Browserino
39
40
  ua = ua.gsub(/(?:apple)?webkit\/[\d\.]+/i, '') if /presto/i =~ ua
40
41
  ua = ua.gsub(/(?:ms)?ie/i, '') if /rv\:/i =~ ua
41
42
  ua = ua.gsub(/linux/i, '') if /android/i =~ ua
43
+ ua = ua.gsub(/x11/i, '') if /bsd/i =~ ua
42
44
  ua
43
45
  end
44
46
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browserino
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidney Liebrand
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,6 +138,7 @@ files:
138
138
  - lib/browserino/integrate/rails.rb
139
139
  - lib/browserino/maps/android.rb
140
140
  - lib/browserino/maps/blackberry.rb
141
+ - lib/browserino/maps/bsd.rb
141
142
  - lib/browserino/maps/ios.rb
142
143
  - lib/browserino/maps/linux.rb
143
144
  - lib/browserino/maps/macintosh.rb