Skip to content
Browse files

Initial commit.

  • Loading branch information...
1 parent d93168b commit de056741ab9f196cb55c10b04da6f5d85ab62297 @talison committed Oct 28, 2009
View
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2009 Tom Alison
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
6 README.md
@@ -46,11 +46,11 @@ Note that `Rack::MobileDetect::X_HEADER` holds the string
Usage
=====
- use Rack::MobileDevice
+ use Rack::MobileDetect
This allows you to do mobile device detection with the defaults.
- use Rack::MobileDevice, :targeted => /SCH-\w*$|[Bb]lack[Bb]erry\w*/
+ use Rack::MobileDetect, :targeted => /SCH-\w*$|[Bb]lack[Bb]erry\w*/
In this usage you can set the value of the regular expression used to
target particular devices. This regular expression captures Blackberry
@@ -59,7 +59,7 @@ user-agent: 'BlackBerry9000/4.6.0.167 Profile/MIDP-2.0
Configuration/CLDC-1.1 VendorID/102' connects, the value of
`X_MOBILE_DEVICE` will be set to 'BlackBerry9000'
- use Rack::MobileDevice, :catchall => /mydevice/i
+ use Rack::MobileDetect, :catchall => /mydevice/i
This allows you to limit the catchall expression to only the device
list you choose.
View
2 TODO
@@ -0,0 +1,2 @@
+* Package as a gem
+* Allow options to disable UAProf detection, Accept detection
View
8 lib/mobile-detect.rb → lib/rack-mobile-detect.rb
@@ -67,25 +67,27 @@ module Rack
# 'X_MOBILE_DEVICE' that is inserted into the request headers.
#
# Usage:
- # use Rack::MobileDevice
+ # use Rack::MobileDetect
#
# This allows you to do mobile device detection with the defaults.
#
- # use Rack::MobileDevice, :targeted => /SCH-\w*$|[Bb]lack[Bb]erry\w*/
+ # use Rack::MobileDetect, :targeted => /SCH-\w*$|[Bb]lack[Bb]erry\w*/
#
# In this usage you can set the value of the regular expression used
# to target particular devices. This regular expression captures
# Blackberry and Samsung SCH-* model phones. For example, if a phone
# with the user-agent: 'BlackBerry9000/4.6.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102'
# connects, the value of X_MOBILE_DEVICE will be set to 'BlackBerry9000'
#
- # use Rack::MobileDevice, :catchall => /mydevice/i
+ # use Rack::MobileDetect, :catchall => /mydevice/i
#
# This allows you to limit the catchall expression to only the
# device list you choose.
#
# See the unit test source code for more info.
#
+ # Author: Tom Alison (tom.alison at gmail.com)
+ # License: MIT
#
class MobileDetect
X_HEADER = 'X_MOBILE_DEVICE'
View
4 test/test_mobile_detect.rb → test/rack-mobile-detect_test.rb
@@ -4,9 +4,9 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-require 'mobile-detect'
+require 'rack-mobile-detect'
-class TestMobileDevice < Test::Unit::TestCase
+class TestRackMobileDetect < Test::Unit::TestCase
context "An app with mobile-device defaults" do
setup do
View
2 util/echo_env.rb
@@ -3,7 +3,7 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-require 'mobile-detect'
+require 'rack-mobile-detect'
use Rack::MobileDetect

0 comments on commit de05674

Please sign in to comment.
Something went wrong with that request. Please try again.