browser 0.7.2 → 0.8.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 +4 -4
- data/CONTRIBUTING.md +44 -0
- data/README.md +1 -27
- data/bots.yml +7 -1
- data/lib/browser.rb +5 -1
- data/lib/browser/methods/bots.rb +13 -1
- data/lib/browser/methods/consoles.rb +18 -3
- data/lib/browser/methods/mobile.rb +11 -1
- data/lib/browser/methods/platform.rb +2 -2
- data/lib/browser/version.rb +2 -2
- data/test/browser_spec.rb +51 -3
- data/test/ua.yml +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf057ec168032438df5564a7a443ae8856607637
|
|
4
|
+
data.tar.gz: 85337b0813ccc98e8d6970e2470b7ed9b0413abc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d8f6c9fdcbbee23131bab3aa4dc79f84413f1ff58a5e750a113293a06782fd01305f7da5a0e7287c9cf2944d6fdfbfb699016cc3e926f12a37e8514e21207af
|
|
7
|
+
data.tar.gz: 6dc8e034081314899bc389bce63f05fe1e1394d1c4f80f13d6720af9b5d3eb3d9864f9b9c9308b4c9344075bf29d81c92fb8a3c8eeaad57bf0bf5a38e1cebf53
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Issues
|
|
4
|
+
|
|
5
|
+
If you want to request a feature or report a bug, please use the following template.
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
[Add feature/bug description here]
|
|
11
|
+
|
|
12
|
+
## How to reproduce
|
|
13
|
+
|
|
14
|
+
[Add steps on how to reproduce this issue]
|
|
15
|
+
|
|
16
|
+
## What do you expect
|
|
17
|
+
|
|
18
|
+
[Describe what do you expect to happen]
|
|
19
|
+
|
|
20
|
+
## What happened instead
|
|
21
|
+
|
|
22
|
+
[Describe the actual results]
|
|
23
|
+
|
|
24
|
+
## Gem version:
|
|
25
|
+
|
|
26
|
+
Browser version: [Add browser gem version here]
|
|
27
|
+
|
|
28
|
+
## Report
|
|
29
|
+
|
|
30
|
+
Visit <http://user-agent.herokuapp.com> and paste the URL here.
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Writing code
|
|
34
|
+
|
|
35
|
+
Once you've made your great commits (include tests, please):
|
|
36
|
+
|
|
37
|
+
1. [Fork](http://help.github.com/forking/) browser
|
|
38
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
|
39
|
+
3. Push to your branch - `git push origin my_branch`
|
|
40
|
+
4. [Create an Issue](http://github.com/fnando/browser/issues) with a link to your branch
|
|
41
|
+
5. That's it!
|
|
42
|
+
|
|
43
|
+
Please respect the indentation rules and code style.
|
|
44
|
+
And use 2 spaces, not tabs. And don't touch the versioning thing.
|
data/README.md
CHANGED
|
@@ -44,6 +44,7 @@ browser.phantom_js?
|
|
|
44
44
|
browser.quicktime?
|
|
45
45
|
browser.core_media?
|
|
46
46
|
browser.silk?
|
|
47
|
+
browser.known? # has the browser been successfully detected?
|
|
47
48
|
browser.meta # an array with several attributes
|
|
48
49
|
browser.to_s # the meta info joined by space
|
|
49
50
|
```
|
|
@@ -120,33 +121,6 @@ Rails.configuration.middleware.use Browser::Middleware do
|
|
|
120
121
|
end
|
|
121
122
|
```
|
|
122
123
|
|
|
123
|
-
## Issues
|
|
124
|
-
|
|
125
|
-
If you want to request a feature or report a bug, please use the following template.
|
|
126
|
-
|
|
127
|
-
```markdown
|
|
128
|
-
## Description
|
|
129
|
-
|
|
130
|
-
[Add feature/bug description here]
|
|
131
|
-
|
|
132
|
-
## How to reproduce
|
|
133
|
-
|
|
134
|
-
[Add steps on how to reproduce this issue]
|
|
135
|
-
|
|
136
|
-
## What do you expect
|
|
137
|
-
|
|
138
|
-
[Describe what do you expect to happen]
|
|
139
|
-
|
|
140
|
-
## What happened instead
|
|
141
|
-
|
|
142
|
-
[Describe the actual results]
|
|
143
|
-
|
|
144
|
-
## Environment
|
|
145
|
-
|
|
146
|
-
- User agent: [Get the UA - <http://user-agent.herokuapp.com>]
|
|
147
|
-
- Gem version: [Add browser gem version here]
|
|
148
|
-
```
|
|
149
|
-
|
|
150
124
|
## Maintainer
|
|
151
125
|
|
|
152
126
|
* Nando Vieira - http://nandovieira.com.br
|
data/bots.yml
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
360Spider: "360Spider"
|
|
2
|
+
AddThis: "AddThis"
|
|
2
3
|
ADmantX: "ADmantX Platform Semantic Analyzer"
|
|
3
4
|
AdsBot-Google: "Google Adwords"
|
|
4
5
|
AhrefsBot: "Ahrefs backlinks research tool"
|
|
@@ -9,7 +10,7 @@ AppEngine-Google: "Google App Engine"
|
|
|
9
10
|
Ask Jeeves: "Ask Jeeves"
|
|
10
11
|
AsyncHttpClient: "Java http and WebSocket client library"
|
|
11
12
|
awe.sm: "Awe.sm URL expander"
|
|
12
|
-
Baidu: "
|
|
13
|
+
Baidu: "baidu"
|
|
13
14
|
Baiduspider: "Chinese search engine"
|
|
14
15
|
bingbot: "Microsoft bing bot"
|
|
15
16
|
bitlybot: "bit.ly bot"
|
|
@@ -23,6 +24,7 @@ ColdFusion: "ColdFusion http library"
|
|
|
23
24
|
Crowsnest: "Crowsnest"
|
|
24
25
|
Crowsnest: "crowsnest.tv news portal bot"
|
|
25
26
|
curl: "curl unix CLI http client"
|
|
27
|
+
DAP/NetHTTP: "DAP/NetHTTP"
|
|
26
28
|
developers.google.com/+/web/snippet/: "Google Plus"
|
|
27
29
|
DigitalPersona Fingerprint Software: "HP Fingerprint scanner"
|
|
28
30
|
DotBot: "Dot Bot"
|
|
@@ -56,6 +58,7 @@ InAGist: "URL resolver"
|
|
|
56
58
|
Insieve Bot: "Insieve Bot"
|
|
57
59
|
InsieveBot: "InsieveBot"
|
|
58
60
|
Instapaper: "Instapaper"
|
|
61
|
+
Insitesbot: "Insitesbot"
|
|
59
62
|
IstellaBot: "IstellaBot"
|
|
60
63
|
jack: "jack"
|
|
61
64
|
Jakarta Commons-HttpClient: "Jakarta Commons-HttpClient"
|
|
@@ -88,6 +91,7 @@ MFE_expand: "Mcafee spider"
|
|
|
88
91
|
MJ12bot: "Majestic-12 spider"
|
|
89
92
|
MojeekBot: "Mojeek UK search crawler"
|
|
90
93
|
msnbot: "Microsoft bot"
|
|
94
|
+
netState: "netEstate NE Crawler"
|
|
91
95
|
Netvibes: "Personalized dashboard bot"
|
|
92
96
|
NewRelicPinger: "NewRelic monitor"
|
|
93
97
|
newsme: "Link analyzer"
|
|
@@ -112,6 +116,7 @@ QuickLook: "QuickLook"
|
|
|
112
116
|
Readability: "Readability"
|
|
113
117
|
RebelMouse: "RebelMouse"
|
|
114
118
|
redditbot: "Reddit Bot"
|
|
119
|
+
RelateIQ: "RelateIQ"
|
|
115
120
|
Riddler: "Riddler Bot"
|
|
116
121
|
rogerbot: "SeoMoz spider"
|
|
117
122
|
Ruby/1.9.3: "Ruby/1.9.3"
|
|
@@ -128,6 +133,7 @@ Slurp: "Yahoo spider"
|
|
|
128
133
|
Sogou: "Chinese search engine"
|
|
129
134
|
spider: "generic web spider"
|
|
130
135
|
Spinn3r: "Spinn3r aggregator"
|
|
136
|
+
StatusCake: "StatusCake"
|
|
131
137
|
Test Certificate Info: "C http library?"
|
|
132
138
|
trendictionbot: "trendiction search"
|
|
133
139
|
TurnitinBot: "TurnitinBot"
|
data/lib/browser.rb
CHANGED
|
@@ -66,7 +66,7 @@ class Browser
|
|
|
66
66
|
|
|
67
67
|
VERSIONS = {
|
|
68
68
|
chrome: %r[(?:Chrome|CriOS)/([\d.]+)],
|
|
69
|
-
default: %r[(?:Version|MSIE|Firefox|QuickTime|BlackBerry[^/]+|CoreMedia v|PhantomJS)[/ ]?([a-z0-9.]+)]i,
|
|
69
|
+
default: %r[(?:Version|MSIE|Firefox|QuickTime|BlackBerry[^/]+|CoreMedia v|PhantomJS|AdobeAIR)[/ ]?([a-z0-9.]+)]i,
|
|
70
70
|
opera: %r[(?:Opera/.*? Version/([\d.]+)|Chrome/.*?OPR/([\d.]+))],
|
|
71
71
|
ie: %r[(?:MSIE |Trident/.*?; rv:)([\d.]+)]
|
|
72
72
|
}
|
|
@@ -184,6 +184,10 @@ class Browser
|
|
|
184
184
|
!!(ua =~ /Silk/)
|
|
185
185
|
end
|
|
186
186
|
|
|
187
|
+
def known?
|
|
188
|
+
id != :other
|
|
189
|
+
end
|
|
190
|
+
|
|
187
191
|
# Return a meta info about this browser.
|
|
188
192
|
def meta
|
|
189
193
|
Meta.constants.each_with_object(Set.new) do |meta_name, meta|
|
data/lib/browser/methods/bots.rb
CHANGED
|
@@ -13,11 +13,23 @@ class Browser
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def bot?
|
|
16
|
-
|
|
16
|
+
bot_with_empty_ua? || BOTS.any? {|key, _| ua.include?(key) }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def bot_name
|
|
20
|
+
return unless bot?
|
|
21
|
+
return "Generic Bot" if bot_with_empty_ua?
|
|
22
|
+
BOTS.find {|key, description| ua.include?(key) }.first
|
|
17
23
|
end
|
|
18
24
|
|
|
19
25
|
def search_engine?
|
|
20
26
|
SEARCH_ENGINES.any? {|key, _| ua.include?(key) }
|
|
21
27
|
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def bot_with_empty_ua?
|
|
32
|
+
Browser::Bots.detect_empty_ua? && ua.strip == ""
|
|
33
|
+
end
|
|
22
34
|
end
|
|
23
35
|
end
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
class Browser
|
|
2
2
|
module Consoles
|
|
3
|
-
# Detect if browser is Xbox.
|
|
3
|
+
# Detect if browser is running under Xbox.
|
|
4
4
|
def xbox?
|
|
5
5
|
!!(ua =~ /xbox/i)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
# Detect if browser is
|
|
8
|
+
# Detect if browser is running under Xbox One.
|
|
9
|
+
def xbox_one?
|
|
10
|
+
!!(ua =~ /xbox one/i)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Detect if browser is running under PlayStation.
|
|
9
14
|
def playstation?
|
|
10
15
|
!!(ua =~ /playstation/i)
|
|
11
16
|
end
|
|
12
17
|
|
|
18
|
+
# Detect if browser is running under PlayStation 4.
|
|
19
|
+
def playstation4?
|
|
20
|
+
!!(ua =~ /playstation 4/i)
|
|
21
|
+
end
|
|
22
|
+
|
|
13
23
|
# Detect if browser is Nintendo.
|
|
14
24
|
def nintendo?
|
|
15
25
|
!!(ua =~ /nintendo/i)
|
|
@@ -22,7 +32,12 @@ class Browser
|
|
|
22
32
|
|
|
23
33
|
# Detect if browser is running from PSP.
|
|
24
34
|
def psp?
|
|
25
|
-
!!(ua =~ /(PSP
|
|
35
|
+
!!(ua =~ /(PSP)/ || psp_vita?)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Detect if browser is running from PSP Vita.
|
|
39
|
+
def psp_vita?
|
|
40
|
+
!!(ua =~ /Playstation Vita/)
|
|
26
41
|
end
|
|
27
42
|
end
|
|
28
43
|
end
|
|
@@ -15,10 +15,20 @@ class Browser
|
|
|
15
15
|
!!(ua =~ /(BlackBerry)/)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
# Detect if browser is Adobe AIR.
|
|
19
|
+
def adobe_air?
|
|
20
|
+
!!(ua =~ /adobeair/i)
|
|
21
|
+
end
|
|
22
|
+
|
|
18
23
|
private
|
|
19
24
|
|
|
25
|
+
# Regex taken from http://detectmobilebrowsers.com
|
|
20
26
|
def detect_mobile?
|
|
21
|
-
|
|
27
|
+
!!(
|
|
28
|
+
psp? ||
|
|
29
|
+
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.match(ua) ||
|
|
30
|
+
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.match(ua[0..3])
|
|
31
|
+
)
|
|
22
32
|
end
|
|
23
33
|
end
|
|
24
34
|
end
|
|
@@ -30,7 +30,7 @@ class Browser
|
|
|
30
30
|
ios? && !!(ua =~ /OS 7/)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
# Detect if is
|
|
33
|
+
# Detect if is iOS8.
|
|
34
34
|
def ios8?
|
|
35
35
|
ios? && !!(ua =~ /OS 8/)
|
|
36
36
|
end
|
|
@@ -62,7 +62,7 @@ class Browser
|
|
|
62
62
|
|
|
63
63
|
# Detect if current platform is Macintosh.
|
|
64
64
|
def mac?
|
|
65
|
-
ua =~ /Mac OS X/ && !ios?
|
|
65
|
+
!!(ua =~ /Mac OS X/ && !ios?)
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
# Detect if current platform is Windows.
|
data/lib/browser/version.rb
CHANGED
data/test/browser_spec.rb
CHANGED
|
@@ -491,6 +491,7 @@ describe Browser do
|
|
|
491
491
|
|
|
492
492
|
assert_equal "PlayStation Portable", @browser.name
|
|
493
493
|
assert @browser.psp?
|
|
494
|
+
refute @browser.psp_vita?
|
|
494
495
|
assert @browser.mobile?
|
|
495
496
|
end
|
|
496
497
|
|
|
@@ -499,6 +500,7 @@ describe Browser do
|
|
|
499
500
|
|
|
500
501
|
assert_equal "PlayStation Portable", @browser.name
|
|
501
502
|
assert @browser.psp?
|
|
503
|
+
assert @browser.psp_vita?
|
|
502
504
|
assert @browser.mobile?
|
|
503
505
|
end
|
|
504
506
|
|
|
@@ -829,6 +831,7 @@ describe Browser do
|
|
|
829
831
|
|
|
830
832
|
assert @browser.console?
|
|
831
833
|
assert @browser.playstation?
|
|
834
|
+
refute @browser.playstation4?
|
|
832
835
|
end
|
|
833
836
|
|
|
834
837
|
it "detects playstation 4" do
|
|
@@ -836,6 +839,7 @@ describe Browser do
|
|
|
836
839
|
|
|
837
840
|
assert @browser.console?
|
|
838
841
|
assert @browser.playstation?
|
|
842
|
+
assert @browser.playstation4?
|
|
839
843
|
end
|
|
840
844
|
|
|
841
845
|
it "detects xbox 360" do
|
|
@@ -843,6 +847,7 @@ describe Browser do
|
|
|
843
847
|
|
|
844
848
|
assert @browser.console?
|
|
845
849
|
assert @browser.xbox?
|
|
850
|
+
refute @browser.xbox_one?
|
|
846
851
|
end
|
|
847
852
|
|
|
848
853
|
it "detects xbox one" do
|
|
@@ -850,6 +855,7 @@ describe Browser do
|
|
|
850
855
|
|
|
851
856
|
assert @browser.console?
|
|
852
857
|
assert @browser.xbox?
|
|
858
|
+
assert @browser.xbox_one?
|
|
853
859
|
end
|
|
854
860
|
|
|
855
861
|
it "removes duplicate items" do
|
|
@@ -884,22 +890,44 @@ describe Browser do
|
|
|
884
890
|
end
|
|
885
891
|
|
|
886
892
|
it "doesn't consider empty UA as bot" do
|
|
887
|
-
@browser.ua =
|
|
893
|
+
@browser.ua = ""
|
|
888
894
|
refute @browser.bot?
|
|
889
895
|
end
|
|
890
896
|
|
|
891
897
|
it "allows setting empty string as bots" do
|
|
892
898
|
Browser::Bots.detect_empty_ua!
|
|
893
|
-
@browser.ua =
|
|
899
|
+
@browser.ua = ""
|
|
900
|
+
|
|
894
901
|
assert @browser.bot?
|
|
895
902
|
end
|
|
896
903
|
|
|
897
|
-
it "doesn't
|
|
904
|
+
it "doesn't detect mozilla as a bot when considering empty UA" do
|
|
898
905
|
Browser::Bots.detect_empty_ua!
|
|
899
906
|
@browser.ua = "Mozilla"
|
|
907
|
+
|
|
900
908
|
refute @browser.bot?
|
|
901
909
|
end
|
|
902
910
|
|
|
911
|
+
it "returns bot name" do
|
|
912
|
+
@browser.ua = $ua["GOOGLE_BOT"]
|
|
913
|
+
assert_equal @browser.bot_name, "Googlebot"
|
|
914
|
+
|
|
915
|
+
@browser.ua = $ua["FACEBOOK_BOT"]
|
|
916
|
+
assert_equal @browser.bot_name, "facebookexternalhit"
|
|
917
|
+
end
|
|
918
|
+
|
|
919
|
+
it "returns bot name (empty string ua detection enabled)" do
|
|
920
|
+
Browser::Bots.detect_empty_ua!
|
|
921
|
+
@browser.ua = ""
|
|
922
|
+
|
|
923
|
+
assert_equal @browser.bot_name, "Generic Bot"
|
|
924
|
+
end
|
|
925
|
+
|
|
926
|
+
it "returns nil for non-bots" do
|
|
927
|
+
@browser.ua = $ua["CHROME"]
|
|
928
|
+
assert_equal @browser.bot_name, nil
|
|
929
|
+
end
|
|
930
|
+
|
|
903
931
|
it "detects chrome os" do
|
|
904
932
|
@browser.ua = $ua["CHROME_OS"]
|
|
905
933
|
assert @browser.chrome_os?
|
|
@@ -923,4 +951,24 @@ describe Browser do
|
|
|
923
951
|
assert @browser.search_engine?, "#{$ua[key]} should be a search engine"
|
|
924
952
|
end
|
|
925
953
|
end
|
|
954
|
+
|
|
955
|
+
it "knows a supported browser" do
|
|
956
|
+
@browser.ua = "Chrome"
|
|
957
|
+
assert @browser.known?
|
|
958
|
+
end
|
|
959
|
+
|
|
960
|
+
it "does not know an unsupported browser" do
|
|
961
|
+
@browser.ua = "Fancy new browser"
|
|
962
|
+
refute @browser.known?
|
|
963
|
+
end
|
|
964
|
+
|
|
965
|
+
it "detects adobe air" do
|
|
966
|
+
@browser.ua = $ua["ADOBE_AIR"]
|
|
967
|
+
|
|
968
|
+
assert @browser.adobe_air?
|
|
969
|
+
assert @browser.webkit?
|
|
970
|
+
assert_equal @browser.version, "13"
|
|
971
|
+
assert_equal @browser.full_version, "13.0"
|
|
972
|
+
assert_equal @browser.name, "Other"
|
|
973
|
+
end
|
|
926
974
|
end
|
data/test/ua.yml
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
ADOBE_AIR: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X; de) AppleWebKit/533.19.4 (KHTML, like Gecko) AdobeAIR/13.0'
|
|
1
2
|
ANDROID: 'Android SDK 1.5r3: Mozilla/5.0 (Linux; U; Android 1.5; de-; sdk Build/CUPCAKE) AppleWebkit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1'
|
|
2
3
|
ANDROID_WITH_SAFARI: 'Mozilla/5.0 (Linux; U; Android 4.3; en-us; SCH-I535 Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'
|
|
3
4
|
ASK: 'Mozilla/2.0 (compatible; Ask Jeeves/Teoma; +http://sp.ask.com/docs/about/tech_crawling.html)'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: browser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nando Vieira
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-11-
|
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -90,6 +90,7 @@ files:
|
|
|
90
90
|
- ".gitignore"
|
|
91
91
|
- ".hound.yml"
|
|
92
92
|
- ".travis.yml"
|
|
93
|
+
- CONTRIBUTING.md
|
|
93
94
|
- Gemfile
|
|
94
95
|
- README.md
|
|
95
96
|
- Rakefile
|