device_detector_regexes 0.1.4 → 0.1.5

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
2
  SHA256:
3
- metadata.gz: 24497676df61d5343c44418e2f8c4c8904eed8947cb5db1212196ac542ab91e0
4
- data.tar.gz: c9bd55656c6e3daee2a7d995d3f057b5ea87b09f4e0c423a5d90eaa0df77e1d2
3
+ metadata.gz: 5fa92b28e6542f50833c1ea09bc983cd68a1a1bf81432769cf363ca1f7e35039
4
+ data.tar.gz: 26e4ce16e1e5fb4220531911b526b39025b2512acb30b5e52c369401969eb18e
5
5
  SHA512:
6
- metadata.gz: e5fafe5b9c03bd69c37ee0240d9c4fd86210ed3e20ae55d089be998c809e3cd1e5d445077ee8d7d939ce3307ddb2c760479166d997f4d0f271808f0c3e62e738
7
- data.tar.gz: 4e130d6639c97c4afb210477289bdde0be6bbce0f1ca15df2e24199ab51e947c94b82f11452782ea9dbc03b32bbf115f58bac4d72dc1dcb32633200dfc513940
6
+ metadata.gz: 606a041f2257a535298fd6ee3924d93e1edace18fc99e655adb0a4d173acab91c5f4c920d61a252bf1aaba9db7deb07fba6d2aaa4dd9f2d315a43771b95d9ea0
7
+ data.tar.gz: 51e5e8c098816dd0bf12e3eb4ed6011d30ad2e2392760d206d72cd727e552d377d2937bb6ce3fbc1326c4ea99048200458407968930bd347e37756eb5c1c6019
@@ -0,0 +1,5 @@
1
+ Style/Documentation:
2
+ Enabled: false
3
+
4
+ Layout/LineLength:
5
+ Max: 140
@@ -1,5 +1,8 @@
1
1
  # Change log
2
2
 
3
+ ## [0.1.5]
4
+ Add rubocop, fix offences
5
+
3
6
  ## [0.1.4]
4
7
  Add an abillity to skip the piwik dd prefix, refactoring
5
8
 
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- gemspec
3
+ source 'https://rubygems.org'
4
4
 
5
- gem "rake", "~> 12.0"
5
+ gemspec
@@ -7,15 +7,31 @@ PATH
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ ast (2.4.0)
10
11
  device_detector (1.0.3)
11
- rake (12.3.3)
12
+ jaro_winkler (1.5.4)
13
+ parallel (1.19.1)
14
+ parser (2.7.0.4)
15
+ ast (~> 2.4.0)
16
+ rainbow (3.0.0)
17
+ rexml (3.2.4)
18
+ rubocop (0.80.1)
19
+ jaro_winkler (~> 1.5.1)
20
+ parallel (~> 1.10)
21
+ parser (>= 2.7.0.1)
22
+ rainbow (>= 2.2.2, < 4.0)
23
+ rexml
24
+ ruby-progressbar (~> 1.7)
25
+ unicode-display_width (>= 1.4.0, < 1.7)
26
+ ruby-progressbar (1.10.1)
27
+ unicode-display_width (1.6.1)
12
28
 
13
29
  PLATFORMS
14
30
  ruby
15
31
 
16
32
  DEPENDENCIES
17
33
  device_detector_regexes!
18
- rake (~> 12.0)
34
+ rubocop
19
35
 
20
36
  BUNDLED WITH
21
37
  1.17.2
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "device_detector_regexes"
3
+ # frozen_string_literal: true
4
+
5
+ require 'bundler/setup'
6
+ require 'device_detector_regexes'
5
7
 
6
8
  # You can add fixtures and/or initialization code here to make experimenting
7
9
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +12,5 @@ require "device_detector_regexes"
10
12
  # require "pry"
11
13
  # Pry.start
12
14
 
13
- require "irb"
15
+ require 'irb'
14
16
  IRB.start(__FILE__)
@@ -1,30 +1,33 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'lib/device_detector_regexes/version'
2
4
 
3
5
  Gem::Specification.new do |spec|
4
- spec.name = "device_detector_regexes"
5
- spec.version = DeviceDetectorRegexes::VERSION
6
- spec.authors = ["Kirill Karpinovsky"]
7
- spec.email = ["karpinovsky@gmail.com"]
6
+ spec.name = 'device_detector_regexes'
7
+ spec.version = DeviceDetectorRegexes::VERSION
8
+ spec.authors = ['Kirill Karpinovsky']
9
+ spec.email = ['karpinovsky@gmail.com']
8
10
 
9
- spec.summary = %q{device_detector regexes extender}
10
- spec.description = %q{DeviceDetectorRegexes is an extension for device_detector gem that makes it easy to add new regular expressions}
11
- spec.homepage = "https://github.com/karpinovsky/device_detector_regexes"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
11
+ spec.summary = 'device_detector regexes extender'
12
+ spec.description = 'DeviceDetectorRegexes is an extension for device_detector gem that makes it easy to add new regular expressions'
13
+ spec.homepage = 'https://github.com/karpinovsky/device_detector_regexes'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
14
16
 
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["bug_tracker_uri"] = "https://github.com/karpinovsky/device_detector_regexes/issues"
17
- spec.metadata["source_code_uri"] = spec.homepage
18
- spec.metadata["changelog_uri"] = "https://github.com/karpinovsky/device_detector_regexes/blob/master/CHANGELOG.md"
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/karpinovsky/device_detector_regexes/issues'
19
+ spec.metadata['source_code_uri'] = spec.homepage
20
+ spec.metadata['changelog_uri'] = 'https://github.com/karpinovsky/device_detector_regexes/blob/master/CHANGELOG.md'
19
21
 
