double_agent 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ == Release 0.2.2 (November 1, 2011) ==
2
+
3
+ * Detect Firefox on Android (Fennec)
4
+
5
+ * Bugfix to Parser#version, which could blow up in some cases
6
+
7
+ * Change Rspec to RSpec (Rspec is being deprecated)
8
+
1
9
  == Release 0.2.1 (September 15, 2011)
2
10
 
3
11
  * Syntax fixes to YAML data so it loads with Psych (basically Rails 3.1 support)
data/data/browsers.yml CHANGED
@@ -20,6 +20,18 @@
20
20
  :version: (?<=chromium/)[0-9]+
21
21
  :safe_version: ["chromium/[0-9]+", "[0-9]+"]
22
22
 
23
+ - :name: Opera %s
24
+ :sym: :opera
25
+ :regex: opera
26
+ :version: ((?<=version/)[0-9]+)|((?<=opera )[0-9]+)
27
+ :safe_version: ["(version/[0-9]+)|(opera [0-9]+)", "[0-9]+"]
28
+
29
+ - :name: Firefox %s
30
+ :sym: :firefox
31
+ :regex: firefox
32
+ :version: (?<=firefox/)[0-9]+
33
+ :safe_version: ["firefox/[0-9]+", "[0-9]+"]
34
+
23
35
  - :name: Android %s
24
36
  :sym: :android
25
37
  :family_sym: :chromium
@@ -43,22 +55,10 @@
43
55
  :version: (?<=version/)[0-9]+
44
56
  :safe_version: ["version/[0-9]+", "[0-9]+"]
45
57
 
46
- - :name: Opera %s
47
- :sym: :opera
48
- :regex: opera
49
- :version: ((?<=version/)[0-9]+)|((?<=opera )[0-9]+)
50
- :safe_version: ["(version/[0-9]+)|(opera [0-9]+)", "[0-9]+"]
51
-
52
58
  - :name: Konqueror
53
59
  :sym: :konqueror
54
60
  :regex: konqueror
55
61
 
56
- - :name: Firefox %s
57
- :sym: :firefox
58
- :regex: firefox
59
- :version: (?<=firefox/)[0-9]+
60
- :safe_version: ["firefox/[0-9]+", "[0-9]+"]
61
-
62
62
  - :name: Unknown
63
63
  :sym: :unknown
64
64
  :regex: .*
@@ -61,7 +61,7 @@ module DoubleAgent
61
61
  # nil if nothing is found.
62
62
  def version(ua)
63
63
  if @safe_version
64
- ua.slice(@safe_version[0]).slice(@safe_version[1])
64
+ ua.slice(@safe_version[0]).slice(@safe_version[1]) rescue nil
65
65
  else
66
66
  ua.slice(@version)
67
67
  end
data/spec/data_spec.rb CHANGED
@@ -70,6 +70,11 @@ describe DoubleAgent do
70
70
  "#{DA.browser ua} on #{DA.os ua}".should == 'Firefox 4 on GNU/Linux'
71
71
  end
72
72
 
73
+ it 'should be Firefox 7 on Android' do
74
+ ua = "Mozilla/5.0 (Android; Linux armv7l; rv:7.0.1) Gecko/20110928 Firefox/7.0.1 Fennec/7.0.1"
75
+ "#{DA.browser ua} on #{DA.os ua}".should == 'Firefox 7 on Android'
76
+ end
77
+
73
78
  # Epiphany
74
79
  it 'should be Epiphany on GNU/Linux' do
75
80
  ua = "Mozilla/5.0 (X11; U; Linux x86_64; fr-FR) AppleWebKit/534.7 (KHTML, like Gecko) Epiphany/2.30.6 Safari/534.7"
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../lib/double_agent/resources'
4
4
  require File.dirname(__FILE__) + '/../lib/double_agent/stats'
5
5
  require File.dirname(__FILE__) + '/../lib/double_agent/logs'
6
6
 
7
- Rspec.configure do |c|
7
+ RSpec.configure do |c|
8
8
  c.mock_with :rspec
9
9
  end
10
10
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jordan Hollinger
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-09-15 00:00:00 -04:00
17
+ date: 2011-11-01 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20