device_detector 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +5 -5
  4. data/lib/device_detector/device.rb +82 -3
  5. data/lib/device_detector/os.rb +4 -2
  6. data/lib/device_detector/parser.rb +1 -1
  7. data/lib/device_detector/version.rb +1 -1
  8. data/lib/device_detector/version_extractor.rb +20 -1
  9. data/regexes/bots.yml +49 -6
  10. data/regexes/client/browsers.yml +170 -16
  11. data/regexes/client/libraries.yml +20 -1
  12. data/regexes/client/mediaplayers.yml +2 -2
  13. data/regexes/client/mobile_apps.yml +447 -13
  14. data/regexes/client/pim.yml +16 -1
  15. data/regexes/device/consoles.yml +7 -1
  16. data/regexes/device/mobiles.yml +3169 -912
  17. data/regexes/device/portable_media_player.yml +16 -6
  18. data/regexes/oss.yml +380 -467
  19. metadata +3 -164
  20. data/.gitignore +0 -14
  21. data/.rubocop.yml +0 -49
  22. data/.ruby-version +0 -1
  23. data/.travis.yml +0 -14
  24. data/Gemfile +0 -8
  25. data/Rakefile +0 -86
  26. data/device_detector.gemspec +0 -27
  27. data/spec/device_detector/bot_fixtures_spec.rb +0 -30
  28. data/spec/device_detector/client_fixtures_spec.rb +0 -31
  29. data/spec/device_detector/concrete_user_agent_spec.rb +0 -123
  30. data/spec/device_detector/detector_fixtures_spec.rb +0 -99
  31. data/spec/device_detector/device_fixtures_spec.rb +0 -36
  32. data/spec/device_detector/device_spec.rb +0 -147
  33. data/spec/device_detector/memory_cache_spec.rb +0 -148
  34. data/spec/device_detector/model_extractor_spec.rb +0 -63
  35. data/spec/device_detector/os_fixtures_spec.rb +0 -26
  36. data/spec/device_detector/version_extractor_spec.rb +0 -79
  37. data/spec/device_detector_spec.rb +0 -189
  38. data/spec/fixtures/client/browser.yml +0 -3935
  39. data/spec/fixtures/client/feed_reader.yml +0 -187
  40. data/spec/fixtures/client/library.yml +0 -253
  41. data/spec/fixtures/client/mediaplayer.yml +0 -193
  42. data/spec/fixtures/client/mobile_app.yml +0 -703
  43. data/spec/fixtures/client/pim.yml +0 -175
  44. data/spec/fixtures/detector/bots.yml +0 -4434
  45. data/spec/fixtures/detector/camera.yml +0 -127
  46. data/spec/fixtures/detector/car_browser.yml +0 -217
  47. data/spec/fixtures/detector/console.yml +0 -343
  48. data/spec/fixtures/detector/desktop.yml +0 -7580
  49. data/spec/fixtures/detector/feature_phone.yml +0 -1597
  50. data/spec/fixtures/detector/feed_reader.yml +0 -524
  51. data/spec/fixtures/detector/mediaplayer.yml +0 -306
  52. data/spec/fixtures/detector/mobile_apps.yml +0 -1233
  53. data/spec/fixtures/detector/peripheral.yml +0 -271
  54. data/spec/fixtures/detector/phablet.yml +0 -7366
  55. data/spec/fixtures/detector/portable_media_player.yml +0 -527
  56. data/spec/fixtures/detector/smart_display.yml +0 -235
  57. data/spec/fixtures/detector/smart_speaker.yml +0 -60
  58. data/spec/fixtures/detector/smartphone-1.yml +0 -9622
  59. data/spec/fixtures/detector/smartphone-10.yml +0 -8981
  60. data/spec/fixtures/detector/smartphone-11.yml +0 -8938
  61. data/spec/fixtures/detector/smartphone-12.yml +0 -8989
  62. data/spec/fixtures/detector/smartphone-13.yml +0 -9412
  63. data/spec/fixtures/detector/smartphone-14.yml +0 -9477
  64. data/spec/fixtures/detector/smartphone-15.yml +0 -9281
  65. data/spec/fixtures/detector/smartphone-16.yml +0 -9678
  66. data/spec/fixtures/detector/smartphone-17.yml +0 -9965
  67. data/spec/fixtures/detector/smartphone-18.yml +0 -9806
  68. data/spec/fixtures/detector/smartphone-19.yml +0 -9965
  69. data/spec/fixtures/detector/smartphone-2.yml +0 -12242
  70. data/spec/fixtures/detector/smartphone-20.yml +0 -9710
  71. data/spec/fixtures/detector/smartphone-21.yml +0 -8693
  72. data/spec/fixtures/detector/smartphone-22.yml +0 -10178
  73. data/spec/fixtures/detector/smartphone-23.yml +0 -9453
  74. data/spec/fixtures/detector/smartphone-24.yml +0 -9843
  75. data/spec/fixtures/detector/smartphone-25.yml +0 -9703
  76. data/spec/fixtures/detector/smartphone-26.yml +0 -10007
  77. data/spec/fixtures/detector/smartphone-27.yml +0 -4927
  78. data/spec/fixtures/detector/smartphone-3.yml +0 -9909
  79. data/spec/fixtures/detector/smartphone-4.yml +0 -8954
  80. data/spec/fixtures/detector/smartphone-5.yml +0 -8981
  81. data/spec/fixtures/detector/smartphone-6.yml +0 -8948
  82. data/spec/fixtures/detector/smartphone-7.yml +0 -8975
  83. data/spec/fixtures/detector/smartphone-8.yml +0 -9810
  84. data/spec/fixtures/detector/smartphone-9.yml +0 -8925
  85. data/spec/fixtures/detector/smartphone.yml +0 -9001
  86. data/spec/fixtures/detector/tablet-1.yml +0 -10155
  87. data/spec/fixtures/detector/tablet-2.yml +0 -9064
  88. data/spec/fixtures/detector/tablet-3.yml +0 -9035
  89. data/spec/fixtures/detector/tablet-4.yml +0 -9062
  90. data/spec/fixtures/detector/tablet-5.yml +0 -9273
  91. data/spec/fixtures/detector/tablet-6.yml +0 -4588
  92. data/spec/fixtures/detector/tablet.yml +0 -8979
  93. data/spec/fixtures/detector/tv-1.yml +0 -2501
  94. data/spec/fixtures/detector/tv.yml +0 -10045
  95. data/spec/fixtures/detector/unknown.yml +0 -3071
  96. data/spec/fixtures/detector/wearable.yml +0 -915
  97. data/spec/fixtures/device/camera.yml +0 -19
  98. data/spec/fixtures/device/car_browser.yml +0 -13
  99. data/spec/fixtures/device/console.yml +0 -79
  100. data/spec/fixtures/device/notebook.yml +0 -7
  101. data/spec/fixtures/parser/oss.yml +0 -2418
  102. data/spec/fixtures/parser/vendorfragments.yml +0 -168
  103. data/spec/spec_helper.rb +0 -9
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mati Sójka
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-11-01 00:00:00.000000000 Z
12
+ date: 2022-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -75,16 +75,9 @@ executables: []
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - ".gitignore"
79
- - ".rubocop.yml"
80
- - ".ruby-version"
81
- - ".travis.yml"
82
78
  - CHANGELOG.md
