rack-mobile-detect 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +18 -4
- data/Rakefile +1 -1
- data/TODO +0 -1
- data/VERSION.yml +1 -1
- data/lib/rack-mobile-detect.rb +1 -1
- data/rack-mobile-detect.gemspec +58 -0
- metadata +4 -2
data/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
Install
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
sudo gem install rack-mobile-detect -s http://gemcutter.org
|
|
5
|
+
|
|
1
6
|
Overview
|
|
2
7
|
========
|
|
3
8
|
|
|
4
|
-
`Rack::MobileDetect`
|
|
5
|
-
`X_MOBILE_DEVICE` header to the request if
|
|
6
|
-
detected. The strategy for detecting a mobile device is as
|
|
9
|
+
`Rack::MobileDetect` is Rack middleware for ruby webapps that detects
|
|
10
|
+
mobile devices. It adds an `X_MOBILE_DEVICE` header to the request if
|
|
11
|
+
a device is detected. The strategy for detecting a mobile device is as
|
|
7
12
|
follows:
|
|
8
13
|
|
|
9
14
|
### Targeted Detection ###
|
|
@@ -72,4 +77,13 @@ Configuration/CLDC-1.1 VendorID/102' connects, the value of
|
|
|
72
77
|
This allows you to limit the catchall expression to only the device
|
|
73
78
|
list you choose.
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
Utils
|
|
81
|
+
=====
|
|
82
|
+
|
|
83
|
+
A Sinatra app called echo_env.rb is available in the
|
|
84
|
+
[util/](http://github.com/talison/rack-mobile-detect/tree/master/util/)
|
|
85
|
+
directory. Hit this app with a mobile device to see the various HTTP
|
|
86
|
+
headers and whether or not the `X_MOBILE_DEVICE` header is added by
|
|
87
|
+
`Rack::MobileDetect`.
|
|
88
|
+
|
|
89
|
+
See the [unit test source code](http://github.com/talison/rack-mobile-detect/tree/master/test/) for more info.
|
data/Rakefile
CHANGED
|
@@ -11,7 +11,7 @@ begin
|
|
|
11
11
|
devices can be targeted with custom Regexps.}
|
|
12
12
|
gem.email = "accounts@majortom.fastmail.us"
|
|
13
13
|
gem.homepage = "http://github.com/talison/rack-mobile-detect"
|
|
14
|
-
gem.authors = ["Tom Alison"]
|
|
14
|
+
gem.authors = ["Tom Alison", "Michael Wood"]
|
|
15
15
|
gem.add_development_dependency "shoulda", ">= 0"
|
|
16
16
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
17
17
|
end
|
data/TODO
CHANGED
data/VERSION.yml
CHANGED
data/lib/rack-mobile-detect.rb
CHANGED
|
@@ -134,7 +134,7 @@ module Rack
|
|
|
134
134
|
|
|
135
135
|
# Fall-back on UAProf detection
|
|
136
136
|
# http://www.developershome.com/wap/detection/detection.asp?page=profileHeader
|
|
137
|
-
device ||= env.keys.detect { |k| k.
|
|
137
|
+
device ||= env.keys.detect { |k| k.match(/^HTTP(.*)_PROFILE$/) } != nil
|
|
138
138
|
|
|
139
139
|
# Fall back to Accept header detection
|
|
140
140
|
device ||= Regexp.new(@regex_accept).match(env.fetch('HTTP_ACCEPT','')) != nil
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{rack-mobile-detect}
|
|
8
|
+
s.version = "0.1.1"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Tom Alison", "Michael Wood"]
|
|
12
|
+
s.date = %q{2009-10-30}
|
|
13
|
+
s.description = %q{Rack::MobileDetect detects mobile devices and adds an
|
|
14
|
+
X_MOBILE_DEVICE header to the request if a mobile device is detected. Specific
|
|
15
|
+
devices can be targeted with custom Regexps.}
|
|
16
|
+
s.email = %q{accounts@majortom.fastmail.us}
|
|
17
|
+
s.extra_rdoc_files = [
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"README.md"
|
|
20
|
+
]
|
|
21
|
+
s.files = [
|
|
22
|
+
".document",
|
|
23
|
+
".gitignore",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md",
|
|
26
|
+
"Rakefile",
|
|
27
|
+
"TODO",
|
|
28
|
+
"VERSION.yml",
|
|
29
|
+
"lib/rack-mobile-detect.rb",
|
|
30
|
+
"rack-mobile-detect.gemspec",
|
|
31
|
+
"test/helper.rb",
|
|
32
|
+
"test/test_rack-mobile-detect.rb",
|
|
33
|
+
"util/echo_env.rb"
|
|
34
|
+
]
|
|
35
|
+
s.homepage = %q{http://github.com/talison/rack-mobile-detect}
|
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
37
|
+
s.require_paths = ["lib"]
|
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
|
39
|
+
s.summary = %q{Rack middleware for ruby webapps to detect mobile devices.}
|
|
40
|
+
s.test_files = [
|
|
41
|
+
"test/test_rack-mobile-detect.rb",
|
|
42
|
+
"test/helper.rb"
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
if s.respond_to? :specification_version then
|
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
47
|
+
s.specification_version = 3
|
|
48
|
+
|
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
50
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
|
51
|
+
else
|
|
52
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
53
|
+
end
|
|
54
|
+
else
|
|
55
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
metadata
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rack-mobile-detect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Alison
|
|
8
|
+
- Michael Wood
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
12
|
|
|
12
|
-
date: 2009-10-
|
|
13
|
+
date: 2009-10-30 00:00:00 -04:00
|
|
13
14
|
default_executable:
|
|
14
15
|
dependencies:
|
|
15
16
|
- !ruby/object:Gem::Dependency
|
|
@@ -43,6 +44,7 @@ files:
|
|
|
43
44
|
- TODO
|
|
44
45
|
- VERSION.yml
|
|
45
46
|
- lib/rack-mobile-detect.rb
|
|
47
|
+
- rack-mobile-detect.gemspec
|
|
46
48
|
- test/helper.rb
|
|
47
49
|
- test/test_rack-mobile-detect.rb
|
|
48
50
|
- util/echo_env.rb
|