podman-user-agent 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ *.gem
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --create 1.9.2@user-agent
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,52 @@
1
+
2
+ = User Agent
3
+
4
+ User agent parser.
5
+
6
+ == Example
7
+
8
+ agent = Agent.new 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9'
9
+ agent.name # => :Safari
10
+ agent.version # => '4.0.3'
11
+ agent.engine # => :webkit
12
+ agent.os # => :'Windows Vista'
13
+ agent.platform # => :Windows
14
+ agent.engine_version # => '531.9'
15
+
16
+ == Supported Agents
17
+
18
+ * Safari
19
+ * Chrome
20
+ * Opera
21
+ * IE
22
+ * Konqueror
23
+ * PS3
24
+ * PSP
25
+ * Wii
26
+ * iPad
27
+ * iPhone
28
+
29
+ == License:
30
+
31
+ (The MIT License)
32
+
33
+ Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining
36
+ a copy of this software and associated documentation files (the
37
+ 'Software'), to deal in the Software without restriction, including
38
+ without limitation the rights to use, copy, modify, merge, publish,
39
+ distribute, sublicense, an d/or sell copies of the Software, and to
40
+ permit persons to whom the Software is furnished to do so, subject to
41
+ the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be
44
+ included in all copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
47
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
48
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
49
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
50
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
51
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
52
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir['tasks/**/*.rake'].sort.each { |f| load f }
4
+
5
+ task :default => :spec
@@ -0,0 +1,23 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+ require 'user-agent/version'
3
+
4
+ Gem::Specification.new do |s|
5
+
6
+ s.name = 'podman-user-agent'
7
+ s.version = UserAgent::VERSION
8
+ s.authors = ['Adam Podolnick']
9
+ s.email = 'podman@gmail.com'
10
+ s.homepage = 'http://github.com/podman/user-agent'
11
+ s.summary = 'User agent parser'
12
+ s.description = 'user-agent is a user agent parser support most of the commonly used browsers today.'
13
+ s.rubyforge_project = 'podman-user-agent'
14
+ s.require_paths = ['lib']
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- spec/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
19
+
20
+ s.add_development_dependency 'rake'
21
+ s.add_development_dependency 'rspec'
22
+
23
+ end
@@ -0,0 +1,163 @@
1
+ module UserAgent
2
+
3
+ class ParsedUserAgent
4
+
5
+ attr_reader :string
6
+
7
+ def initialize string
8
+ @string = string.strip
9
+ end
10
+
11
+ def name
12
+ ParsedUserAgent.name_for_user_agent string
13
+ end
14
+
15
+ def version
16
+ ParsedUserAgent.version_for_user_agent string
17
+ end
18
+
19
+ def engine
20
+ ParsedUserAgent.engine_for_user_agent string
21
+ end
22
+
23
+ def engine_version
24
+ ParsedUserAgent.engine_version_for_user_agent string
25
+ end
26
+
27
+ def os
28
+ ParsedUserAgent.os_for_user_agent string
29
+ end
30
+
31
+ def platform
32
+ ParsedUserAgent.platform_for_user_agent string
33
+ end
34
+
35
+ def device
36
+ ParsedUserAgent.device_for_user_agent string
37
+ end
38
+
39
+ def to_s
40
+ string
41
+ end
42
+
43
+ def inspect
44
+ "#<ParsedUserAgent:#{name} version:#{version.inspect} engine:\"#{engine.to_s}:#{engine_version}\" os:#{os.to_s.inspect}>"
45
+ end
46
+
47
+ def == other
48
+ string == other.string
49
+ end
50
+
51
+ def self.engine_version_for_user_agent string
52
+ $1 if string =~ /#{engine_for_user_agent(string)}[\/ ]([\d\w\.\-]+)/i
53
+ end
54
+
55
+ def self.version_for_user_agent string
56
+ case name = name_for_user_agent(string)
57
+ when :ChromeFrame ; $1 if string =~ /chromeframe\/([\d\s\.\-]+)/i
58
+ when :Chrome ; $1 if string =~ /chrome\/([\d\w\.\-]+)/i
59
+ when :Safari ; $1 if string =~ /version\/([\d\w\.\-]+)/i
60
+ when :PS3 ; $1 if string =~ /([\d\w\.\-]+)\)\s*$/i
61
+ when :PSP ; $1 if string =~ /([\d\w\.\-]+)\)?\s*$/i
62
+ when :"IE Mobile"; $1 if string =~ /iemobile\/([\d\.]+)/i
63
+ else $1 if string =~ /#{name}[\/ ]([\d\w\.\-]+)/i
64
+ end
65
+ end
66
+
67
+ def self.engine_for_user_agent string
68
+ case string
69
+ when /webkit/i ; :webkit
70
+ when /khtml/i ; :khtml
71
+ when /konqueror/i ; :konqueror
72
+ when /chrome/i ; :chrome
73
+ when /presto/i ; :presto
74
+ when /gecko/i ; :gecko
75
+ when /msie/i ; :msie
76
+ else :Unknown
77
+ end
78
+ end
79
+
80
+ def self.os_for_user_agent string
81
+ case string
82
+ when /windows nt 6\.0/i ; :'Windows Vista'
83
+ when /windows nt 6\.\d+/i ; :'Windows 7'
84
+ when /windows nt 5\.2/i ; :'Windows 2003'
85
+ when /windows nt 5\.1/i ; :'Windows XP'
86
+ when /windows nt 5\.0/i ; :'Windows 2000'
87
+ when /windows phone os ([^;]+);/i ; :"Windows Phone OS #{$1}"
88
+ when /os x (\d+)[._](\d+)/i ; :"OS X #{$1}.#{$2}"
89
+ when /android ([^;]+);/i ; :"Android #{$1}"
90
+ when /linux/i ; :Linux
91
+ when /wii/i ; :Wii
92
+ when /playstation 3/i ; :Playstation
93
+ when /playstation portable/i ; :Playstation
94
+ when /ipad.*os (\d+)[._](\d+)[._](\d+)/i; :"iOS #{$1}.#{$2}.#{$3}"
95
+ when /\(ipad.*os (\d+)[._](\d+)/i ; :"iOS #{$1}.#{$2}"
96
+ when /iphone.*os (\d+)[._](\d+)[._](\d+)/i; :"iOS #{$1}.#{$2}.#{$3}"
97
+ when /\iphone.*os (\d+)[._](\d+)/i ; :"iOS #{$1}.#{$2}"
98
+ when /webos\/([^;]+);/i ; :"webOS #{$1}"
99
+ when /os x/i ; :"OS X"
100
+ when /cros i\d{3} ([^\)]+)\)/i ; :"ChromeOS #{$1}"
101
+ when /rim tablet os ([^;]+);/i ; :"RIM Tablet OS #{$1}"
102
+ when /blackberry(\d+)\/([^\s]+)\s/i ; :"RIM OS #{$2}"
103
+ when /blackberry ([^;]+);/i ; :"RIM OS"
104
+ else ; :Unknown
105
+ end
106
+ end
107
+
108
+ def self.platform_for_user_agent string
109
+ case string
110
+ when /windows phone/i; :"Windows Phone"
111
+ when /windows/i ; :Windows
112
+ when /macintosh/i ; :Macintosh
113
+ when /android/i ; :Android
114
+ when /linux/i ; :Linux
115
+ when /wii/i ; :Wii
116
+ when /playstation/i ; :Playstation
117
+ when /ipod/i ; :iPod
118
+ when /ipad/i ; :iPad
119
+ when /iphone/i ; :iPhone
120
+ when /blackberry/i ; :BlackBerry
121
+ when /playbook/i ; :PlayBook
122
+ when /webos/i ; :webOS
123
+ when /cros/i ; :ChromeOS
124
+ else :Unknown
125
+ end
126
+ end
127
+
128
+ def self.name_for_user_agent string
129
+ case string
130
+ when /konqueror/i ; :Konqueror
131
+ when /chromeframe/i ; :ChromeFrame
132
+ when /chrome/i ; :Chrome
133
+ when /mobile safari/i ; :"Mobile Safari"
134
+ when /safari/i ; :Safari
135
+ when /iemobile/i ; :"IE Mobile"
136
+ when /msie/i ; :IE
137
+ when /opera/i ; :Opera
138
+ when /playstation 3/i ; :PS3
139
+ when /playstation portable/i ; :PSP
140
+ when /firefox/i ; :Firefox
141
+ when /ipad|iphone|ipod/i ; :"Mobile Safari"
142
+ when /blackberry/i ; :"BlackBerrry"
143
+ else ; :Unknown
144
+ end
145
+ end
146
+
147
+ def self.device_for_user_agent string
148
+ case platform = platform_for_user_agent(string)
149
+ when :Windows, :Macintosh, :Linux, :ChromeOS ; :Desktop
150
+ when :iPod, :iPad, :iPhone, :BlackBerry, :PlayBook, :Android, :webOS, :"Windows Phone" ; :Mobile
151
+ when :Wii, :Playstation ; :"Game Console"
152
+ else ; :Unknown
153
+ end
154
+ end
155
+
156
+ @agents = []
157
+
158
+ def self.map name, options = {}
159
+ @agents << [name, options]
160
+ end
161
+
162
+ end
163
+ end
@@ -0,0 +1,3 @@
1
+ module UserAgent
2
+ VERSION = '1.2.0'
3
+ end
data/lib/user-agent.rb ADDED
@@ -0,0 +1,33 @@
1
+ #--
2
+ # Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ require 'user-agent/agent'
25
+ require 'user-agent/version'
26
+
27
+ module UserAgent
28
+
29
+ def self.parse string
30
+ ParsedUserAgent.new string
31
+ end
32
+
33
+ end
@@ -0,0 +1,64 @@
1
+
2
+ require File.dirname(__FILE__) + '/spec_helper'
3
+
4
+ describe UserAgent::ParsedUserAgent do
5
+ before :each do
6
+ @agent = UserAgent::ParsedUserAgent.new 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_4; en-us) AppleWebKit/528.4+ (KHTML, like Gecko) Version/4.0dp1 Safari/526.11.2'
7
+ end
8
+
9
+ describe "#initialize" do
10
+ it "should allow a user agent string to be passed" do
11
+ UserAgent::ParsedUserAgent.new('foo').string.should == 'foo'
12
+ end
13
+ end
14
+
15
+ describe "#os" do
16
+ it "should return operating system symbol" do
17
+ @agent.os.should == :'OS X 10.5'
18
+ end
19
+ end
20
+
21
+ describe "#engine" do
22
+ it "should return engine symbol" do
23
+ @agent.engine.should == :webkit
24
+ end
25
+ end
26
+
27
+ describe "#engine_version" do
28
+ it "should return engine version" do
29
+ @agent.engine_version.should == '528.4'
30
+ end
31
+ end
32
+
33
+ describe "#to_s" do
34
+ it "should return the user agent string" do
35
+ @agent.to_s.should == @agent.string
36
+ end
37
+ end
38
+
39
+ describe "#inspect" do
40
+ it "should return string presenting the engine, os, version, etc" do
41
+ @agent.inspect.should == '#<ParsedUserAgent:Safari version:"4.0dp1" engine:"webkit:528.4" os:"OS X 10.5">'
42
+ end
43
+ end
44
+
45
+ describe "#name" do
46
+ it "should return the agent name symbol" do
47
+ @agent.name.should == :'Safari'
48
+ end
49
+ end
50
+
51
+ describe "#==" do
52
+ it "should be equal when the user agent strings are the same" do
53
+ a = UserAgent::ParsedUserAgent.new 'foo'
54
+ b = UserAgent::ParsedUserAgent.new 'foo'
55
+ a.should == b
56
+ end
57
+
58
+ it "should not be equal when user agent strings are different" do
59
+ a = UserAgent::ParsedUserAgent.new 'foo'
60
+ b = UserAgent::ParsedUserAgent.new 'bar'
61
+ a.should_not == b
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,75 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ def test name, version, platform, os, engine, engine_version, string
4
+ it "should parse #{name} #{version} on #{os} with engine #{engine} #{engine_version}" do
5
+ agent = UserAgent.parse string
6
+ agent.name.should == name
7
+ agent.os.should == os
8
+ agent.platform.should == platform
9
+ agent.engine.should == engine
10
+ agent.version.should == version
11
+ agent.engine_version.should == engine_version
12
+ end
13
+ end
14
+
15
+ describe UserAgent do
16
+
17
+ test :Safari, '4.0dp1', :Windows, :'Windows XP', :webkit, '526.9', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/526.9 (KHTML, like Gecko) Version/4.0dp1 Safari/526.8'
18
+ test :Safari, '4.0.3', :Windows, :'Windows Vista', :webkit, '531.9', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9'
19
+ test :Safari, '4.0.2', :Windows, :'Windows 7', :webkit, '532', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532+ (KHTML, like Gecko) Version/4.0.2 Safari/530.19.1'
20
+ test :Safari, '4.0.1', :Macintosh, :'OS X 10.5', :webkit, '531.2', 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/4.0.1 Safari/530.18'
21
+ test :Safari, '4.0', :Windows, :'Windows Vista', :webkit, '528.16', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; ru-RU) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16'
22
+ test :Safari, '3.2.3', :Windows, :'Windows XP', :webkit, '525.28.3', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29'
23
+
24
+ test :Safari, '4.0.4', :iPad, :'iPad OS 3.2', :webkit, '531.21.10', 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'
25
+ test :Safari, '4.0.4', :iPad, :'iPad OS 3.2', :webkit, '531.21.10', 'Mozilla/5.0 (iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'
26
+
27
+ test :Safari, '4.0', :iPhone, :'iPhone OS 3.0', :webkit, '528.18', 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16'
28
+
29
+ test :IE, '8.0', :Windows, :'Windows 7', :msie, '8.0', 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)'
30
+ test :IE, '7.0b', :Windows, :'Windows 2003', :msie, '7.0b', 'Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)'
31
+ test :IE, '7.0', :Windows, :'Windows XP', :msie, '7.0', "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)"
32
+ test :IE, '7.0', :Windows, :'Windows XP', :msie, '7.0', "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; MSOffice 12)"
33
+ test :IE, '6.0b', :Windows, :'Windows XP', :msie, '6.0b', 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)'
34
+ test :IE, '6.0', :Windows, :'Windows XP', :msie, '6.0', 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)'
35
+
36
+ test :Opera, '9.99', :Windows, :'Windows XP', :presto, '9.9.9', 'Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9'
37
+ test :Opera, '9.70', :Linux, :Linux, :gecko, '20061208', 'Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70'
38
+ test :Opera, '9.64', :Linux, :Linux, :presto, '2.1.1', 'Opera/9.64 (X11; Linux i686; U; Linux Mint; it) Presto/2.1.1'
39
+ test :Opera, '9.00', :Wii, :Wii, :Unknown, nil, 'Opera/9.00 (Nintindo Wii; U; ; 103858; Wii Shop Channel/1.0; en)'
40
+
41
+ test :Chrome, '4.0.202.2', :Linux, :Linux, :webkit, '532.0', 'Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.202.2 Safari/532.0'
42
+ test :Chrome, '0.2.149.27', :Windows, :'Windows 2003', :webkit, '525.13', 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13'
43
+ test :Chrome, '0.2.149.30', :Windows, :'Windows Vista', :webkit, '525.13', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.30 Safari/525.13'
44
+
45
+ test :Konqueror, '4.2', :Linux, :Linux, :khtml, '4.2.4', 'Mozilla/5.0 (compatible; Konqueror/4.2; Linux; X11; x86_64) KHTML/4.2.4 (like Gecko) Fedora/4.2.4-2.fc11'
46
+ test :Konqueror, '3.1-rc6', :Linux, :Linux, :konqueror, '3.1-rc6', 'Mozilla/5.0 (compatible; Konqueror/3.1-rc6; i686 Linux; 20021105)'
47
+
48
+ test :PS3, '2.00', :Playstation, :Playstation, :Unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 2.00)'
49
+ test :PS3, '1.10', :Playstation, :Playstation, :Unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 1.10)'
50
+
51
+ test :PSP, '2.00', :Playstation, :Playstation, :Unknown, nil, 'PSP (PlayStation Portable); 2.00'
52
+ test :PSP, '2.00', :Playstation, :Playstation, :Unknown, nil, 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)'
53
+
54
+ test :Firefox, '3.5', :Linux, :Linux, :gecko, '20090624', 'Mozilla/5.0 (X11;U; Linux i686; en-GB; rv:1.9.1) Gecko/20090624 Ubuntu/9.04 (jaunty) Firefox/3.5'
55
+ test :Firefox, '3.5', :Windows, :'Windows 7', :gecko, '20090612', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1) Gecko/20090612 Firefox/3.5'
56
+ test :Firefox, '3.1', :Windows, :'Windows XP', :gecko, '2009011606', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1'
57
+ test :Firefox, '3.0', :Linux, :Linux, :gecko, '2008062315', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9) Gecko/2008062315 (Gentoo) Firefox/3.0'
58
+ test :Firefox, '2.0', :Linux, :Linux, :gecko, '20061202', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1) Gecko/20061202 Firefox/2.0'
59
+
60
+ test :Chrome, '6.0.472.62', :Macintosh, :'OS X 10.6', :webkit, '534.3', "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3"
61
+ test :Chrome, '6.0.472.63', :Macintosh, :'OS X 10.6', :webkit, '534.3', "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3"
62
+ test :Chrome, '6.0.472.55', :Linux, :Linux, :webkit, '534.3', "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.55 Safari/534.3"
63
+ test :Chrome, '5.0.375.127', :Windows, :'Windows XP', :webkit, '533.4', "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4"
64
+ test :Chrome, '6.0.472.59', :Windows, :'Windows XP', :webkit, '534.3', "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.59 Safari/534.3"
65
+ test :Chrome, '6.0.472.53', :Linux, :Linux, :webkit, '534.3', "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.53 Safari/534.3"
66
+
67
+ test :Firefox, '3.5.13', :Windows, :'Windows XP', :gecko, '20100914', "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.13) Gecko/20100914 Firefox/3.5.13 (.NET CLR 3.5.30729)"
68
+ test :Firefox, '3.6.10', :Windows, :'Windows XP', :gecko, '20100914', "Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1"
69
+ test :Firefox, '3.6.10', :Windows, :'Windows Vista', :gecko, '20100914', "Mozilla/5.0 (Windows; U; Windows NT 6.0; pt-BR; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10 GTB7.1 ( .NET CLR 3.5.30729)"
70
+
71
+ test :Firefox, '3.6.8', :Linux, :Linux, :gecko, '20100723', "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.8) Gecko/20100723 Ubuntu/9.10 (karmic) Firefox/3.6.8"
72
+ test :Firefox, '3.6.9', :Linux, :Linux, :gecko, '20100824', "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100824 Firefox/3.6.9"
73
+ test :Firefox, '3.6.9', :Linux, :Linux, :gecko, '20100825', "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100825 Ubuntu/10.04 (lucid) Firefox/3.6.9"
74
+
75
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format specdoc
@@ -0,0 +1,3 @@
1
+
2
+ $:.unshift File.dirname(__FILE__) + '/../lib'
3
+ require 'user-agent'
data/tasks/spec.rake ADDED
@@ -0,0 +1,4 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ desc 'Run all specifications'
4
+ RSpec::Core::RakeTask.new(:spec)
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: podman-user-agent
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 0
10
+ version: 1.2.0
11
+ platform: ruby
12
+ authors:
13
+ - Adam Podolnick
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-02-23 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rake
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rspec
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :development
48
+ version_requirements: *id002
49
+ description: user-agent is a user agent parser support most of the commonly used browsers today.
50
+ email: podman@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - .gitignore
59
+ - .rvmrc
60
+ - Gemfile
61
+ - README.rdoc
62
+ - Rakefile
63
+ - cv-user-agent.gemspec
64
+ - lib/user-agent.rb
65
+ - lib/user-agent/agent.rb
66
+ - lib/user-agent/version.rb
67
+ - spec/agent_spec.rb
68
+ - spec/agents_spec.rb
69
+ - spec/spec.opts
70
+ - spec/spec_helper.rb
71
+ - tasks/spec.rake
72
+ has_rdoc: true
73
+ homepage: http://github.com/podman/user-agent
74
+ licenses: []
75
+
76
+ post_install_message:
77
+ rdoc_options: []
78
+
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ hash: 3
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ requirements: []
100
+
101
+ rubyforge_project: podman-user-agent
102
+ rubygems_version: 1.5.3
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: User agent parser
106
+ test_files:
107
+ - spec/agent_spec.rb
108
+ - spec/agents_spec.rb
109
+ - spec/spec.opts
110
+ - spec/spec_helper.rb