device_detector_regexes 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5c425345090052f9f73df5d43feed45c732d955cafc8faf061453b04a256161a
4
+ data.tar.gz: 27d07ecab4a9fb878d02a2134382095ea35f73979ec11e9b3398f6b9d0e979cd
5
+ SHA512:
6
+ metadata.gz: 7e508276467b287e24a36e0ae4f8376ea26d3f2103a3c6d2431fbb889e30251eae7f6e0b298b41b8aa944d3f86bc10f6d039ecd81d65961b96762ef7a1d75e3d
7
+ data.tar.gz: 61fd9b6544ad45cd764be5b2d7fe699613149ae3eadad783639b9ba2324441ec56dc9c0278447d20bfa22dd920b1f75fa416820e3118ab775c1c436fb41e8ba8
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
File without changes
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at karpinovsky@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake", "~> 12.0"
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ device_detector_regexes (0.1.0)
5
+ device_detector (~> 1.0.3)
6
+ dry-configurable (~> 0.11.2)
7
+ rake (~> 12.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ concurrent-ruby (1.1.6)
13
+ device_detector (1.0.3)
14
+ dry-configurable (0.11.3)
15
+ concurrent-ruby (~> 1.0)
16
+ dry-core (~> 0.4, >= 0.4.7)
17
+ dry-equalizer (~> 0.2)
18
+ dry-core (0.4.9)
19
+ concurrent-ruby (~> 1.0)
20
+ dry-equalizer (0.3.0)
21
+ rake (12.3.3)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ device_detector_regexes!
28
+ rake (~> 12.0)
29
+
30
+ BUNDLED WITH
31
+ 1.17.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Kirill Karpinovsky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+
2
+ # DeviceDetectorRegexes
3
+
4
+ DeviceDetectorRegexes is a simple extender for [device_detector](https://github.com/podigee/device_detector) gem that makes it easy to add new regular expressions
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'device_detector_regexes'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install device_detector_regexes
21
+
22
+ ## Usage
23
+
24
+ Specify the folder that will contain the mapped device_detector [regexes folder](https://github.com/podigee/device_detector/tree/develop/regexes)
25
+
26
+ ```bash
27
+ rake map_into\["my_folder_name"\]
28
+ ```
29
+
30
+ Somewhere in your code
31
+
32
+ ```ruby
33
+ DeviceDetectorRegexes.config.dir = "path/to/my/folder/name"
34
+ ```
35
+
36
+ Voila! Just add new regexes to the appropriate file
37
+
38
+ ```yaml
39
+ # my_folder_name/regexes/client/mobile_apps.yml
40
+
41
+ # [] # leave an empty array here if the file is empty
42
+ - regex: 'Foo(?:[ /]([\d\.]+))?'
43
+ name: 'Bar'
44
+ version: '$1'
45
+ ```
46
+
47
+ ```ruby
48
+ # bin/console
49
+
50
+ client = DeviceDetector.new("Foo/2.1.2; Android: 9; Model:PAR-LX1; okhttp/3.12.8")
51
+ client.name # => "Bar"
52
+ client.full_version # => "2.1.2"
53
+ ```
54
+
55
+ ## License
56
+
57
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
58
+
59
+ ## Code of Conduct
60
+
61
+ Everyone interacting in the DeviceDetectorRegexes project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/karpinovsky/device_detector_regexes/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,29 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require "fileutils"
4
+
5
+ task :map_into, [:target_dir] do |t, args|
6
+ files = [
7
+ ["client", "browser_engine.yml"],
8
+ ["client", "browsers.yml"],
9
+ ["client", "feed_readers.yml"],
10
+ ["client", "libraries.yml"],
11
+ ["client", "mediaplayers.yml"],
12
+ ["client", "mobile_apps.yml"],
13
+ ["client", "pim.yml"],
14
+ ["device", "cameras.yml"],
15
+ ["device", "car_browsers.yml"],
16
+ ["device", "consoles.yml"],
17
+ ["device", "mobiles.yml"],
18
+ ["device", "portable_media_player.yml"],
19
+ ["device", "televisions.yml"],
20
+ [".", "bots.yml"],
21
+ [".", "oss.yml"],
22
+ [".", "vendorfragments.yml"]
23
+ ]
24
+
25
+ files.each do |dir, filename|
26
+ FileUtils.mkdir_p "#{args[:target_dir]}/regexes/#{dir}"
27
+ File.open("#{args[:target_dir]}/regexes/#{dir}/#{filename}", "a") { |file| file.write("[] # live an empty array here if the file is empty") }
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "device_detector_regexes"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ require_relative 'lib/device_detector_regexes/version'
2
+
3
+ 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"]
8
+
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")
14
+
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"
19
+
20
+ spec.extra_rdoc_files = Dir["README.md", "CHANGELOG.md", "LICENSE.txt"]
21
+
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_dependency "device_detector", "~> 1.0.3"
30
+ spec.add_dependency "dry-configurable", "~> 0.11.2"
31
+ spec.add_dependency "rake", "~> 12.0"
32
+ end
@@ -0,0 +1,26 @@
1
+ require "device_detector_regexes/version"
2
+
3
+ require "device_detector"
4
+ require "dry/configurable"
5
+
6
+ module DeviceDetectorRegexes
7
+ extend Dry::Configurable
8
+
9
+ setting(:dir, Dir.pwd) { |dir| Pathname(dir) }
10
+
11
+ class DeviceDetector::Parser
12
+ private
13
+
14
+ def filepaths
15
+ filenames.each_with_object([]) do |filename, filenames|
16
+ filenames << [filename.to_sym, File.join(ROOT, 'regexes', filename)]
17
+
18
+ custom_file_path = File.expand_path(filename, File.join(DeviceDetectorRegexes.config.dir, 'regexes'))
19
+
20
+ if File.exists?(custom_file_path)
21
+ filenames << [filename.to_sym, custom_file_path]
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,3 @@
1
+ module DeviceDetectorRegexes
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: device_detector_regexes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Kirill Karpinovsky
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: device_detector
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: dry-configurable
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.11.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.11.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '12.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '12.0'
55
+ description: DeviceDetectorRegexes is an extension for device_detector gem that makes
56
+ it easy to add new regular expressions
57
+ email:
58
+ - karpinovsky@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files:
62
+ - README.md
63
+ - CHANGELOG.md
64
+ - LICENSE.txt
65
+ files:
66
+ - ".gitignore"
67
+ - CHANGELOG.md
68
+ - CODE_OF_CONDUCT.md
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - bin/console
75
+ - bin/setup
76
+ - device_detector_regexes.gemspec
77
+ - lib/device_detector_regexes.rb
78
+ - lib/device_detector_regexes/version.rb
79
+ homepage: https://github.com/karpinovsky/device_detector_regexes
80
+ licenses:
81
+ - MIT
82
+ metadata:
83
+ homepage_uri: https://github.com/karpinovsky/device_detector_regexes
84
+ bug_tracker_uri: https://github.com/karpinovsky/device_detector_regexes/issues
85
+ source_code_uri: https://github.com/karpinovsky/device_detector_regexes
86
+ changelog_uri: https://github.com/karpinovsky/device_detector_regexes/blob/master/CHANGELOG.md
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.3.0
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubygems_version: 3.0.3
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: device_detector regexes extender
106
+ test_files: []