rack-mobile-detect 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,11 @@
1
+ ### 0.3.0: Mar 12, 2011 ###
2
+ * Modified catch-all based: https://github.com/brendanlim/mobile-fu
3
+
1
4
  ### 0.2.0: Mar 14, 2010 ###
2
5
  * Added redirect_to option from github.com/joren
3
6
  * Added redirect_map option
4
7
  * Added dependency on rack
5
8
  * Added more test for redirect options
6
- * Renamed rb file to mobile-detect.rb
9
+ * Updated dir structure: lib/rack-mobile-detect.rb -> lib/rack/mobile-detect.rb
10
+ * Added note on require syntax: require 'rack/mobile-detect'
7
11
  * Updated tests, echo_env.rb to reference new file
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  Install
2
2
  =======
3
3
 
4
- sudo gem install rack-mobile-detect -s http://gemcutter.org
4
+ sudo gem install rack-mobile-detect
5
5
 
6
6
  In your code:
7
7
 
8
- require 'rack-mobile-detect'
8
+ require 'rack/mobile-detect'
9
9
 
10
10
  Overview
11
11
  ========
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
4
3
  :build:
4
+ :minor: 3
5
5
  :patch: 0
@@ -117,12 +117,12 @@ module Rack
117
117
 
118
118
  # From mobile-fu: http://github.com/brendanlim/mobile-fu
119
119
  @regex_ua_catchall = options[:catchall] ||
120
- Regexp.new('palm|palmos|palmsource|iphone|blackberry|nokia|phone|midp|mobi|pda|' +
121
- 'wap|java|nokia|hand|symbian|chtml|wml|ericsson|lg|audiovox|motorola|' +
122
- 'samsung|sanyo|sharp|telit|tsm|mobile|mini|windows ce|smartphone|' +
123
- '240x320|320x320|mobileexplorer|j2me|sgh|portable|sprint|vodafone|' +
124
- 'docomo|kddi|softbank|pdxgw|j-phone|astel|minimo|plucker|netfront|' +
125
- 'xiino|mot-v|mot-e|portalmmm|sagem|sie-s|sie-m|android|ipod', true)
120
+ Regexp.new('palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' +
121
+ 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' +
122
+ 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' +
123
+ 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' +
124
+ 'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' +
125
+ 'mobile', true)
126
126
 
127
127
  # A URL that specifies a single redirect-url for any device
128
128
  @redirect_to = options[:redirect_to]
@@ -1,54 +1,51 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-mobile-detect}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tom Alison"]
12
- s.date = %q{2010-03-14}
12
+ s.date = %q{2011-03-12}
13
13
  s.description = %q{Rack::MobileDetect detects mobile devices and adds an
14
14
  X_MOBILE_DEVICE header to the request if a mobile device is detected. Specific
15
15
  devices can be targeted with custom Regexps and redirect support is available.}
16
16
  s.email = %q{accounts@majortom.fastmail.us}
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
- "README.md",
20
- "TODO"
19
+ "README.md",
20
+ "TODO"
21
21
  ]
22
22
  s.files = [
23
23
  ".document",
24
- ".gitignore",
25
- "CHANGELOG.md",
26
- "LICENSE",
27
- "README.md",
28
- "Rakefile",
29
- "TODO",
30
- "VERSION.yml",
31
- "lib/rack/mobile-detect.rb",
32
- "rack-mobile-detect.gemspec",
33
- "test/helper.rb",
34
- "test/test_rack-mobile-detect.rb",
35
- "util/echo_env.rb"
24
+ "CHANGELOG.md",
25
+ "LICENSE",
26
+ "README.md",
27
+ "Rakefile",
28
+ "TODO",
29
+ "VERSION.yml",
30
+ "lib/rack/mobile-detect.rb",
31
+ "rack-mobile-detect.gemspec",
32
+ "test/helper.rb",
33
+ "test/test_rack-mobile-detect.rb",
34
+ "util/echo_env.rb"
36
35
  ]
37
36
  s.homepage = %q{http://github.com/talison/rack-mobile-detect}
38
- s.rdoc_options = ["--charset=UTF-8"]
39
37
  s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.3.5}
38
+ s.rubygems_version = %q{1.6.2}
41
39
  s.summary = %q{Rack middleware for ruby webapps to detect mobile devices.}
42
40
  s.test_files = [
43
41
  "test/helper.rb",
44
- "test/test_rack-mobile-detect.rb"
42
+ "test/test_rack-mobile-detect.rb"
45
43
  ]
46
44
 
47
45
  if s.respond_to? :specification_version then
48
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
46
  s.specification_version = 3
50
47
 
51
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
48
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
49
  s.add_development_dependency(%q<shoulda>, [">= 0"])
53
50
  s.add_runtime_dependency(%q<rack>, [">= 0"])
54
51
  else
@@ -71,6 +71,10 @@ class TestRackMobileDetect < Test::Unit::TestCase
71
71
  @rack.call(env)
72
72
  assert_equal "true", env[x_mobile]
73
73
 
74
+ env = test_env({ 'HTTP_USER_AGENT' => webos })
75
+ @rack.call(env)
76
+ assert_equal "true", env[x_mobile]
77
+
74
78
  env = test_env({ 'HTTP_USER_AGENT' => 'opera' })
75
79
  @rack.call(env)
76
80
  assert !env.key?(x_mobile)
@@ -234,6 +238,10 @@ class TestRackMobileDetect < Test::Unit::TestCase
234
238
  'Mozilla/4.0 (compatible; MSIE 6.0; BREW 3.1.5; en )/800x480 Samsung SCH-U960'
235
239
  end
236
240
 
241
+ def webos
242
+ 'Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.1'
243
+ end
244
+
237
245
  # Our test web app. Doesn't do anything.
238
246
  def test_app()
239
247
  Class.new { def call(app); true; end }.new
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-mobile-detect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Tom Alison
@@ -9,29 +15,37 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-03-14 00:00:00 -05:00
18
+ date: 2011-03-12 00:00:00 -08:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: shoulda
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
23
32
  version: "0"
24
- version:
33
+ type: :development
34
+ version_requirements: *id001
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: rack
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
30
40
  requirements:
31
41
  - - ">="
32
42
  - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
33
46
  version: "0"
34
- version:
47
+ type: :runtime
48
+ version_requirements: *id002
35
49
  description: |-
36
50
  Rack::MobileDetect detects mobile devices and adds an
37
51
  X_MOBILE_DEVICE header to the request if a mobile device is detected. Specific
@@ -47,7 +61,6 @@ extra_rdoc_files:
47
61
  - TODO
48
62
  files:
49
63
  - .document
50
- - .gitignore
51
64
  - CHANGELOG.md
52
65
  - LICENSE
53
66
  - README.md
@@ -64,26 +77,32 @@ homepage: http://github.com/talison/rack-mobile-detect
64
77
  licenses: []
65
78
 
66
79
  post_install_message:
67
- rdoc_options:
68
- - --charset=UTF-8
80
+ rdoc_options: []
81
+
69
82
  require_paths:
70
83
  - lib
71
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
72
86
  requirements:
73
87
  - - ">="
74
88
  - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
75
92
  version: "0"
76
- version:
77
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
78
95
  requirements:
79
96
  - - ">="
80
97
  - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
81
101
  version: "0"
82
- version:
83
102
  requirements: []
84
103
 
85
104
  rubyforge_project:
86
- rubygems_version: 1.3.5
105
+ rubygems_version: 1.6.2
87
106
  signing_key:
88
107
  specification_version: 3
89
108
  summary: Rack middleware for ruby webapps to detect mobile devices.
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC