Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Untitled #2

Open
wants to merge 16 commits into from
Commits on May 19, 2010
  1. Added user agent checks for iPhone/iPad.

    Jey Balachandran authored
  2. Added platform result as it is different from OS. Removed comments fr…

    Jey Balachandran authored
    …om agent.rb as 2-3 lines of comments for one line of readable code is pointless. Updated readme.
Commits on Jun 2, 2010
  1. Updated example

    Jey Balachandran authored
Commits on Sep 27, 2010
  1. @cv
  2. @cv
Commits on Oct 24, 2011
  1. @cv

    ignore Gemfile.lock

    cv authored
Commits on Oct 25, 2011
  1. @cv

    reworking some of the gemspec

    cv authored
  2. @cv

    add rvmrc

    cv authored
  3. @cv

    revamp rake tasks

    cv authored
  4. @cv
  5. @cv

    typo

    cv authored
  6. @cv

    ignore any generated gems

    cv authored
Commits on Oct 26, 2011
  1. @cv
  2. @cv

    forgot to take method out

    cv authored
  3. @cv
  4. @cv

    use bundler gem tasks

    cv authored
This page is out of date. Refresh to see the latest.
View
3  .gitignore
@@ -1 +1,2 @@
-.bundle
+Gemfile.lock
+*.gem
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm --create 1.9.2@user-agent
View
6 Gemfile
@@ -1,5 +1,3 @@
-source :gemcutter
+source :rubygems
-gem "rake"
-gem "echoe"
-gem "rspec"
+gemspec
View
12 History.rdoc
@@ -1,12 +0,0 @@
-
-=== 2010-05-07
-
-* Support for Firefox
-
-=== 1.0.0 / 2009-10-08
-
-* Specs for Agent#==
-
-=== 0.0.1 / 2009-08-28
-
-* Initial release
View
16 Manifest
@@ -1,16 +0,0 @@
-Gemfile
-History.rdoc
-Manifest
-README.rdoc
-Rakefile
-lib/user-agent.rb
-lib/user-agent/agent.rb
-lib/user-agent/version.rb
-spec/agent_spec.rb
-spec/agents_spec.rb
-spec/spec.opts
-spec/spec_helper.rb
-tasks/docs.rake
-tasks/gemspec.rake
-tasks/spec.rake
-user-agent.gemspec
View
11 README.rdoc
@@ -6,10 +6,11 @@ User agent parser.
== Example
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'
- agent.name # => :Safari
- agent.version # => '4.0.3'
- agent.engine # => :webkit
- agent.os # => :'Windows Vista'
+ agent.name # => :Safari
+ agent.version # => '4.0.3'
+ agent.engine # => :webkit
+ agent.os # => :'Windows Vista'
+ agent.platform # => :Windows
agent.engine_version # => '531.9'
== Supported Agents
@@ -22,6 +23,8 @@ User agent parser.
* PS3
* PSP
* Wii
+* iPad
+* iPhone
== License:
View
16 Rakefile
@@ -1,15 +1,5 @@
+require "bundler/gem_tasks"
-$:.unshift 'lib'
-require 'user-agent'
-require 'rubygems'
-require 'rake'
-require 'echoe'
+Dir['tasks/**/*.rake'].sort.each { |f| load f }
-Echoe.new "user-agent", Agent::VERSION do |p|
- p.author = "TJ Holowaychuk"
- p.email = "tj@vision-media.ca"
- p.summary = "User agent parser"
- p.runtime_dependencies = []
-end
-
-Dir['tasks/**/*.rake'].sort.each { |f| load f }
+task :default => :spec
View
23 cv-user-agent.gemspec
@@ -0,0 +1,23 @@
+$:.push File.expand_path('../lib', __FILE__)
+require 'user-agent/version'
+
+Gem::Specification.new do |s|
+
+ s.name = 'cv-user-agent'
+ s.version = UserAgent::VERSION
+ s.authors = ['Carlos Villela']
+ s.email = 'cvillela@thoughtworks.com'
+ s.homepage = 'http://github.com/cv/user-agent'
+ s.summary = 'User agent parser'
+ s.description = 'user-agent is a user agent parser support most of the commonly used browsers today.'
+ s.rubyforge_project = 'cv-user-agent'
+ s.require_paths = ['lib']
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- spec/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
+
+ s.add_development_dependency 'rake'
+ s.add_development_dependency 'rspec'
+
+end
View
10 lib/user-agent.rb
@@ -22,4 +22,12 @@
#++
require 'user-agent/agent'
-require 'user-agent/version'
+require 'user-agent/version'
+
+module UserAgent
+
+ def self.parse string
+ ParsedUserAgent.new string
+ end
+
+end
View
233 lib/user-agent/agent.rb
@@ -1,161 +1,126 @@
+module UserAgent
-class Agent
+ class ParsedUserAgent
- ##
- # User agent string.
+ attr_reader :string
- attr_reader :string
-
- ##
- # Initialize with user agent _string_.
-
- def initialize string
- @string = string.strip
- end
-
- #--
- # Instance methods
- #++
-
- ##
- # User agent name symbol.
-
- def name
- Agent.name_for_user_agent string
- end
-
- ##
- # User agent version.
-
- def version
- Agent.version_for_user_agent string
- end
-
- ##
- # User agent engine symbol.
-
- def engine
- Agent.engine_for_user_agent string
- end
-
- ##
- # User agent engine version string.
-
- def engine_version
- Agent.engine_version_for_user_agent string
- end
-
- ##
- # User agent os symbol.
-
- def os
- Agent.os_for_user_agent string
- end
+ def initialize string
+ @string = string.strip
+ end
- ##
- # User agent string.
+ def name
+ ParsedUserAgent.name_for_user_agent string
+ end
- def to_s
- string
- end
+ def version
+ ParsedUserAgent.version_for_user_agent string
+ end
- ##
- # Inspect.
+ def engine
+ ParsedUserAgent.engine_for_user_agent string
+ end
- def inspect
- "#<Agent:#{name} version:#{version.inspect} engine:\"#{engine.to_s}:#{engine_version}\" os:#{os.to_s.inspect}>"
- end
+ def engine_version
+ ParsedUserAgent.engine_version_for_user_agent string
+ end
- ##
- # Check if the agent is the same as _other_ agent.
+ def os
+ ParsedUserAgent.os_for_user_agent string
+ end
- def == other
- string == other.string
- end
+ def platform
+ ParsedUserAgent.platform_for_user_agent string
+ end
- #--
- # Class methods
- #++
+ def to_s
+ string
+ end
- ##
- # Return engine version for user agent _string_.
+ def inspect
+ "#<ParsedUserAgent:#{name} version:#{version.inspect} engine:\"#{engine.to_s}:#{engine_version}\" os:#{os.to_s.inspect}>"
+ end
- def self.engine_version_for_user_agent string
- $1 if string =~ /#{engine_for_user_agent(string)}[\/ ]([\d\w\.\-]+)/i
- end
+ def == other
+ string == other.string
+ end
- ##
- # Return version for user agent _string_.
+ def self.engine_version_for_user_agent string
+ $1 if string =~ /#{engine_for_user_agent(string)}[\/ ]([\d\w\.\-]+)/i
+ end
- def self.version_for_user_agent string
- case name = name_for_user_agent(string)
- when :Chrome ; $1 if string =~ /chrome\/([\d\w\.\-]+)/i
- when :Safari ; $1 if string =~ /version\/([\d\w\.\-]+)/i
- when :PS3 ; $1 if string =~ /([\d\w\.\-]+)\)\s*$/i
- when :PSP ; $1 if string =~ /([\d\w\.\-]+)\)?\s*$/i
- else $1 if string =~ /#{name}[\/ ]([\d\w\.\-]+)/i
+ def self.version_for_user_agent string
+ case name = name_for_user_agent(string)
+ when :Chrome ; $1 if string =~ /chrome\/([\d\w\.\-]+)/i
+ when :Safari ; $1 if string =~ /version\/([\d\w\.\-]+)/i
+ when :PS3 ; $1 if string =~ /([\d\w\.\-]+)\)\s*$/i
+ when :PSP ; $1 if string =~ /([\d\w\.\-]+)\)?\s*$/i
+ else $1 if string =~ /#{name}[\/ ]([\d\w\.\-]+)/i
+ end
end
- end
- ##
- # Return engine symbol for user agent _string_.
+ def self.engine_for_user_agent string
+ case string
+ when /webkit/i ; :webkit
+ when /khtml/i ; :khtml
+ when /konqueror/i ; :konqueror
+ when /chrome/i ; :chrome
+ when /presto/i ; :presto
+ when /gecko/i ; :gecko
+ when /msie/i ; :msie
+ else :Unknown
+ end
+ end
- def self.engine_for_user_agent string
- case string
- when /webkit/i ; :webkit
- when /khtml/i ; :khtml
- when /konqueror/i ; :konqueror
- when /chrome/i ; :chrome
- when /presto/i ; :presto
- when /gecko/i ; :gecko
- when /msie/i ; :msie
- else :unknown
+ def self.os_for_user_agent string
+ case string
+ when /windows nt 6\.0/i ; :'Windows Vista'
+ when /windows nt 6\.\d+/i ; :'Windows 7'
+ when /windows nt 5\.2/i ; :'Windows 2003'
+ when /windows nt 5\.1/i ; :'Windows XP'
+ when /windows nt 5\.0/i ; :'Windows 2000'
+ when /os x (\d+)[._](\d+)/i ; :"OS X #{$1}.#{$2}"
+ when /linux/i ; :Linux
+ when /wii/i ; :Wii
+ when /playstation 3/i ; :Playstation
+ when /playstation portable/i ; :Playstation
+ when /\(ipad.*os (\d+)[._](\d+)/i ; :"iPad OS #{$1}.#{$2}"
+ when /\(iphone.*os (\d+)[._](\d+)/i ; :"iPhone OS #{$1}.#{$2}"
+ else ; :Unknown
+ end
end
- end
- ##
- # Return the os for user agent _string_.
-
- def self.os_for_user_agent string
- case string
- when /windows nt 6\.0/i ; :'Windows Vista'
- when /windows nt 6\.\d+/i ; :'Windows 7'
- when /windows nt 5\.2/i ; :'Windows 2003'
- when /windows nt 5\.1/i ; :'Windows XP'
- when /windows nt 5\.0/i ; :'Windows 2000'
- when /os x (\d+)[._](\d+)/i ; :"OS X #{$1}.#{$2}"
- when /linux/i ; :Linux
- when /wii/i ; :Wii
- when /playstation 3/i ; :Playstation
- when /playstation portable/i ; :Playstation
- else ; :Unknown
+ def self.platform_for_user_agent string
+ case string
+ when /windows/i ; :Windows
+ when /macintosh/i ; :Macintosh
+ when /linux/i ; :Linux
+ when /wii/i ; :Wii
+ when /playstation/i ; :Playstation
+ when /ipad/i ; :iPad
+ when /iphone/i ; :iPhone
+ else :Unknown
+ end
end
- end
- ##
- # Return name for user agent _string_.
-
- def self.name_for_user_agent string
- case string
- when /konqueror/i ; :Konqueror
- when /chrome/i ; :Chrome
- when /safari/i ; :Safari
- when /msie/i ; :IE
- when /opera/i ; :Opera
- when /playstation 3/i ; :PS3
- when /playstation portable/i ; :PSP
- when /firefox/i ; :Firefox
- else ; :Unknown
+ def self.name_for_user_agent string
+ case string
+ when /konqueror/i ; :Konqueror
+ when /chrome/i ; :Chrome
+ when /safari/i ; :Safari
+ when /msie/i ; :IE
+ when /opera/i ; :Opera
+ when /playstation 3/i ; :PS3
+ when /playstation portable/i ; :PSP
+ when /firefox/i ; :Firefox
+ else ; :Unknown
+ end
end
- end
- @agents = []
+ @agents = []
- ##
- # Map agent _name_ to _options_.
+ def self.map name, options = {}
+ @agents << [name, options]
+ end
- def self.map name, options = {}
- @agents << [name, options]
end
-
end
View
5 lib/user-agent/version.rb
@@ -1,4 +1,3 @@
-
-class Agent
- VERSION = '1.0.0'
+module UserAgent
+ VERSION = '1.1.0'
end
View
36 spec/agent_spec.rb
@@ -1,64 +1,64 @@
require File.dirname(__FILE__) + '/spec_helper'
-describe Agent do
+describe UserAgent::ParsedUserAgent do
before :each do
- @agent = Agent.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'
+ @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'
end
-
+
describe "#initialize" do
it "should allow a user agent string to be passed" do
- Agent.new('foo').string.should == 'foo'
+ UserAgent::ParsedUserAgent.new('foo').string.should == 'foo'
end
end
-
+
describe "#os" do
it "should return operating system symbol" do
@agent.os.should == :'OS X 10.5'
end
end
-
+
describe "#engine" do
it "should return engine symbol" do
@agent.engine.should == :webkit
end
end
-
+
describe "#engine_version" do
it "should return engine version" do
@agent.engine_version.should == '528.4'
end
end
-
+
describe "#to_s" do
it "should return the user agent string" do
@agent.to_s.should == @agent.string
end
end
-
+
describe "#inspect" do
it "should return string presenting the engine, os, version, etc" do
- @agent.inspect.should == '#<Agent:Safari version:"4.0dp1" engine:"webkit:528.4" os:"OS X 10.5">'
+ @agent.inspect.should == '#<ParsedUserAgent:Safari version:"4.0dp1" engine:"webkit:528.4" os:"OS X 10.5">'
end
end
-
+
describe "#name" do
it "should return the agent name symbol" do
@agent.name.should == :'Safari'
end
end
-
+
describe "#==" do
it "should be equal when the user agent strings are the same" do
- a = Agent.new 'foo'
- b = Agent.new 'foo'
+ a = UserAgent::ParsedUserAgent.new 'foo'
+ b = UserAgent::ParsedUserAgent.new 'foo'
a.should == b
end
-
+
it "should not be equal when user agent strings are different" do
- a = Agent.new 'foo'
- b = Agent.new 'bar'
+ a = UserAgent::ParsedUserAgent.new 'foo'
+ b = UserAgent::ParsedUserAgent.new 'bar'
a.should_not == b
end
end
-end
+end
View
86 spec/agents_spec.rb
@@ -1,53 +1,75 @@
-
require File.dirname(__FILE__) + '/spec_helper'
-def test name, version, os, engine, engine_version, string
+def test name, version, platform, os, engine, engine_version, string
it "should parse #{name} #{version} on #{os} with engine #{engine} #{engine_version}" do
- agent = Agent.new string
+ agent = UserAgent.parse string
agent.name.should == name
agent.os.should == os
+ agent.platform.should == platform
agent.engine.should == engine
agent.version.should == version
agent.engine_version.should == engine_version
end
end
-describe Agent do
+describe UserAgent do
+
+ 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'
+ 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'
+ 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'
+ 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'
+ 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'
+ 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'
+
+ 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'
+ 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'
+
+ 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'
+
+ 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)'
+ 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)'
+ 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)"
+ 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)"
+ test :IE, '6.0b', :Windows, :'Windows XP', :msie, '6.0b', 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)'
+ 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)'
+
+ test :Opera, '9.99', :Windows, :'Windows XP', :presto, '9.9.9', 'Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9'
+ 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'
+ test :Opera, '9.64', :Linux, :Linux, :presto, '2.1.1', 'Opera/9.64 (X11; Linux i686; U; Linux Mint; it) Presto/2.1.1'
+ test :Opera, '9.00', :Wii, :Wii, :Unknown, nil, 'Opera/9.00 (Nintindo Wii; U; ; 103858; Wii Shop Channel/1.0; en)'
- test :Safari, '4.0dp1', :'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'
- test :Safari, '4.0.3', :'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'
- test :Safari, '4.0.2', :'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'
- test :Safari, '4.0.1', :'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'
- test :Safari, '4.0', :'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'
- test :Safari, '3.2.3', :'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'
+ 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'
+ 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'
+ 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'
- test :IE, '8.0', :'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)'
- test :IE, '7.0b', :'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)'
- test :IE, '6.0b', :'Windows XP', :msie, '6.0b', 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.1)'
- test :IE, '6.0', :'Windows XP', :msie, '6.0', 'Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)'
+ 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'
+ test :Konqueror, '3.1-rc6', :Linux, :Linux, :konqueror, '3.1-rc6', 'Mozilla/5.0 (compatible; Konqueror/3.1-rc6; i686 Linux; 20021105)'
- test :Opera, '9.99', :'Windows XP', :presto, '9.9.9', 'Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9'
- test :Opera, '9.70', :Linux, :gecko, '20061208', 'Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70'
- test :Opera, '9.64', :Linux, :presto, '2.1.1', 'Opera/9.64 (X11; Linux i686; U; Linux Mint; it) Presto/2.1.1'
- test :Opera, '9.00', :Wii, :unknown, nil, 'Opera/9.00 (Nintindo Wii; U; ; 103858; Wii Shop Channel/1.0; en)'
+ test :PS3, '2.00', :Playstation, :Playstation, :Unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 2.00)'
+ test :PS3, '1.10', :Playstation, :Playstation, :Unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 1.10)'
- test :Chrome, '4.0.202.2', :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'
- test :Chrome, '0.2.149.27', :'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'
- test :Chrome, '0.2.149.30', :'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'
+ test :PSP, '2.00', :Playstation, :Playstation, :Unknown, nil, 'PSP (PlayStation Portable); 2.00'
+ test :PSP, '2.00', :Playstation, :Playstation, :Unknown, nil, 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)'
- test :Konqueror, '4.2', :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'
- test :Konqueror, '3.1-rc6', :Linux, :konqueror, '3.1-rc6', 'Mozilla/5.0 (compatible; Konqueror/3.1-rc6; i686 Linux; 20021105)'
+ 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'
+ 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'
+ 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'
+ 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'
+ 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'
- test :PS3, '2.00', :Playstation, :unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 2.00)'
- test :PS3, '1.10', :Playstation, :unknown, nil, 'Mozilla/5.0 (PLAYSTATION 3; 1.10)'
+ 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"
+ 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"
+ 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"
+ 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"
+ 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"
+ 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"
- test :PSP, '2.00', :Playstation, :unknown, nil, 'PSP (PlayStation Portable); 2.00'
- test :PSP, '2.00', :Playstation, :unknown, nil, 'Mozilla/4.0 (PSP (PlayStation Portable); 2.00)'
+ 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)"
+ 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"
+ 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)"
- test :Firefox, '3.5', :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'
- test :Firefox, '3.5', :'Windows 7', :gecko, '20090612', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1) Gecko/20090612 Firefox/3.5'
- test :Firefox, '3.1', :'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'
- test :Firefox, '3.0', :Linux, :gecko, '2008062315', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9) Gecko/2008062315 (Gentoo) Firefox/3.0'
- test :Firefox, '2.0', :Linux, :gecko, '20061202', 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1) Gecko/20061202 Firefox/2.0'
+ 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"
+ 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"
+ 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"
end
View
13 tasks/docs.rake
@@ -1,13 +0,0 @@
-
-namespace :docs do
-
- desc 'Remove rdoc products'
- task :remove => [:clobber_docs]
-
- desc 'Build docs, and open in browser for viewing (specify BROWSER)'
- task :open do
- browser = ENV["BROWSER"] || "safari"
- sh "open -a #{browser} doc/index.html"
- end
-
-end
View
3  tasks/gemspec.rake
@@ -1,3 +0,0 @@
-
-desc 'Build gemspec file'
-task :gemspec => [:build_gemspec]
View
27 tasks/spec.rake
@@ -1,25 +1,4 @@
+require 'rspec/core/rake_task'
-require 'spec/rake/spectask'
-
-desc "Run all specifications"
-Spec::Rake::SpecTask.new(:spec) do |t|
- t.libs << "lib"
- t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
-end
-
-namespace :spec do
-
- desc "Run all specifications verbosely"
- Spec::Rake::SpecTask.new(:verbose) do |t|
- t.libs << "lib"
- t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
- end
-
- desc "Run specific specification verbosely (specify SPEC)"
- Spec::Rake::SpecTask.new(:select) do |t|
- t.libs << "lib"
- t.spec_files = [ENV["SPEC"]]
- t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
- end
-
-end
+desc 'Run all specifications'
+RSpec::Core::RakeTask.new(:spec)
View
30 user-agent.gemspec
@@ -1,30 +0,0 @@
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = %q{user-agent}
- s.version = "1.0.0"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
- s.authors = ["TJ Holowaychuk"]
- s.date = %q{2009-10-08}
- s.description = %q{User agent parser}
- s.email = %q{tj@vision-media.ca}
- s.extra_rdoc_files = ["README.rdoc", "lib/user-agent.rb", "lib/user-agent/agent.rb", "lib/user-agent/version.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
- s.files = ["History.rdoc", "Manifest", "README.rdoc", "Rakefile", "lib/user-agent.rb", "lib/user-agent/agent.rb", "lib/user-agent/version.rb", "spec/agent_spec.rb", "spec/agents_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake", "user-agent.gemspec"]
- s.homepage = %q{}
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "User-agent", "--main", "README.rdoc"]
- s.require_paths = ["lib"]
- s.rubyforge_project = %q{user-agent}
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{User agent parser}
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
-
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
-end
Something went wrong with that request. Please try again.