aua 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a7bcaf6c058128a7d6ed3c50af05a00e77cf8df8
4
- data.tar.gz: b4f3630969d17792efd3e20c29b2babbc6fb5daa
2
+ SHA256:
3
+ metadata.gz: 900211a4adb2fb31f00f974c4812046e9d66053577a29caa24bc9a98325e6dbc
4
+ data.tar.gz: b4c9cc887f15d7e093c5e81a3b9961331cd674a882cc413bdd526717e86d536f
5
5
  SHA512:
6
- metadata.gz: 1ac1172e83f9030041c332fc8642556fd96ced32e82924c60d82e6f2aa2395cab839a562cb0288c81793e996f8fc6482e0637b57c3644414d4cafcc2bd100d02
7
- data.tar.gz: c6eb775b39b6f190a0e9a4c3a18e0fd2b900b32b37661ab1462ecb26de12943ef906aa8de253497083852d473fb7ad61a28f5abe37ad006c1f52587003b29407
6
+ metadata.gz: 4516385abff4eca5f276517463be74287c42e38a065258b3e0c3a2db7cf20f700e747c4b3feba2ee6eacb604fc49564c795dbb1b90f180180dfa60c60ea45449
7
+ data.tar.gz: af95f1e46838ad354fde9339a964a75a4619c433f1475c7d317027d1d22eda95d9848ea791130a268ee0aa08d61ba300b16844a76f81f077b82650f9bcb732e4
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in aua.gemspec
4
4
  gemspec
5
-
6
- gem "rake"
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
- guard 'rspec' do
1
+ guard :rspec, cmd: "bundle exec rspec" do
2
2
  watch(/^spec\/(.*)_spec\.rb/) { "spec" }
3
3
  watch(/^lib\/(.*)\.rb/) { "spec" } # { |m| "spec/#{m[1]}_spec.rb" }
4
4
  watch(/^spec\/spec_helper\.rb/) { "spec" }
5
- end
5
+ end
data/aua.gemspec CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_development_dependency 'rspec', '~>2.4'
24
- s.add_development_dependency 'guard-rspec', '>=3.0'
25
- s.add_development_dependency 'growl', '>=1.0'
26
- s.add_development_dependency 'rb-fsevent', '>=0.9'
23
+ s.add_development_dependency 'rspec', '>0'
24
+ s.add_development_dependency 'rspec-its', '>0'
25
+ s.add_development_dependency 'guard-rspec', '>0'
27
26
  end
data/bin/_guard-core ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application '_guard-core' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("guard", "_guard-core")
data/bin/guard ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'guard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("guard", "guard")
@@ -1,6 +1,6 @@
1
1
  module Aua::Agents::Chrome
2
2
  def self.extend?(agent)
3
- agent.products.include?("Safari") && agent.products.include?("Chrome") && !agent.products.include?("Edge")
3
+ agent.products.include?("Safari") && agent.products.include?("Chrome")
4
4
  end
5
5
 
6
6
  def type
@@ -32,4 +32,4 @@ module Aua::Agents::Chrome
32
32
  @version ||= version_of("chromeframe")
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -0,0 +1,25 @@
1
+ module Aua::Agents::Edge
2
+ def self.extend?(agent)
3
+ agent.products.include?("Safari") && agent.products.include?("Chrome") && (
4
+ agent.products.include?("Edge") ||
5
+ agent.products.include?("Edg") ||
6
+ agent.products.include?("EdgA")
7
+ )
8
+ end
9
+
10
+ def type
11
+ :Browser
12
+ end
13
+
14
+ def name
15
+ :Edge
16
+ end
17
+
18
+ def version
19
+ @version ||= version_of("Edg") || version_of("Edge") || version_of("EdgA")
20
+ end
21
+
22
+ def major_version
23
+ @major_version ||= (version || "").split('.', 2)[0]
24
+ end
25
+ end
@@ -1,7 +1,7 @@
1
1
  module Aua::Agents::Msie
2
2
 
3
3
  def self.extend?(agent)
4
- agent.app_comments_string =~ PATTERN || agent.products[-1] == "Edge"
4
+ agent.app_comments_string =~ PATTERN
5
5
  end
6
6
 
7
7
  PATTERN = /(MSIE |Trident\/)([\d.]+)/
@@ -26,4 +26,4 @@ module Aua::Agents::Msie
26
26
  end
27
27
  end
28
28
  end
29
- end
29
+ end
data/lib/aua/agents.rb CHANGED
@@ -6,11 +6,11 @@ class Aua
6
6
  extend self
7
7
 
8
8
  def default