20
- spec.extra_rdoc_files = Dir["README.md", "CHANGELOG.md", "LICENSE.txt"]
22
+ spec.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt']
21
23
 
22
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
25
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
26
  end
25
- spec.bindir = "exe"
27
+ spec.bindir = 'exe'
26
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
- spec.require_paths = ["lib"]
29
+ spec.require_paths = ['lib']
28
30
 
29
- spec.add_dependency "device_detector"
31
+ spec.add_dependency 'device_detector'
32
+ spec.add_development_dependency 'rubocop'
30
33
  end
@@ -1,4 +1,6 @@
1
- require "device_detector"
1
+ # frozen_string_literal: true
2
+
3
+ require 'device_detector'
2
4
 
3
5
  module DeviceDetectorRegexes; end
4
6
 
@@ -14,32 +16,30 @@ class DeviceDetector
14
16
  end
15
17
  end
16
18
  end
17
- end
18
19
 
19
- class DeviceDetector::Parser
20
- def filepaths
21
- filenames.each_with_object([]) do |filename, filenames|
20
+ class Parser
21
+ def filepaths
22
+ filenames.each_with_object([]) do |filename, filenames|
23
+ # push custom files first due to higher precedence lookup than default files
24
+ custom_file_path = File.expand_path(filename, File.join(DeviceDetector.config.dir, 'regexes'))
25
+ filenames << [filename.to_sym, custom_file_path] if File.exist?(custom_file_path)
22
26
 
23
- # push custom files first due to higher precedence lookup than default files
24
- custom_file_path = File.expand_path(filename, File.join(DeviceDetector.config.dir, "regexes"))
25
- if File.exists?(custom_file_path)
26
- filenames << [filename.to_sym, custom_file_path]
27
+ filenames << [filename.to_sym, File.join(ROOT, 'regexes', filename)]
27
28
  end
28
-
29
- filenames << [filename.to_sym, File.join(ROOT, "regexes", filename)]
30
29
  end
31
- end
32
30
 
33
- def parse_regexes(path, raw_regexes)
34
- raw_regexes.map do |meta|
35
- fail "invalid device spec: #{meta.inspect}" unless meta[:regex].is_a? String
36
- meta[:regex] = build_regex(meta[:regex], meta[:prefix])
37
- meta[:path] = path
38
- meta
31
+ def parse_regexes(path, raw_regexes)
32
+ raw_regexes.map do |meta|
33
+ raise "invalid device spec: #{meta.inspect}" unless meta[:regex].is_a? String
34
+
35
+ meta[:regex] = build_regex(meta[:regex], meta[:prefix])
36
+ meta[:path] = path
37
+ meta
38
+ end
39
39
  end
40
- end
41
40
 
42
- def build_regex(src, prefix = true)
43
- Regexp.new (prefix ? '(?:^|[^A-Z0-9\-_]|[^A-Z0-9\-]_|sprd-)(?:' + src + ')' : src), Regexp::IGNORECASE
41
+ def build_regex(src, prefix = true)
42
+ Regexp.new (prefix ? '(?:^|[^A-Z0-9\-_]|[^A-Z0-9\-]_|sprd-)(?:' + src + ')' : src), Regexp::IGNORECASE
43
+ end
44
44
  end
45
45
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module DeviceDetectorRegexes
2
- VERSION = "0.1.4"
4
+ VERSION = '0.1.5'
3
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_detector_regexes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Karpinovsky
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: DeviceDetectorRegexes is an extension for device_detector gem that makes
28
42
  it easy to add new regular expressions
29
43
  email:
@@ -36,6 +50,7 @@ extra_rdoc_files:
36
50
  - LICENSE.txt
37
51
  files:
38
52
  - ".gitignore"
53
+ - ".rubocop.yml"
39
54
  - CHANGELOG.md
40
55
  - CODE_OF_CONDUCT.md
41
56
  - Gemfile
@@ -47,7 +62,6 @@ files:
47
62
  - bin/setup
48
63
  - device_detector_regexes.gemspec
49
64
  - lib/device_detector_regexes.rb
50
- - lib/device_detector_regexes/device_detector.rb
51
65
  - lib/device_detector_regexes/version.rb
52
66
  homepage: https://github.com/karpinovsky/device_detector_regexes
53
67
  licenses:
@@ -1,14 +0,0 @@
1
- # module DeviceDetectorRegexes
2
- # def self.included(base)
3
- # base.extend(Dry::Configurable)
4
- # base.instance_eval do
5
- # setting(:custom_dir, "/Users/kirill/Work/device_detector_regexes") { |dir| Pathname(dir) }
6
- # end
7
- # base.extend(ClassMethods)
8
- # end
9
-
10
- # module ClassMethods
11
- # extend Dry::Configurable
12
- # setting(:custom_dir, Dir.pwd) { |dir| Pathname(dir) }
13
- # end
14
- # end