wurfl_client 0.5.3 → 0.5.4

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 CHANGED
@@ -34,17 +34,26 @@ WURFL gem (http://github.com/pwim/wurfl): Handset, UserAgentMatcher, WURFL Loade
34
34
  == Setup
35
35
 
36
36
  To setup the environment, you have to execute following steps:
37
- 1.) download and extract the latest WURFL file
37
+ 1.) download and extract the latest WURFL file to wurfl-latest.xml
38
38
 
39
39
  curl -L -o wurfl-latest.xml.gz
40
40
  gunzip wurfl-latest.xml.gz
41
41
 
42
- 2.) minimize the WURFL XML file. You can adapt wurfl_minimize.yml to your needs, see http://wurfl.sourceforge.net/help_doc.php for a list of available capabilities)
42
+ 2.) configure wurfl_minimize.rb by writing a wurfl_minimize.yml like so:
43
+
44
+ input_file: wurfl-latest.xml
45
+ output_file: wurfl-custom.xml
46
+ capabilities: [brand_name, model_name, max_image_width, max_image_height, wta_voice_call]
47
+
48
+ NOTE: You can adapt wurfl_minimize.yml capabilities to your needs. See http://wurfl.sourceforge.net/help_doc.php for a list of available capabilities.
49
+
50
+ 3.) minimize the WURFL XML file.
43
51
 
44
52
  wurfl_minimize.rb
45
-
46
- 3.) prepare the lookup tables (builds them into ./lookup directory by default). This will take some time!
47
53
 
54
+ 4.) prepare the lookup tables (builds them into ./lookup directory by default). This will take some time!
55
+
56
+ mkdir lookup
48
57
  wurfl_prepare_lookup.rb
49
58
 
50
59
  Now, you are ready for device detection. If you make an automated script to do this update regularly, you must not forget to clear the lookup directory first.
@@ -54,7 +63,7 @@ new data after the update is complete.
54
63
  Here is an example automatic update script:
55
64
 
56
65
  #!/bin/sh
57
- curl -L -o wurfl-latest.xml.gz
66
+ curl -L -o wurfl-latest.xml.gz http://sourceforge.net/projects/wurfl/files/WURFL/latest/wurfl-latest.xml.gz/download
58
67
  gunzip wurfl-latest.xml.gz
59
68
  wurfl_minimize.rb
