wurfl 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/lib/wurfl/user_agent_matcher.rb +6 -6
- data/wurfl.gemspec +4 -4
- metadata +25 -9
data/Rakefile
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
require 'rake/rdoctask'
|
2
2
|
require 'rake/testtask'
|
3
|
-
require 'rubygems'
|
3
|
+
require 'rubygems' if RUBY_VERSION < "1.9"
|
4
4
|
require 'shoulda/tasks'
|
5
5
|
|
6
6
|
task :default => ['test']
|
7
7
|
|
8
8
|
Rake::TestTask.new(:test) do |t|
|
9
9
|
t.test_files = FileList['test/*_test.rb']
|
10
|
-
t.ruby_opts = ['-
|
10
|
+
t.ruby_opts = ['-I"."']
|
11
|
+
t.ruby_opts = ['-rubygems'] if RUBY_VERSION < "1.9" && defined? Gem
|
11
12
|
end
|
12
13
|
|
13
14
|
begin
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.6
|
@@ -28,6 +28,10 @@ class Wurfl::UserAgentMatcher
|
|
28
28
|
hand.user_agent.length > m ? hand.user_agent.length : m
|
29
29
|
end
|
30
30
|
@d=(0..@longest_user_agent_length).to_a
|
31
|
+
@unpack_rule = 'C*'
|
32
|
+
if RUBY_VERSION < "1.9"
|
33
|
+
@unpack_rule = ($KCODE =~ /^U/i) ? 'U*' : 'C*'
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
# A method to retrieve a list of the uamatcher's handsets that match
|
@@ -41,7 +45,7 @@ class Wurfl::UserAgentMatcher
|
|
41
45
|
def match_handsets(user_agent)
|
42
46
|
rez = []
|
43
47
|
shortest_distance = [user_agent.length, @longest_user_agent_length].max
|
44
|
-
s = user_agent.unpack(unpack_rule)
|
48
|
+
s = user_agent.unpack(@unpack_rule)
|
45
49
|
|
46
50
|
@handsets.values.each do |hand|
|
47
51
|
distance = levenshtein_distance(user_agent, hand.user_agent, shortest_distance, s)
|
@@ -87,7 +91,7 @@ class Wurfl::UserAgentMatcher
|
|
87
91
|
diff = (str1.length - str2.length).abs
|
88
92
|
return 0 if diff == 0 && str1 == str2
|
89
93
|
return diff if diff > min
|
90
|
-
t = str2.unpack(unpack_rule)
|
94
|
+
t = str2.unpack(@unpack_rule)
|
91
95
|
distance(s, t, min)
|
92
96
|
end
|
93
97
|
|
@@ -135,8 +139,4 @@ class Wurfl::UserAgentMatcher
|
|
135
139
|
end
|
136
140
|
x
|
137
141
|
end
|
138
|
-
|
139
|
-
def unpack_rule
|
140
|
-
$KCODE =~ /^U/i ? 'U*' : 'C*'
|
141
|
-
end
|
142
142
|
end
|
data/wurfl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{wurfl}
|
8
|
-
s.version = "1.3.
|
8
|
+
s.version = "1.3.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Paul McMahon", "Zev Blut"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-24}
|
13
13
|
s.default_executable = %q{wurfltools.rb}
|
14
14
|
s.description = %q{Library and tools for manipulating the WURFL}
|
15
15
|
s.email = %q{info@mobalean.com}
|
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.rdoc_options = ["--charset=UTF-8"]
|
55
55
|
s.require_paths = ["lib"]
|
56
56
|
s.rubyforge_project = %q{wurfl}
|
57
|
-
s.rubygems_version = %q{1.3.
|
57
|
+
s.rubygems_version = %q{1.3.7}
|
58
58
|
s.summary = %q{Library and tools for manipulating the WURFL}
|
59
59
|
s.test_files = [
|
60
60
|
"test/benchmark.rb",
|
@@ -69,7 +69,7 @@ Gem::Specification.new do |s|
|
|
69
69
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
70
70
|
s.specification_version = 3
|
71
71
|
|
72
|
-
if Gem::Version.new(Gem::
|
72
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
73
73
|
s.add_runtime_dependency(%q<libxml-ruby>, [">= 0"])
|
74
74
|
else
|
75
75
|
s.add_dependency(%q<libxml-ruby>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wurfl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 6
|
10
|
+
version: 1.3.6
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Paul McMahon
|
@@ -10,19 +16,23 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date: 2010-
|
19
|
+
date: 2010-09-24 00:00:00 +09:00
|
14
20
|
default_executable: wurfltools.rb
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: libxml-ruby
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
21
27
|
requirements:
|
22
28
|
- - ">="
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
24
33
|
version: "0"
|
25
|
-
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
26
36
|
description: Library and tools for manipulating the WURFL
|
27
37
|
email: info@mobalean.com
|
28
38
|
executables:
|
@@ -73,21 +83,27 @@ rdoc_options:
|
|
73
83
|
require_paths:
|
74
84
|
- lib
|
75
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
76
87
|
requirements:
|
77
88
|
- - ">="
|
78
89
|
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
79
93
|
version: "0"
|
80
|
-
version:
|
81
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
82
96
|
requirements:
|
83
97
|
- - ">="
|
84
98
|
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
85
102
|
version: "0"
|
86
|
-
version:
|
87
103
|
requirements: []
|
88
104
|
|
89
105
|
rubyforge_project: wurfl
|
90
|
-
rubygems_version: 1.3.
|
106
|
+
rubygems_version: 1.3.7
|
91
107
|
signing_key:
|
92
108
|
specification_version: 3
|
93
109
|
summary: Library and tools for manipulating the WURFL
|