83
- - Gemfile
84
79
  - LICENSE.txt
85
80
  - README.md
86
- - Rakefile
87
- - device_detector.gemspec
88
81
  - lib/device_detector.rb
89
82
  - lib/device_detector/bot.rb
90
83
  - lib/device_detector/browser.rb
@@ -116,83 +109,6 @@ files:
116
109
  - regexes/device/televisions.yml
117
110
  - regexes/oss.yml
118
111
  - regexes/vendorfragments.yml
119
- - spec/device_detector/bot_fixtures_spec.rb
120
- - spec/device_detector/client_fixtures_spec.rb
121
- - spec/device_detector/concrete_user_agent_spec.rb
122
- - spec/device_detector/detector_fixtures_spec.rb
123
- - spec/device_detector/device_fixtures_spec.rb
124
- - spec/device_detector/device_spec.rb
125
- - spec/device_detector/memory_cache_spec.rb
126
- - spec/device_detector/model_extractor_spec.rb
127
- - spec/device_detector/os_fixtures_spec.rb
128
- - spec/device_detector/version_extractor_spec.rb
129
- - spec/device_detector_spec.rb
130
- - spec/fixtures/client/browser.yml
131
- - spec/fixtures/client/feed_reader.yml
132
- - spec/fixtures/client/library.yml
133
- - spec/fixtures/client/mediaplayer.yml
134
- - spec/fixtures/client/mobile_app.yml
135
- - spec/fixtures/client/pim.yml
136
- - spec/fixtures/detector/bots.yml
137
- - spec/fixtures/detector/camera.yml
138
- - spec/fixtures/detector/car_browser.yml
139
- - spec/fixtures/detector/console.yml
140
- - spec/fixtures/detector/desktop.yml
141
- - spec/fixtures/detector/feature_phone.yml
142
- - spec/fixtures/detector/feed_reader.yml
143
- - spec/fixtures/detector/mediaplayer.yml
144
- - spec/fixtures/detector/mobile_apps.yml
145
- - spec/fixtures/detector/peripheral.yml
146
- - spec/fixtures/detector/phablet.yml
147
- - spec/fixtures/detector/portable_media_player.yml
148
- - spec/fixtures/detector/smart_display.yml
149
- - spec/fixtures/detector/smart_speaker.yml
150
- - spec/fixtures/detector/smartphone-1.yml
151
- - spec/fixtures/detector/smartphone-10.yml
152
- - spec/fixtures/detector/smartphone-11.yml
153
- - spec/fixtures/detector/smartphone-12.yml
154
- - spec/fixtures/detector/smartphone-13.yml
155
- - spec/fixtures/detector/smartphone-14.yml
156
- - spec/fixtures/detector/smartphone-15.yml
157
- - spec/fixtures/detector/smartphone-16.yml
158
- - spec/fixtures/detector/smartphone-17.yml
159
- - spec/fixtures/detector/smartphone-18.yml
160
- - spec/fixtures/detector/smartphone-19.yml
161
- - spec/fixtures/detector/smartphone-2.yml
162
- - spec/fixtures/detector/smartphone-20.yml
163
- - spec/fixtures/detector/smartphone-21.yml
164
- - spec/fixtures/detector/smartphone-22.yml
165
- - spec/fixtures/detector/smartphone-23.yml
166
- - spec/fixtures/detector/smartphone-24.yml
167
- - spec/fixtures/detector/smartphone-25.yml
168
- - spec/fixtures/detector/smartphone-26.yml
169
- - spec/fixtures/detector/smartphone-27.yml
170
- - spec/fixtures/detector/smartphone-3.yml
171
- - spec/fixtures/detector/smartphone-4.yml
172
- - spec/fixtures/detector/smartphone-5.yml
173
- - spec/fixtures/detector/smartphone-6.yml
174
- - spec/fixtures/detector/smartphone-7.yml
175
- - spec/fixtures/detector/smartphone-8.yml
176
- - spec/fixtures/detector/smartphone-9.yml
177
- - spec/fixtures/detector/smartphone.yml
178
- - spec/fixtures/detector/tablet-1.yml
179
- - spec/fixtures/detector/tablet-2.yml
180
- - spec/fixtures/detector/tablet-3.yml
181
- - spec/fixtures/detector/tablet-4.yml
182
- - spec/fixtures/detector/tablet-5.yml
183
- - spec/fixtures/detector/tablet-6.yml
184
- - spec/fixtures/detector/tablet.yml
185
- - spec/fixtures/detector/tv-1.yml
186
- - spec/fixtures/detector/tv.yml
187
- - spec/fixtures/detector/unknown.yml
188
- - spec/fixtures/detector/wearable.yml
189
- - spec/fixtures/device/camera.yml
190
- - spec/fixtures/device/car_browser.yml
191
- - spec/fixtures/device/console.yml
192
- - spec/fixtures/device/notebook.yml
193
- - spec/fixtures/parser/oss.yml
194
- - spec/fixtures/parser/vendorfragments.yml
195
- - spec/spec_helper.rb
196
112
  homepage: http://podigee.github.io/device_detector