60
69
  rm lookup/*
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
@@ -6,7 +6,7 @@ require "yaml"
6
6
  # This can reduce the lookup store size considerably!
7
7
 
8
8
  default_config = {
9
- 'input_file' => 'wurfl-test.xml',
9
+ 'input_file' => 'wurfl-latest.xml',
10
10
  'output_file' => 'wurfl-default.xml',
11
11
  'capabilities' => ['brand_name', 'model_name', 'max_image_width', 'max_image_height', 'wta_voice_call']
12
12
  }
@@ -6,20 +6,28 @@ module WurflClient
6
6
  class UserAgentDeviceDetector
7
7
 
8
8
  def self.detect(ua_string)
9
- detectIphone(ua_string) || detectOtherMozilla(ua_string) || detectGeneric(ua_string) || DeviceProfile.new(:desktop)
9
+ detectAppleDevices(ua_string) || detectOtherMozilla(ua_string) || detectGeneric(ua_string) || DeviceProfile.new(:desktop)
10
10
  end
11
11
 
12
- private
13
-
14
- def self.detectIphone(ua_string)
12
+ def self.detectAppleDevices(ua_string)
13
+ dev_context = nil
14
+ prefix = ''
15
15
  case ua_string
16
+ when /iPad/
17
+ dev_context = 'ipad'
18
+ prefix = 'ipad'
16
19
  when /iPod/
17
- return DeviceProfile.new('iphone', 'iphone_ipod')
20
+ dev_context = 'iphone'
21
+ prefix = 'ipod'
18
22
  when /iPhone/
23
+ dev_context = 'iphone'
24
+ prefix = 'iphone'
25
+ end
26
+ if dev_context
27
+ # detect OS version
19
28
  os_ver = ua_string[/OS ([0-9_]+)/]
20
- prefix = 'iphone'
21
- prefix += "_#{os_ver[$1]}" if os_ver
22
- return DeviceProfile.new('iphone', prefix)
29
+ prefix += "-OS#{os_ver[$1]}" if os_ver
30
+ return DeviceProfile.new(dev_context, prefix)
23
31
  end
24
32
  end
25
33
 
data/wurfl_client.gemspec CHANGED
@@ -1,56 +1,47 @@
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{wurfl_client}
8
- s.version = "0.5.3"
8
+ s.version = "0.5.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Guido Pinkas"]
12
- s.date = %q{2010-09-28}
11
+ s.authors = [%q{Guido Pinkas}]
12
+ s.date = %q{2011-05-12}
13
13
  s.description = %q{WURFL Client is a library to do WURFL (http://wurfl.sourceforge.net/) mobile device detection for web applications. Included are tools to keep the WURFL file up to date automatically and to prepare a customized lookup tables, which allow a fast device detection.}
14
14
  s.email = %q{guido.pinkas@bindertrittenwein.com}
15
- s.executables = ["wurfl_minimize.rb", "wurfl_prepare_lookup.rb"]
15
+ s.executables = [%q{wurfl_minimize.rb}, %q{wurfl_prepare_lookup.rb}]
16
16
  s.extra_rdoc_files = [
17
17
  "README"
18
18
  ]
19
19
  s.files = [
20
- ".gitignore",
21
- "README",
22
- "Rakefile",
23
- "VERSION",
24
- "bin/wurfl_minimize.rb",
25
- "bin/wurfl_prepare_lookup.rb",
26
- "examples/config.ru",
27
- "lib/wurfl_client.rb",
28
- "lib/wurfl_client/device_profile.rb",
29
- "lib/wurfl_client/lookup_helper.rb",
30
- "lib/wurfl_client/lookup_preparer.rb",
31
- "lib/wurfl_client/ua_device_detector.rb",
32
- "test/data/iphone.pstore",
33
- "test/data/wurfl-test.xml",
34
- "test/device_profile_test.rb",
35
- "test/lookup_helper_test.rb",
36
- "test/ua_device_detector_test.rb",
37
- "test/wurfl_client_test.rb",
38
- "wurfl_client.gemspec"
20
+ "README",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "bin/wurfl_minimize.rb",
24
+ "bin/wurfl_prepare_lookup.rb",
25
+ "examples/config.ru",
26
+ "lib/wurfl_client.rb",
27
+ "lib/wurfl_client/device_profile.rb",
28
+ "lib/wurfl_client/lookup_helper.rb",
29
+ "lib/wurfl_client/lookup_preparer.rb",
30
+ "lib/wurfl_client/ua_device_detector.rb",
31
+ "test/data/iphone.pstore",
32
+ "test/data/wurfl-test.xml",
33
+ "test/device_profile_test.rb",
34
+ "test/lookup_helper_test.rb",
35
+ "test/ua_device_detector_test.rb",
36
+ "test/wurfl_client_test.rb",
37
+ "wurfl_client.gemspec"
39
38
  ]
40
39
  s.homepage = %q{http://github.com/bluecat76/wurfl_client}
41
- s.rdoc_options = ["--charset=UTF-8"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.7}
40
+ s.require_paths = [%q{lib}]
41
+ s.rubygems_version = %q{1.8.2}
44
42
  s.summary = %q{Fast WURFL mobile device detection}
45
- s.test_files = [
46
- "test/lookup_helper_test.rb",
47
- "test/device_profile_test.rb",
48
- "test/wurfl_client_test.rb",
49
- "test/ua_device_detector_test.rb"
50
- ]
51
43
 
52
44
  if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
45
  s.specification_version = 3
55
46
 
56
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wurfl_client
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 5
8
- - 3
9
- version: 0.5.3
4
+ prerelease:
5
+ version: 0.5.4
10
6
  platform: ruby
11
7
  authors:
12
8
  - Guido Pinkas
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-09-28 00:00:00 +02:00
18
- default_executable:
13
+ date: 2011-05-12 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: wurfl
@@ -25,10 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 1
30
- - 3
31
- - 6
32
23
  version: 1.3.6
33
24
  type: :runtime
34
25
  version_requirements: *id001
@@ -42,7 +33,6 @@ extensions: []
42
33
  extra_rdoc_files:
43
34
  - README
44
35
  files:
45
- - .gitignore
46
36
  - README
47
37
  - Rakefile
48
38
  - VERSION
@@ -61,13 +51,12 @@ files:
61
51
  - test/ua_device_detector_test.rb
62
52
  - test/wurfl_client_test.rb
63
53
  - wurfl_client.gemspec
64
- has_rdoc: true
65
54
  homepage: http://github.com/bluecat76/wurfl_client
66
55
  licenses: []
67
56
 
68
57
  post_install_message:
69
- rdoc_options:
70
- - --charset=UTF-8
58
+ rdoc_options: []
59
+
71
60
  require_paths:
72
61
  - lib
73
62
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -75,26 +64,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
64
  requirements:
76
65
  - - ">="
77
66
  - !ruby/object:Gem::Version
78
- segments:
79
- - 0
80
67
  version: "0"
81
68
  required_rubygems_version: !ruby/object:Gem::Requirement
82
69
  none: false
83
70
  requirements:
84
71
  - - ">="
85
72
  - !ruby/object:Gem::Version
86
- segments:
87
- - 0
88
73
  version: "0"
89
74
  requirements: []
90
75
 
91
76
  rubyforge_project:
92
- rubygems_version: 1.3.7
77
+ rubygems_version: 1.8.2
93
78
  signing_key:
94
79
  specification_version: 3
95
80
  summary: Fast WURFL mobile device detection
96
- test_files:
97
- - test/lookup_helper_test.rb
98
- - test/device_profile_test.rb
99
- - test/wurfl_client_test.rb
100
- - test/ua_device_detector_test.rb
81
+ test_files: []
82
+
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- run
2
- pkg
3
- rdoc