active_device 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +0 -0
- data/README +0 -1
- data/Rakefile +1 -1
- data/init.rb +0 -0
- data/install.rb +0 -0
- data/lib/active_device/bot.rb +0 -0
- data/lib/active_device/brand.rb +9 -5
- data/lib/active_device/browser.rb +2 -0
- data/lib/active_device/engine.rb +13 -12
- data/lib/active_device/model.rb +28 -2
- data/lib/active_device/os.rb +3 -0
- data/lib/active_device/user_agent.rb +0 -0
- data/lib/active_device_helper.rb +0 -0
- data/rails/init.rb +0 -0
- data/tasks/active_device_tasks.rake +0 -0
- data/test/active_device_test.rb +0 -0
- data/test/test_helper.rb +0 -0
- data/uninstall.rb +0 -0
- metadata +22 -15
data/MIT-LICENSE
CHANGED
File without changes
|
data/README
CHANGED
data/Rakefile
CHANGED
@@ -28,7 +28,7 @@ PKG_FILES = FileList[ '[a-zA-Z]*', 'generators/**/*', 'lib/**/*', 'rails/**/*',
|
|
28
28
|
|
29
29
|
spec = Gem::Specification.new do |s|
|
30
30
|
s.name = "active_device"
|
31
|
-
s.version = "1.0
|
31
|
+
s.version = "1.1.0"
|
32
32
|
s.authors = ["Shenouda Bertel"]
|
33
33
|
s.description = "Device UserAgent Detector"
|
34
34
|
s.email = "sbertel@mobithought.com"
|
data/init.rb
CHANGED
File without changes
|
data/install.rb
CHANGED
File without changes
|
data/lib/active_device/bot.rb
CHANGED
File without changes
|
data/lib/active_device/brand.rb
CHANGED
@@ -22,6 +22,7 @@ class Brand
|
|
22
22
|
when /HTC/i ; :HTC
|
23
23
|
when /iPhone/i ; :Apple
|
24
24
|
when /iTouch/i ; :Apple
|
25
|
+
when /iPad/i ; :Apple
|
25
26
|
when /iPod/i ; :Apple
|
26
27
|
## ==================================== ##
|
27
28
|
when /Acer/i ; :Acer
|
@@ -32,7 +33,6 @@ class Brand
|
|
32
33
|
when /Alphacell/i ; :Alphacell
|
33
34
|
when /Amazon/i ; :Amazon
|
34
35
|
when /Amoi/i ; :Amoi
|
35
|
-
when /Android/i ; :Android
|
36
36
|
when /AnexTek/i ; :AnexTek
|
37
37
|
when /Arcelik/i ; :Arcelik
|
38
38
|
when /ASMOBILE/i ; :ASMOBILE
|
@@ -44,7 +44,7 @@ class Brand
|
|
44
44
|
when /Benefon/i ; :Benefon
|
45
45
|
when /BenQ/i ; :BenQ
|
46
46
|
when /BenQ-Siemens/i ; :'BenQ-Siemens'
|
47
|
-
|
47
|
+
#when /Bird/ ; :Bird
|
48
48
|
when /Bleu/i ; :Bleu
|
49
49
|
when /BlackBerry/i ; :BlackBerry
|
50
50
|
when /Capitel/i ; :Capitel
|
@@ -128,7 +128,7 @@ class Brand
|
|
128
128
|
when /LG/i ; :LG
|
129
129
|
when /Lobster/i ; :Lobster
|
130
130
|
when /Longcos/i ; :Longcos
|
131
|
-
|
131
|
+
#when /LT/ ; :LT
|
132
132
|
when /LXE/i ; :LXE
|
133
133
|
when /Malata/i ; :Malata
|
134
134
|
when /Maxon/i ; :Maxon
|
@@ -152,13 +152,15 @@ class Brand
|
|
152
152
|
when /Neonode/i ; :Neonode
|
153
153
|
when /Newgen/i ; :Newgen
|
154
154
|
when /Nexian/i ; :Nexian
|
155
|
-
|
155
|
+
#when /Nintendo/i ; :Nintendo
|
156
156
|
when /Nokia/i ; :Nokia
|
157
157
|
when /NTT DoCoMo/i ; :'NTT DoCoMo'
|
158
158
|
when /O2/ ; :O2
|
159
159
|
when /OKWap/i ; :OKWap
|
160
160
|
when /Onda/i ; :Onda
|
161
|
-
|
161
|
+
when /Opera Mini/i ; :Opera
|
162
|
+
when /Opera Mobi/i ; :Opera
|
163
|
+
#when /Opera/i ; :Opera
|
162
164
|
when /Optimay/i ; :Optimay
|
163
165
|
when /Orange/i ; :Orange
|
164
166
|
when /PalmOne/i ; :PalmOne
|
@@ -225,12 +227,14 @@ class Brand
|
|
225
227
|
when /Vodafone/i ; :Vodafone
|
226
228
|
when /Voxtel/i ; :Voxtel
|
227
229
|
when /W3C/i ; :W3C
|
230
|
+
when /webOS/i ; :Palm
|
228
231
|
when /WellcoM/i ; :WellcoM
|
229
232
|
when /Wonu/i ; :Wonu
|
230
233
|
when /XDA/i ; :XDA
|
231
234
|
when /YAS/i ; :YAS
|
232
235
|
when /ZT/i ; :ZT
|
233
236
|
when /ZTE/i ; :ZTE
|
237
|
+
when /Android/i ; :Android
|
234
238
|
else ; :UnknownMobile
|
235
239
|
end
|
236
240
|
end
|
@@ -74,6 +74,7 @@ class Browser
|
|
74
74
|
when /IceCat/i ; :IceCat
|
75
75
|
when /Iceweasel/i ; :Iceweasel
|
76
76
|
when /iNet/i ; :iNet
|
77
|
+
when /iPad/i ; :iPad
|
77
78
|
when /iPhone/i ; :iPhone #Embedded Mobile Based
|
78
79
|
when /Iron/i ; :Iron
|
79
80
|
when /Java/i ; :Java # Library
|
@@ -157,6 +158,7 @@ class Browser
|
|
157
158
|
when /WDG_Validator/i ; :WDG_Validator # Validator
|
158
159
|
when /Web Downloader/i ; :'Web Downloader' # Offline Browser
|
159
160
|
when /WebCopier/i ; :WebCopier # Offline Browser
|
161
|
+
when /webOS/i ; :Palm
|
160
162
|
when /WebZIP/i ; :WebZIP # Offline Browser
|
161
163
|
when /Wget/i ; :Wget # Offline Browser
|
162
164
|
when /Winwap/i ; :Winwap #Embedded Mobile Based
|
data/lib/active_device/engine.rb
CHANGED
@@ -18,18 +18,19 @@ class Engine
|
|
18
18
|
|
19
19
|
def self.engine user_agent
|
20
20
|
case user_agent
|
21
|
-
when /
|
22
|
-
when /
|
23
|
-
when /
|
24
|
-
when /
|
25
|
-
when /
|
26
|
-
when /
|
27
|
-
when /
|
28
|
-
when /
|
29
|
-
when /
|
30
|
-
when /
|
31
|
-
when /
|
32
|
-
when /
|
21
|
+
when /AppleWebKit/i ; :AppleWebKit
|
22
|
+
when /Webkit/i ; :Webkit
|
23
|
+
when /Khtml/i ; :khtml
|
24
|
+
when /Konqueror/i ; :Konqueror
|
25
|
+
when /Presto/i ; :Presto
|
26
|
+
when /Trident/i ; :Trident
|
27
|
+
when /Gecko/i ; :Gecko
|
28
|
+
when /MSIE/i ; :MSIE
|
29
|
+
when /Chrome/i ; :Chrome
|
30
|
+
when /Darwin/i ; :Darwin
|
31
|
+
when /NetFront/i ; :NetFront
|
32
|
+
when /UP.Browser/i ; :'UP.Browser'
|
33
|
+
when /Palm/i ; :Palm
|
33
34
|
else :Unknown
|
34
35
|
end
|
35
36
|
end
|
data/lib/active_device/model.rb
CHANGED
@@ -13,12 +13,19 @@ class Model
|
|
13
13
|
|
14
14
|
def self.brand_model user_agent
|
15
15
|
case user_agent
|
16
|
+
when /iPad/i ; :iPad
|
16
17
|
when /iPhone/i ; :iPhone
|
17
18
|
when /SAMSUNG[\w\-\.\_\ ]*/i ; samsung_models user_agent
|
18
19
|
when /Nokia[\w\.\_\ ]*/i ; nokia_models user_agent
|
19
20
|
when /HTC[\w\-\.\_\ ]*/i ; htc_models user_agent
|
20
21
|
when /SonyEricsson[\w\-\.\_\ ]*/i ; sonyericsson_models user_agent
|
21
|
-
when
|
22
|
+
when /Opera Mini/i ; :'Opera Mini'
|
23
|
+
when /Opera Mobi/i ; :'Opera Mobile'
|
24
|
+
when /Palm/i ; palm_models user_agent
|
25
|
+
when /webOS/i ; palm_models user_agent
|
26
|
+
when /T-Mobile G1/i ; :'T-Mobile G1'
|
27
|
+
when /Dream/i ; :'Dream'
|
28
|
+
when /^Mozilla[0-9\-\.\_\ ]*/i ; :Unknown
|
22
29
|
else ; :"#{user_agent[/[\w\-\.\_]*/i]}"
|
23
30
|
end
|
24
31
|
end
|
@@ -65,6 +72,25 @@ class Model
|
|
65
72
|
model_clear model
|
66
73
|
end
|
67
74
|
|
75
|
+
def self.palm_models user_agent
|
76
|
+
if user_agent =~ /webOS[\w\.\_\-]*/i
|
77
|
+
if user_agent[/Pre[\w\.\_\-]*/i]
|
78
|
+
model = :'Palm Pre'
|
79
|
+
elsif user_agent[/Pixi[\w\.\_\-]*/i]
|
80
|
+
model = :'Palm Pixi'
|
81
|
+
else
|
82
|
+
model = user_agent[/[\w\.\_\-]*/i]
|
83
|
+
end
|
84
|
+
elsif user_agent =~ /PalmOS[\w\.\_\-]*/i
|
85
|
+
model = user_agent[/Palm[\.\_\-][\w]*/i]
|
86
|
+
elsif user_agent =~ /PalmSource[\w\.\_\-]*/i
|
87
|
+
model = user_agent[/Palm[\.\_\-][\w]*/i]
|
88
|
+
else
|
89
|
+
model = user_agent[/Palm[\w\.\_\-]*/i]
|
90
|
+
end
|
91
|
+
model_clear model
|
92
|
+
end
|
93
|
+
|
68
94
|
def self.model_clear model
|
69
95
|
model = model.to_s
|
70
96
|
if model.include?("Profile")
|
@@ -79,7 +105,7 @@ class Model
|
|
79
105
|
|
80
106
|
def self.model_reselution user_agent
|
81
107
|
case user_agent
|
82
|
-
when /([0-9]+x+[0-9]*)/i
|
108
|
+
when /([0-9]+x+[0-9]*)/i ; :"#{user_agent[/([0-9]+x+[0-9]*)/i]}"
|
83
109
|
else ; :'Not Recognized'
|
84
110
|
end
|
85
111
|
end
|
data/lib/active_device/os.rb
CHANGED
@@ -16,6 +16,7 @@ class Os
|
|
16
16
|
|
17
17
|
def self.os user_agent
|
18
18
|
case user_agent
|
19
|
+
when /Android/i ; :Android
|
19
20
|
when /windows ce/i ; :'Windows CE'
|
20
21
|
when /windows nt 6\.0/i ; :'Windows Vista'
|
21
22
|
when /windows nt 6\.\d+/i ; :'Windows 7'
|
@@ -32,6 +33,8 @@ class Os
|
|
32
33
|
when /SymbianOS/i ; :SymbianOS
|
33
34
|
when /Symbian/i ; :Symbian
|
34
35
|
when /Palm/i ; :Palm
|
36
|
+
when /PalmOS/i ; :PalmOS
|
37
|
+
when /webOS/i ; :webOS
|
35
38
|
when /iPhone/i ; :iPhone
|
36
39
|
else ; :Unknown
|
37
40
|
end
|
File without changes
|
data/lib/active_device_helper.rb
CHANGED
File without changes
|
data/rails/init.rb
CHANGED
File without changes
|
File without changes
|
data/test/active_device_test.rb
CHANGED
File without changes
|
data/test/test_helper.rb
CHANGED
File without changes
|
data/uninstall.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_device
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 1.1.0
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Shenouda Bertel
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-31 00:00:00 +03:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -22,26 +27,26 @@ extensions: []
|
|
22
27
|
extra_rdoc_files:
|
23
28
|
- README
|
24
29
|
files:
|
25
|
-
- install.rb
|
26
|
-
- Rakefile
|
27
|
-
- README
|
28
30
|
- MIT-LICENSE
|
31
|
+
- README
|
32
|
+
- install.rb
|
29
33
|
- init.rb
|
34
|
+
- Rakefile
|
30
35
|
- uninstall.rb
|
31
|
-
- lib/active_device/model.rb
|
32
|
-
- lib/active_device/os.rb
|
33
|
-
- lib/active_device/engine.rb
|
34
36
|
- lib/active_device/brand.rb
|
35
|
-
- lib/active_device/bot.rb
|
36
37
|
- lib/active_device/handset.rb
|
37
|
-
- lib/active_device/
|
38
|
+
- lib/active_device/model.rb
|
39
|
+
- lib/active_device/engine.rb
|
38
40
|
- lib/active_device/browser.rb
|
39
|
-
- lib/active_device.rb
|
41
|
+
- lib/active_device/user_agent.rb
|
42
|
+
- lib/active_device/os.rb
|
43
|
+
- lib/active_device/bot.rb
|
40
44
|
- lib/active_device_helper.rb
|
45
|
+
- lib/active_device.rb
|
41
46
|
- rails/init.rb
|
42
47
|
- tasks/active_device_tasks.rake
|
43
|
-
- test/active_device_test.rb
|
44
48
|
- test/test_helper.rb
|
49
|
+
- test/active_device_test.rb
|
45
50
|
has_rdoc: true
|
46
51
|
homepage: http://mobithought.com/
|
47
52
|
licenses: []
|
@@ -55,18 +60,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
60
|
requirements:
|
56
61
|
- - ">="
|
57
62
|
- !ruby/object:Gem::Version
|
63
|
+
segments:
|
64
|
+
- 0
|
58
65
|
version: "0"
|
59
|
-
version:
|
60
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
67
|
requirements:
|
62
68
|
- - ">="
|
63
69
|
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 0
|
64
72
|
version: "0"
|
65
|
-
version:
|
66
73
|
requirements: []
|
67
74
|
|
68
75
|
rubyforge_project: active_device
|
69
|
-
rubygems_version: 1.3.
|
76
|
+
rubygems_version: 1.3.6
|
70
77
|
signing_key:
|
71
78
|
specification_version: 3
|
72
79
|
summary: Mobile Device Detector
|