active_device 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +1 -1
- data/README +1 -1
- data/Rakefile +2 -49
- data/active_device.gemspec +21 -0
- data/init.rb +2 -1
- data/lib/active_device.rb +5 -1
- data/lib/active_device/brand.rb +6 -6
- data/lib/active_device/browser.rb +7 -3
- data/lib/{active_device_helper.rb → active_device/helper.rb} +1 -10
- data/lib/active_device/version.rb +3 -0
- data/rails/init.rb +2 -4
- data/rails/init.rb~ +1 -0
- metadata +25 -20
- data/install.rb +0 -1
- data/tasks/active_device_tasks.rake +0 -4
- data/uninstall.rb +0 -1
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/*
|
data/Gemfile
ADDED
data/MIT-LICENSE
CHANGED
data/README
CHANGED
@@ -65,4 +65,4 @@ Send Feedback and questions to: sbertel at mobithought.com
|
|
65
65
|
|
66
66
|
More will Coming Soon, Wait for MobiThought
|
67
67
|
|
68
|
-
Copyright (c) 2009 Shenouda Bertel, MobiThought, released under the MIT license
|
68
|
+
Copyright (c) 2009 Shenouda Bertel, MobiThought, released under the MIT license
|
data/Rakefile
CHANGED
@@ -1,49 +1,2 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'rake/gempackagetask'
|
6
|
-
|
7
|
-
desc 'Default: run unit tests.'
|
8
|
-
task :default => :test
|
9
|
-
|
10
|
-
desc 'Test the active_device plugin.'
|
11
|
-
Rake::TestTask.new(:test) do |t|
|
12
|
-
t.libs << 'lib'
|
13
|
-
t.libs << 'test'
|
14
|
-
t.pattern = 'test/**/*_test.rb'
|
15
|
-
t.verbose = true
|
16
|
-
end
|
17
|
-
|
18
|
-
desc 'Generate documentation for the active_device plugin.'
|
19
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
20
|
-
rdoc.rdoc_dir = 'rdoc'
|
21
|
-
rdoc.title = 'ActiveDevice'
|
22
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
23
|
-
rdoc.rdoc_files.include('README')
|
24
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
|
-
end
|
26
|
-
|
27
|
-
PKG_FILES = FileList[ '[a-zA-Z]*', 'generators/**/*', 'lib/**/*', 'rails/**/*', 'tasks/**/*', 'test/**/*' ]
|
28
|
-
|
29
|
-
spec = Gem::Specification.new do |s|
|
30
|
-
s.name = "active_device"
|
31
|
-
s.version = "1.1.0"
|
32
|
-
s.authors = ["Shenouda Bertel"]
|
33
|
-
s.description = "Device UserAgent Detector"
|
34
|
-
s.email = "sbertel@mobithought.com"
|
35
|
-
s.homepage = "http://mobithought.com/"
|
36
|
-
s.files = PKG_FILES.to_a
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubyforge_project = "active_device"
|
39
|
-
s.rubygems_version = "1.3.5"
|
40
|
-
s.summary = "Mobile Device Detector"
|
41
|
-
s.platform = Gem::Platform::RUBY
|
42
|
-
s.has_rdoc = false
|
43
|
-
s.extra_rdoc_files = ["README"]
|
44
|
-
end
|
45
|
-
|
46
|
-
desc 'Turn this plugin into a gem.'
|
47
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
48
|
-
pkg.gem_spec = spec
|
49
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "active_device/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "active_device"
|
7
|
+
s.version = ActiveDevice::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Shenouda Bertel"]
|
10
|
+
s.email = ["sbertel@mobithought.com"]
|
11
|
+
s.homepage = "http://mobithought.com"
|
12
|
+
s.summary = %q{Mobile Device Detector"}
|
13
|
+
s.description = %q{Device UserAgent Detector}
|
14
|
+
|
15
|
+
s.rubyforge_project = "active_device"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/init.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require 'active_device'
|
2
|
+
require 'active_device_helper'
|
data/lib/active_device.rb
CHANGED
@@ -29,8 +29,11 @@ require 'active_device/bot'
|
|
29
29
|
require 'active_device/engine'
|
30
30
|
require 'active_device/browser'
|
31
31
|
require 'active_device/os'
|
32
|
+
require 'active_device/helper'
|
32
33
|
|
33
34
|
module ActiveDevice
|
35
|
+
|
36
|
+
include ActiveDevice::Helper
|
34
37
|
|
35
38
|
def self.included(base)
|
36
39
|
base.before_filter :set_mobile_format
|
@@ -135,4 +138,5 @@ module ActiveDevice
|
|
135
138
|
|
136
139
|
end
|
137
140
|
|
138
|
-
ActionController::Base.send
|
141
|
+
ActionController::Base.send :include, ActiveDevice
|
142
|
+
ActionView::Base.send :include, ActiveDevice::Helper
|
data/lib/active_device/brand.rb
CHANGED
@@ -24,7 +24,7 @@ class Brand
|
|
24
24
|
when /iTouch/i ; :Apple
|
25
25
|
when /iPad/i ; :Apple
|
26
26
|
when /iPod/i ; :Apple
|
27
|
-
|
27
|
+
## ==================================== ##
|
28
28
|
when /Acer/i ; :Acer
|
29
29
|
when /Ahong/i ; :Ahong
|
30
30
|
when /Aiko/i ; :Aiko
|
@@ -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,7 +152,7 @@ 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
|
@@ -160,7 +160,7 @@ class Brand
|
|
160
160
|
when /Onda/i ; :Onda
|
161
161
|
when /Opera Mini/i ; :Opera
|
162
162
|
when /Opera Mobi/i ; :Opera
|
163
|
-
|
163
|
+
#when /Opera/i ; :Opera
|
164
164
|
when /Optimay/i ; :Optimay
|
165
165
|
when /Orange/i ; :Orange
|
166
166
|
when /PalmOne/i ; :PalmOne
|
@@ -226,7 +226,7 @@ class Brand
|
|
226
226
|
when /VK/i ; :VK
|
227
227
|
when /Vodafone/i ; :Vodafone
|
228
228
|
when /Voxtel/i ; :Voxtel
|
229
|
-
when /W3C/i ; :W3C
|
229
|
+
#when /W3C/i ; :W3C
|
230
230
|
when /webOS/i ; :Palm
|
231
231
|
when /WellcoM/i ; :WellcoM
|
232
232
|
when /Wonu/i ; :Wonu
|
@@ -30,6 +30,7 @@ class Browser
|
|
30
30
|
when /Arora/i ; :Arora
|
31
31
|
when /Avant/i ; :Avant
|
32
32
|
when /Beonex/i ; :Beonex
|
33
|
+
when /BlackBerry/i ; :BlackBerry
|
33
34
|
when /Bloglines/i ; :Bloglines # Feed Reader
|
34
35
|
when /BonEcho/i ; :BonEcho
|
35
36
|
when /Camino/i ; :Camino
|
@@ -140,6 +141,7 @@ class Browser
|
|
140
141
|
when /Shiira/i ; :Shiira
|
141
142
|
when /Shiretoko/i ; :Shiretoko
|
142
143
|
when /SiteBar/i ; :SiteBar #Link Checker
|
144
|
+
when /Skyfire/i ; :Skyfire
|
143
145
|
when /Sleipnir/i ; :Sleipnir
|
144
146
|
when /Stainless/i ; :Stainless
|
145
147
|
when /Sunrise/i ; :Sunrise
|
@@ -148,12 +150,13 @@ class Browser
|
|
148
150
|
when /Symbian/i ; :Symbian #Embedded Mobile Based
|
149
151
|
when /TeaShark/i ; :TeaShark
|
150
152
|
when /Thunderbird/i ; :Thunderbird # E-Mail Client
|
153
|
+
when /UCWEB/i ; :UCWEB
|
151
154
|
when /uzbl/i ; :Uzbl
|
152
155
|
when /Vivante Link Checker/i ; :'Vivante Link Checker' # Link Checker
|
153
156
|
when /w3m/i ; :w3m
|
154
|
-
when /W3C-checklink/i ; :'W3C-checklink' # Link Checker
|
155
|
-
when /W3C_CSS_Validator_JFouffa/i ; :W3C_CSS_Validator_JFouffa # Validator
|
156
|
-
when /W3C_Validator/i ; :W3C_Validator # Validator
|
157
|
+
#when /W3C-checklink/i ; :'W3C-checklink' # Link Checker
|
158
|
+
#when /W3C_CSS_Validator_JFouffa/i ; :W3C_CSS_Validator_JFouffa # Validator
|
159
|
+
#when /W3C_Validator/i ; :W3C_Validator # Validator
|
157
160
|
when /WapTiger/i ; :WapTiger #Embedded Mobile Based
|
158
161
|
when /WDG_Validator/i ; :WDG_Validator # Validator
|
159
162
|
when /Web Downloader/i ; :'Web Downloader' # Offline Browser
|
@@ -191,6 +194,7 @@ class Browser
|
|
191
194
|
# when :SymbianOS ; $1 if user_agent =~ /\/([\d\w\.\-]+)/i #\)?\s*$
|
192
195
|
# when :Symbian ; $1 if user_agent =~ /\ ([0-9\d\w\.\-]+)\)?\s*$/i
|
193
196
|
# when :iPhone ; $1 if user_agent =~ /([\d\w\.\-]+)\)?\s*$/i
|
197
|
+
when :iPhone ; $1 if user_agent =~ /#{name.to_s} OS ([0-9\-\.\_]+)/i
|
194
198
|
#when name[/safari([0-9\-\.\_]+)/i] ; $1 if name =~ /([0-9\-\.\_]+)/i
|
195
199
|
else $1 if user_agent =~ /#{name.to_s}[\/ ]([\d\w\.\-]+)/i
|
196
200
|
end
|
@@ -21,15 +21,6 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#++
|
23
23
|
|
24
|
-
require 'active_device/user_agent'
|
25
|
-
require 'active_device/brand'
|
26
|
-
require 'active_device/model'
|
27
|
-
require 'active_device/handset'
|
28
|
-
require 'active_device/bot'
|
29
|
-
require 'active_device/engine'
|
30
|
-
require 'active_device/browser'
|
31
|
-
require 'active_device/os'
|
32
|
-
|
33
24
|
module ActiveDevice
|
34
25
|
|
35
26
|
module Helper
|
@@ -105,4 +96,4 @@ module ActiveDevice
|
|
105
96
|
end
|
106
97
|
|
107
98
|
end
|
108
|
-
end
|
99
|
+
end
|
data/rails/init.rb
CHANGED
data/rails/init.rb~
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'active_device'
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 1.
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Shenouda Bertel
|
@@ -14,41 +14,44 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-12-21 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: Device UserAgent Detector
|
22
|
-
email:
|
22
|
+
email:
|
23
|
+
- sbertel@mobithought.com
|
23
24
|
executables: []
|
24
25
|
|
25
26
|
extensions: []
|
26
27
|
|
27
|
-
extra_rdoc_files:
|
28
|
-
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
29
30
|
files:
|
31
|
+
- .gitignore
|
32
|
+
- Gemfile
|
30
33
|
- MIT-LICENSE
|
31
34
|
- README
|
32
|
-
- install.rb
|
33
|
-
- init.rb
|
34
35
|
- Rakefile
|
35
|
-
-
|
36
|
+
- active_device.gemspec
|
37
|
+
- init.rb
|
38
|
+
- lib/active_device.rb
|
39
|
+
- lib/active_device/bot.rb
|
36
40
|
- lib/active_device/brand.rb
|
41
|
+
- lib/active_device/browser.rb
|
42
|
+
- lib/active_device/engine.rb
|
37
43
|
- lib/active_device/handset.rb
|
44
|
+
- lib/active_device/helper.rb
|
38
45
|
- lib/active_device/model.rb
|
39
|
-
- lib/active_device/engine.rb
|
40
|
-
- lib/active_device/browser.rb
|
41
|
-
- lib/active_device/user_agent.rb
|
42
46
|
- lib/active_device/os.rb
|
43
|
-
- lib/active_device/
|
44
|
-
- lib/
|
45
|
-
- lib/active_device.rb
|
47
|
+
- lib/active_device/user_agent.rb
|
48
|
+
- lib/active_device/version.rb
|
46
49
|
- rails/init.rb
|
47
|
-
-
|
48
|
-
- test/test_helper.rb
|
50
|
+
- rails/init.rb~
|
49
51
|
- test/active_device_test.rb
|
52
|
+
- test/test_helper.rb
|
50
53
|
has_rdoc: true
|
51
|
-
homepage: http://mobithought.com
|
54
|
+
homepage: http://mobithought.com
|
52
55
|
licenses: []
|
53
56
|
|
54
57
|
post_install_message:
|
@@ -57,6 +60,7 @@ rdoc_options: []
|
|
57
60
|
require_paths:
|
58
61
|
- lib
|
59
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
60
64
|
requirements:
|
61
65
|
- - ">="
|
62
66
|
- !ruby/object:Gem::Version
|
@@ -64,6 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
68
|
- 0
|
65
69
|
version: "0"
|
66
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
67
72
|
requirements:
|
68
73
|
- - ">="
|
69
74
|
- !ruby/object:Gem::Version
|
@@ -73,9 +78,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
78
|
requirements: []
|
74
79
|
|
75
80
|
rubyforge_project: active_device
|
76
|
-
rubygems_version: 1.3.
|
81
|
+
rubygems_version: 1.3.7
|
77
82
|
signing_key:
|
78
83
|
specification_version: 3
|
79
|
-
summary: Mobile Device Detector
|
84
|
+
summary: Mobile Device Detector"
|
80
85
|
test_files: []
|
81
86
|
|
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|