9
- @default ||= [HttpChecker, ApiClients, FeedReader, Firefox, Chrome::Frame, Chrome, Safari, Opera, Msie, SearchBot, Konqueror, Others, EngineFallback, OtherBrowsers]
9
+ @default ||= [HttpChecker, ApiClients, FeedReader, Firefox, Edge, Chrome::Frame, Chrome, Safari, Opera, Msie, SearchBot, Konqueror, Others, EngineFallback, OtherBrowsers]
10
10
  end
11
11
  end
12
12
  end
13
13
 
14
14
  Dir["#{File.dirname(__FILE__)}/agents/*.rb"].each do |agent|
15
15
  require(agent)
16
- end
16
+ end
@@ -1,7 +1,7 @@
1
1
  module Aua::OperatingSystems::Android
2
2
 
3
3
  def self.extend?(agent)
4
- agent.platform_string == "Linux" && agent.comments.first && agent.comments.first[2] && agent.comments.first[2].match(PATTERN)
4
+ agent.platform_string == "Linux" && agent.comments.first && agent.comments.first.any?{|c| c.match(PATTERN) }
5
5
  end
6
6
 
7
7
  PATTERN = /^Android\s([\d\.]+)$/
@@ -15,14 +15,14 @@ module Aua::OperatingSystems::Android
15
15
  end
16
16
 
17
17
  def os_version
18
- @os_version ||= comments.first[2] =~ PATTERN && $1
18
+ @os_version ||= comments.first.any?{|c| c.match(PATTERN) } && $1
19
19
  end
20
20
 
21
21
  def name
22
- @name ||= :AndroidWebkit
22
+ @name ||= super || :AndroidWebkit
23
23
  end
24
24
 
25
25
  def version
26
- @version ||= version_of("Version")
26
+ @version ||= super || version_of("Version")
27
27
  end
28
- end
28
+ end
data/lib/aua/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Aua
2
- VERSION = "0.2.6"
2
+ VERSION = "0.3.0"
3
3
  end
data/spec/aua_spec.rb CHANGED
@@ -43,6 +43,10 @@ describe Aua do
43
43
 
44
44
  EXAMPLES = {
45
45
  # Firefox
46
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:94.0) Gecko/20100101 Firefox/94.0" =>
47
+ { :type => :Browser, :name => :Firefox, :version => "94.0", :major_version => "94.0", :os_name => :MacOSX, :os_version => "10.15", :os_major_version => "10.15", :platform => :Macintosh },
48
+ "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0" =>
49
+ { :type => :Browser, :name => :Firefox, :version => "91.0", :major_version => "91.0", :os_name => :Windows, :os_version => "10", :os_major_version => "10", :platform => :Windows },
46
50
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:22.0) Gecko/20100101 Firefox/22.0" =>
47
51
  { :type => :Browser, :name => :Firefox, :version => "22.0", :major_version => "22.0", :os_name => :MacOSX, :os_version => "10.8", :os_major_version => "10.8", :platform => :Macintosh },
48
52
  "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13" =>
@@ -220,13 +224,19 @@ describe Aua do
220
224
  "Opera/9.80 (Linux armv7l; Maemo; Opera Mobi/4; U; de) Presto/2.5.28 Version/10.1" =>
221
225
  { :type => :Browser, :name => :OperaMobile, :version => "10.1", :os_name => :Linux, :os_version => "Maemo", :platform => :X11 },
222
226
 
223
- # MSIE
227
+ # Edge
228
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36 Edg/96.0.1054.29" =>
229
+ { :type => :Browser, :name => :Edge, :version => "96.0.1054.29", :major_version => "96", :os_name => :Windows, :os_version => "10", :platform => :Windows },
230
+ "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Mobile Safari/537.36 EdgA/90.0.818.46" =>
231
+ { :type => :Browser, :name => :Edge, :version => "90.0.818.46", :major_version => "90", :os_name => :Android, :os_version => "6.0", :platform => :Android },
224
232
  "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240" =>
225
- { :type => :Browser, :name => :MSIE, :version => "12", :os_name => :Windows, :os_version => "10", :platform => :Windows },
233
+ { :type => :Browser, :name => :Edge, :version => "12.10240", :major_version => "12", :os_name => :Windows, :os_version => "10", :platform => :Windows },
226
234
  "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0" =>
227
- { :type => :Browser, :name => :MSIE, :version => "12", :os_name => :Windows, :os_version => "10", :platform => :Windows },
235
+ { :type => :Browser, :name => :Edge, :version => "12.0", :major_version => "12", :os_name => :Windows, :os_version => "10", :platform => :Windows },
228
236
  "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; DEVICE INFO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Mobile Safari/537.36 Edge/12.0" =>