197
113
  licenses:
198
114
  - LGPL-3.0
@@ -216,81 +132,4 @@ rubygems_version: 3.0.3
216
132
  signing_key:
217
133
  specification_version: 4
218
134
  summary: Precise and fast user agent parser and device detector
219
- test_files:
220
- - spec/device_detector/bot_fixtures_spec.rb
221
- - spec/device_detector/client_fixtures_spec.rb
222
- - spec/device_detector/concrete_user_agent_spec.rb
223
- - spec/device_detector/detector_fixtures_spec.rb
224
- - spec/device_detector/device_fixtures_spec.rb
225
- - spec/device_detector/device_spec.rb
226
- - spec/device_detector/memory_cache_spec.rb
227
- - spec/device_detector/model_extractor_spec.rb
228
- - spec/device_detector/os_fixtures_spec.rb
229
- - spec/device_detector/version_extractor_spec.rb
230
- - spec/device_detector_spec.rb
231
- - spec/fixtures/client/browser.yml
232
- - spec/fixtures/client/feed_reader.yml
233
- - spec/fixtures/client/library.yml
234
- - spec/fixtures/client/mediaplayer.yml
235
- - spec/fixtures/client/mobile_app.yml
236
- - spec/fixtures/client/pim.yml
237
- - spec/fixtures/detector/bots.yml
238
- - spec/fixtures/detector/camera.yml
239
- - spec/fixtures/detector/car_browser.yml
240
- - spec/fixtures/detector/console.yml
241
- - spec/fixtures/detector/desktop.yml
242
- - spec/fixtures/detector/feature_phone.yml
243
- - spec/fixtures/detector/feed_reader.yml
244
- - spec/fixtures/detector/mediaplayer.yml
245
- - spec/fixtures/detector/mobile_apps.yml
246
- - spec/fixtures/detector/peripheral.yml
247
- - spec/fixtures/detector/phablet.yml
248
- - spec/fixtures/detector/portable_media_player.yml
249
- - spec/fixtures/detector/smart_display.yml
250
- - spec/fixtures/detector/smart_speaker.yml
251
- - spec/fixtures/detector/smartphone-1.yml
252
- - spec/fixtures/detector/smartphone-10.yml
253
- - spec/fixtures/detector/smartphone-11.yml
254
- - spec/fixtures/detector/smartphone-12.yml
255
- - spec/fixtures/detector/smartphone-13.yml
256
- - spec/fixtures/detector/smartphone-14.yml
257
- - spec/fixtures/detector/smartphone-15.yml
258
- - spec/fixtures/detector/smartphone-16.yml
259
- - spec/fixtures/detector/smartphone-17.yml
260
- - spec/fixtures/detector/smartphone-18.yml
261
- - spec/fixtures/detector/smartphone-19.yml
262
- - spec/fixtures/detector/smartphone-2.yml
263
- - spec/fixtures/detector/smartphone-20.yml
264
- - spec/fixtures/detector/smartphone-21.yml
265
- - spec/fixtures/detector/smartphone-22.yml
266
- - spec/fixtures/detector/smartphone-23.yml
267
- - spec/fixtures/detector/smartphone-24.yml
268
- - spec/fixtures/detector/smartphone-25.yml
269
- - spec/fixtures/detector/smartphone-26.yml
270
- - spec/fixtures/detector/smartphone-27.yml
271
- - spec/fixtures/detector/smartphone-3.yml
272
- - spec/fixtures/detector/smartphone-4.yml
273
- - spec/fixtures/detector/smartphone-5.yml
274
- - spec/fixtures/detector/smartphone-6.yml
275
- - spec/fixtures/detector/smartphone-7.yml
276
- - spec/fixtures/detector/smartphone-8.yml
277
- - spec/fixtures/detector/smartphone-9.yml
278
- - spec/fixtures/detector/smartphone.yml
279
- - spec/fixtures/detector/tablet-1.yml
280
- - spec/fixtures/detector/tablet-2.yml
281
- - spec/fixtures/detector/tablet-3.yml
282
- - spec/fixtures/detector/tablet-4.yml
283
- - spec/fixtures/detector/tablet-5.yml
284
- - spec/fixtures/detector/tablet-6.yml
285
- - spec/fixtures/detector/tablet.yml
286
- - spec/fixtures/detector/tv-1.yml
287
- - spec/fixtures/detector/tv.yml
288
- - spec/fixtures/detector/unknown.yml
289
- - spec/fixtures/detector/wearable.yml
290
- - spec/fixtures/device/camera.yml
291
- - spec/fixtures/device/car_browser.yml
292
- - spec/fixtures/device/console.yml
293
- - spec/fixtures/device/notebook.yml
294
- - spec/fixtures/parser/oss.yml
295
- - spec/fixtures/parser/vendorfragments.yml
296
- - spec/spec_helper.rb
135
+ test_files: []
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.rubocop.yml DELETED
@@ -1,49 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
- Exclude:
4
- - 'db/schema.rb'
5
- - 'Gemfile'
6
- - 'bin/'
7
- Style/Documentation:
8
- Enabled: false
9
- Style/EmptyMethod:
10
- EnforcedStyle: expanded
11
- Style/HashEachMethods:
12
- Enabled: true
13
- Style/HashTransformKeys:
14
- Enabled: true
15
- Style/HashTransformValues:
16
- Enabled: true
17
- Style/RedundantRegexpCharacterClass:
18
- Enabled: true
19
- Style/RedundantRegexpEscape:
20
- Enabled: true
21
- Style/StructInheritance:
22
- Enabled: false
23
- Style/ExponentialNotation:
24
- Enabled: true
25
- Style/SlicingWithRange:
26
- Enabled: true
27
- Layout/EmptyLinesAroundAttributeAccessor:
28
- Enabled: true
29
- Layout/LineLength:
30
- Max: 100
31
- Layout/SpaceAroundMethodCallOperator:
32
- Enabled: true
33
- Metrics/MethodLength:
34
- Max: 15
35
- Metrics/BlockLength:
36
- Exclude:
37
- - 'Rakefile'
38
- - '**/*.rake'
39
- - 'spec/**/*.rb'
40
- Lint/DeprecatedOpenSSLConstant:
41
- Enabled: true
42
- Lint/MixedRegexpCaptureTypes:
43
- Enabled: true
44
- Lint/RedundantCopDisableDirective:
45
- Enabled: false
46
- Lint/RaiseException:
47
- Enabled: true
48
- Lint/StructNewOverride:
49
- Enabled: true
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.6.6
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- dist: bionic
3
- rvm:
4
- - 2.4
5
- - 2.5
6
- - 2.6
7
- before_install:
8
- - gem update --system
9
- - gem --version
10
- - gem update bundler
11
- - bundle --version
12
- cache: bundler
13
- script:
14
- bundle exec rake test
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in device_detector.gemspec
4
- gemspec
5
-
6
- if RUBY_VERSION >= "2.0" && defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby"
7
- gem 'byebug'
8
- end
data/Rakefile DELETED
@@ -1,86 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rake'
4
- require 'rake/testtask'
5
-
6
- $LOAD_PATH.unshift 'lib'
7
- require 'device_detector'
8
-
9
- Rake::TestTask.new do |t|
10
- t.pattern = 'spec/**/*_spec.rb'
11
- t.libs.push 'spec'
12
- end
13
-
14
- task default: :test
15
-
16
- desc 'generate detectable names output for README'
17
- task :detectable_names do
18
- require 'date'
19
-
20
- bot_names = DeviceDetector::Bot.new('').send(:regexes)
21
- .map { |r| r[:name] }.uniq.sort_by(&:downcase)
22
- bot_names.delete('$1')
23
- client_names = DeviceDetector::Client.new('').send(:regexes)
24
- .map { |r| r[:name] }.uniq.sort_by(&:downcase)
25
- client_names.delete('$1')
26
- device = DeviceDetector::Device.new('')
27
- device_paths = device.send(:filepaths)
28
- device_regexes = device.send(:load_regexes, device_paths)
29
- device_names = device_regexes.flat_map { |dn| dn[1].keys }.uniq.sort_by(&:downcase)
30
-
31
- today = Date.today.strftime
32
-
33
- puts '## Detectable clients, bots and devices'
34
- puts
35
- puts "Updated on #{today}"
36
- puts
37
- puts '### Bots'
38
- puts
39
- puts bot_names.join(', ')
40
- puts
41
- puts '### Clients'
42
- puts
43
- puts client_names.join(', ')
44
- puts
45
- puts '### Devices'
46
- puts
47
- puts device_names.join(', ')
48
- puts
49
- end
50
-
51
- PIWIK_REPO_URL = 'https://github.com/matomo-org/device-detector'
52
- PIWIK_CHECKOUT_LOCATION = '/tmp/matomo_device_detector'
53
-
54
- def get_latest_piwik_checkout
55
- if File.exist?(PIWIK_CHECKOUT_LOCATION)
56
- system "cd #{PIWIK_CHECKOUT_LOCATION}; git reset --hard HEAD; git pull origin master"
57
- else
58
- system "git clone --depth 1 #{PIWIK_REPO_URL} #{PIWIK_CHECKOUT_LOCATION}"
59
- end
60
- end
61
-
62
- desc 'update regex database from piwik project'
63
- task :update_regexes do
64
- top = File.expand_path(__dir__)
65
- get_latest_piwik_checkout
66
- system "cp -R #{PIWIK_CHECKOUT_LOCATION}/regexes/* #{top}/regexes"
67
- end
68
-
69
- desc 'update fixtures from piwik project'
70
- task :update_fixtures do
71
- top = File.expand_path(__dir__)
72
- get_latest_piwik_checkout
73
-
74
- fixture_mappings = [
75
- { target_path: "#{top}/spec/fixtures/detector", source_path: 'Tests/fixtures/*.yml' },
76
- { target_path: "#{top}/spec/fixtures/client", source_path: 'Tests/Parser/Client/fixtures/*.yml' },
77
- { target_path: "#{top}/spec/fixtures/parser", source_path: 'Tests/Parser/fixtures/*.yml' },
78
- { target_path: "#{top}/spec/fixtures/device", source_path: 'Tests/Parser/Devices/fixtures/*.yml' }
79
- ]
80
-
81
- fixture_mappings.each do |mapping|
82
- source_path = mapping.fetch(:source_path)
83
- target_path = mapping.fetch(:target_path)
84
- system "cp -R #{PIWIK_CHECKOUT_LOCATION}/#{source_path} #{target_path}"
85
- end
86
- end
@@ -1,27 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'device_detector/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'device_detector'
8
- spec.version = DeviceDetector::VERSION
9
- spec.authors = ['Mati Sójka', 'Ben Zimmer']
10
- spec.email = ['yagooar@gmail.com']
11
- spec.summary = %q{Precise and fast user agent parser and device detector}
12
- spec.description = %q{Precise and fast user agent parser and device detector, backed by the largest and most up-to-date agent and device database}
13
- spec.homepage = 'http://podigee.github.io/device_detector'
14
- spec.license = 'LGPL-3.0'
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = []
18
- spec.test_files = spec.files.grep(%r{^(spec)/})
19
- spec.require_paths = ['lib']
20
-
21
- spec.required_ruby_version = '>= 1.9.3'
22
-
23
- spec.add_development_dependency 'minitest'
24
- spec.add_development_dependency 'rake'
25
- spec.add_development_dependency 'pry', '>= 0.10'
26
- spec.add_development_dependency 'rubocop', '0.85.1'
27
- end
@@ -1,30 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- describe DeviceDetector::Bot do
4
-
5
- fixture_dir = File.expand_path('../../fixtures/parser', __FILE__)
6
- fixture_files = Dir["#{fixture_dir}/bots.yml"]
7
- fixture_files.each do |fixture_file|
8
-
9
- describe File.basename(fixture_file) do
10
-
11
- fixtures = YAML.load_file(fixture_file)
12
-
13
- fixtures.each do |f|
14
- user_agent = f["user_agent"]
15
- bot = DeviceDetector::Bot.new(user_agent)
16
-
17
- describe user_agent do
18
- it "should be a bot" do
19
- assert bot.bot?, "isn't a bot"
20
- end
21
-
22
- it "should have the expected name" do
23
- assert_equal f["bot"]["name"], bot.name, "failed bot name detection"
24
- end
25
- end
26
-
27
- end
28
- end
29
- end
30
- end
@@ -1,31 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- describe DeviceDetector::Client do
4
-
5
- fixture_dir = File.expand_path('../../fixtures/client', __FILE__)
6
- fixture_files = Dir["#{fixture_dir}/*.yml"]
7
- fixture_files.each do |fixture_file|
8
-
9
- describe File.basename(fixture_file) do
10
-
11
- fixtures = YAML.load_file(fixture_file)
12
- fixtures.each do |f|
13
-
14
- user_agent = f["user_agent"]
15
- client = DeviceDetector::Client.new(user_agent)
16
-
17
- describe user_agent do
18
-
19
- it "should be known" do
20
- assert client.known?, "isn't known as a client"
21
- end
22
-
23
- it "should have the expected name" do
24
- assert_equal f["client"]["name"], client.name, "failed client name detection"
25
- end
26
-
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,123 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- describe DeviceDetector do
4
- subject { DeviceDetector.new(user_agent) }
5
-
6
- alias_method :client, :subject
7
-
8
- describe 'mobile iPhone 5S' do
9
- let(:user_agent) do
10
- 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_1_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B440 [FBDV/iPhone6,1]'
11
- end
12
-
13
- describe '#device_name' do
14
- it 'returns device name' do
15
- value(client.device_name).must_equal 'iPhone 5S'
16
- end
17
- end
18
-
19
- describe '#device_type' do
20
- it 'returns the device type' do
21
- value(client.device_type).must_equal 'smartphone'
22
- end
23
- end
24
- end
25
-
26
- describe 'Ubuntu 10' do
27
- let(:user_agent) do
28
- 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Ubuntu/10.10 Chromium/10.0.648.133 Chrome/10.0.648.133 Safari/534.16'
29
- end
30
-
31
- describe '#os_name' do
32
- it 'returns the OS name' do
33
- value(client.os_name).must_equal 'Ubuntu'
34
- end
35
- end
36
- end
37
-
38
- describe 'Mac OS X' do
39
- let(:user_agent) do
40
- 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36'
41
- end
42
-
43
- describe '#full_version' do
44
- it 'returns the correct OS version' do
45
- value(client.os_full_version).must_equal '10.10.1'
46
- end
47
- end
48
- end
49
-
50
- describe 'Chrome on Windows' do
51
- describe '32bit' do
52
- let(:user_agent) do
53
- 'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36'
54
- end
55
-
56
- it 'returns the correct client name' do
57
- value(client.name).must_equal 'Chrome'
58
- end
59
-
60
- it 'recognizes the device name' do
61
- value(client.device_name).must_be_nil
62
- end
63
-
64
- it 'recognizes the device type' do
65
- value(client.device_type).must_equal 'desktop'
66
- end
67
- end
68
-
69
- describe '64bit' do
70
- let(:user_agent) do
71
- 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36'
72
- end
73
-
74
- it 'returns the correct client name' do
75
- value(client.name).must_equal 'Chrome'
76
- end
77
-
78
- it 'recognizes the device name' do
79
- value(client.device_name).must_be_nil
80
- end
81
-
82
- it 'recognizes the device type' do
83
- value(client.device_type).must_equal 'desktop'
84
- end
85
- end
86
- end
87
-
88
- describe 'recognize and ignore sprd- prefix' do
89
- let(:user_agent) do
90
- 'sprd-Galaxy-S5/1.0 Linux/2.6.35.7 Android/4.4.4 Release/11.29.2014 Browser/AppleWebKit533.1 (KHTML, like Gecko) Mozilla/5.0 Mobile'
91
- end
92
-
93
- it 'returns the correct client name' do
94
- value(client.name).must_equal 'Android Browser'
95
- end
96
-
97
- it 'recognizes the device name' do
98
- value(client.device_name).must_equal 'Galaxy S5'
99
- end
100
-
101
- it 'recognizes the device type' do
102
- value(client.device_type).must_equal 'smartphone'
103
- end
104
- end
105
-
106
- describe 'remove TD suffix from model' do
107
- let(:user_agent) do
108
- 'Lenovo-A398t+_TD/S100 Linux/3.4.5 Android/4.1.2 Release/09.10.2013 Browser/AppleWebKit534.30 Mobile Safari/534.30'
109
- end
110
-
111
- it 'returns the correct client name' do
112
- value(client.name).must_equal 'Android Browser'
113
- end
114
-
115
- it 'recognizes the device name' do
116
- value(client.device_name).must_equal 'A398t+'
117
- end
118
-
119
- it 'recognizes the device type' do
120
- value(client.device_type).must_equal 'smartphone'
121
- end
122
- end
123
- end