useragent_parser 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/Rakefile +3 -0
- data/lib/useragent_parser.rb +3 -2
- data/lib/useragent_parser/version.rb +1 -1
- data/spec/useragent_parser/useragent_parser_spec.rb +2 -2
- metadata +10 -9
data/.travis.yml
ADDED
data/Rakefile
CHANGED
data/lib/useragent_parser.rb
CHANGED
@@ -54,8 +54,9 @@ module UseragentParser
|
|
54
54
|
|
55
55
|
# Override for Chrome Frame IFF Chrome is enabled.
|
56
56
|
if js_user_agent_string && js_user_agent_string.include?('Chrome/') && user_agent_string.include?('chromeframe')
|
57
|
-
family = 'Chrome Frame (%
|
58
|
-
|
57
|
+
family = 'Chrome Frame (%s %s)' % [ family, v1 ]
|
58
|
+
js_ua = UseragentParser.parse(js_user_agent_string)
|
59
|
+
cf_family, v1, v2, v3 = js_ua['family'], js_ua['v1'], js_ua['v2'], js_ua['v3']
|
59
60
|
end
|
60
61
|
|
61
62
|
OS_PARSERS.each do |parser|
|
@@ -6,9 +6,9 @@ require 'useragent_parser'
|
|
6
6
|
describe UseragentParser do
|
7
7
|
YAML.load_file(File.expand_path(File.dirname(__FILE__)) + "/../fixtures/test_user_agent_parser.yaml")['test_cases'].each do |testcase|
|
8
8
|
it "should correctly parse the useragent header '#{testcase['user_agent_string']}'" do
|
9
|
-
js_ua = {}
|
10
9
|
if testcase['js_ua']
|
11
|
-
js_ua = eval(testcase['js_ua'].gsub("': '", "' => '"))
|
10
|
+
js_ua = eval(testcase['js_ua'].gsub("': '", "' => '"))
|
11
|
+
js_ua = [ js_ua['js_user_agent_string'], js_ua['js_user_agent_family'], js_ua['js_user_agent_v1'], js_ua['js_user_agent_v2'], js_ua['js_user_agent_v3'] ]
|
12
12
|
end
|
13
13
|
result = UseragentParser.parse(testcase['user_agent_string'], *js_ua)
|
14
14
|
result['family'].should == testcase['family']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: useragent_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-22 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70355423603360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70355423603360
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70355423602860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.6.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70355423602860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: multi_json
|
38
|
-
requirement: &
|
38
|
+
requirement: &70355423602380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 1.0.1
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70355423602380
|
47
47
|
description: UseragentParser extracts browser and operating system information from
|
48
48
|
the headers sent by most browsers and email clients
|
49
49
|
email:
|
@@ -53,6 +53,7 @@ extensions: []
|
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
55
55
|
- .gitignore
|
56
|
+
- .travis.yml
|
56
57
|
- Gemfile
|
57
58
|
- LICENSE
|
58
59
|
- README.md
|
@@ -81,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
82
|
version: '0'
|
82
83
|
segments:
|
83
84
|
- 0
|
84
|
-
hash: -
|
85
|
+
hash: -4296264269086320975
|
85
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
87
|
none: false
|
87
88
|
requirements:
|
@@ -90,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
91
|
version: '0'
|
91
92
|
segments:
|
92
93
|
- 0
|
93
|
-
hash: -
|
94
|
+
hash: -4296264269086320975
|
94
95
|
requirements: []
|
95
96
|
rubyforge_project: useragent_parser
|
96
97
|
rubygems_version: 1.8.6
|