229
- { :type => :Browser, :name => :MSIE, :version => "12", :os_name => :WindowsPhone, :os_version => "10", :platform => :Windows },
237
+ { :type => :Browser, :name => :Edge, :version => "12.0", :major_version => "12", :os_name => :WindowsPhone, :os_version => "10", :platform => :Windows },
238
+
239
+ # MSIE
230
240
  "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko" =>
231
241
  { :type => :Browser, :name => :MSIE, :version => "11.0", :os_name => :Windows, :os_version => "8.1", :platform => :Windows },
232
242
  "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)" =>
@@ -282,11 +292,11 @@ describe Aua do
282
292
 
283
293
  # Android
284
294
  "Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2" =>
285
- { :type => :Browser, :name => :AndroidWebkit, :version => "3.0.4", :os_name => :Android, :os_version => "1.1", :platform => :Android },
295
+ { :type => :Browser, :name => :MobileSafari, :version => "3.0.4", :os_name => :Android, :os_version => "1.1", :platform => :Android },
286
296
  "Mozilla/5.0 (Linux; U; Android 0.5; en-us) AppleWebKit/522+ (KHTML, like Gecko) Safari/419.3" =>
287
- { :type => :Browser, :name => :AndroidWebkit, :version => nil, :os_name => :Android, :os_version => "0.5", :platform => :Android },
297
+ { :type => :Browser, :name => :Safari, :version => "2.0.4", :os_name => :Android, :os_version => "0.5", :platform => :Android },
288
298
  "Mozilla/5.0 (Linux; U; Android 2.1; en-us; Nexus One Build/ERD62) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17" =>
289
- { :type => :Browser, :name => :AndroidWebkit, :version => "4.0", :os_name => :Android, :os_version => "2.1", :platform => :Android },
299
+ { :type => :Browser, :name => :MobileSafari, :version => "4.0", :os_name => :Android, :os_version => "2.1", :platform => :Android },
290
300
 
291
301
  # Palm (Pre)
292
302
  "Mozilla/5.0 (webOS/1.3; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Desktop/1.0" =>
@@ -572,4 +582,4 @@ describe Aua do
572
582
  its(:os_version) { should eql(nil) }
573
583
  its(:platform) { should eql(nil) }
574
584
  end
575
- end
585
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rspec'
2
+ require 'rspec/its'
2
3
  require File.dirname(__FILE__) + '/../lib/aua.rb'
3
4
 
4
5
  if File.exist?(File.dirname(__FILE__) + '/../../aua-mite/')
@@ -10,4 +11,4 @@ end
10
11
  RSpec.configure do |config|
11
12
  config.filter_run :focus => true
12
13
  config.run_all_when_everything_filtered = true
13
- end
14
+ end
metadata CHANGED
@@ -1,75 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aua
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Munz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-05 00:00:00.000000000 Z
11
+ date: 2021-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.4'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.4'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: guard-rspec
28
+ name: rspec-its
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ">"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - ">"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: growl
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '1.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '1.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rb-fsevent
42
+ name: guard-rspec
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ">="
45
+ - - ">"
60
46
  - !ruby/object:Gem::Version
61
- version: '0.9'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ">="
52
+ - - ">"
67
53
  - !ruby/object:Gem::Version
68
- version: '0.9'
54
+ version: '0'
69
55
  description: aua = a user agent (parser).
70
56
  email:
71
57
  - sebastian@yo.lk
72
- executables: []
58
+ executables:
59
+ - _guard-core
60
+ - guard
73
61
  extensions: []
74
62
  extra_rdoc_files: []
75
63
  files:
@@ -82,10 +70,13 @@ files:
82
70
  - README.md
83
71
  - Rakefile
84
72
  - aua.gemspec
73
+ - bin/_guard-core
74
+ - bin/guard
85
75
  - lib/aua.rb
86
76
  - lib/aua/agents.rb
87
77
  - lib/aua/agents/api_clients.rb
88
78
  - lib/aua/agents/chrome.rb
79
+ - lib/aua/agents/edge.rb
89
80
  - lib/aua/agents/engine_fallback.rb
90
81
  - lib/aua/agents/feed_reader.rb
91
82
  - lib/aua/agents/firefox.rb
@@ -113,7 +104,7 @@ homepage: https://github.com/yolk/aua
113
104
  licenses:
114
105
  - MIT
115
106
  metadata: {}
116
- post_install_message:
107
+ post_install_message:
117
108
  rdoc_options: []
118
109
  require_paths:
119
110
  - lib
@@ -128,9 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
119
  - !ruby/object:Gem::Version
129
120
  version: '0'
130
121
  requirements: []
131
- rubyforge_project: aua
132
- rubygems_version: 2.4.5
133
- signing_key:
122
+ rubygems_version: 3.0.3
123
+ signing_key:
134
124
  specification_version: 4
135
125
  summary: aua = a user agent (parser).
136
126
  test_files: