rack-simple_user_agent 0.4.0 → 0.5.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
2
  SHA256:
3
- metadata.gz: 6d17b05b4f47abe83f942072f6d17519665ace1a3b77d9c368b37e037e649f3c
4
- data.tar.gz: 88917f5b6f3766824c5dcd91d16789e79bf40f447ecc1a964ae80dda70b1a037
3
+ metadata.gz: e5095cb34b40a6038ba15a5d77f7038d89193d7aa5f15b16202b13b54a484cac
4
+ data.tar.gz: cf962764c650b73ab17b821c3c3b51e07b0fb86cecc4150b99c1c464a1ece0be
5
5
  SHA512:
6
- metadata.gz: c65413d498da4d2be2ae3fe4bffac3c590161c0caa0bde19c51e2a3163c8fbfdb3e384cdfe3b80050a766beb92e3d925ce1dc41d7ed11c40fc3e750cc60175c9
7
- data.tar.gz: f2d796ccab64e4a434e9fb8a931f36f59debda46e9c55e0dfed1cdc864c1d9318006a6fb7cbd0889cb7c0e1165afb113348f1958b7c363c4ff4fc150e8bb314b
6
+ metadata.gz: 2e01b736edfdefa5d47feed11abad62cedf5fa50ce7d40376b5d47911b93d4342ffc0610316e48eb4c1689f5af4ff2ed0052b83a9e5bb490729f8fe809ef662c
7
+ data.tar.gz: 4edfc9e7a3f8f0861b84a78d8eee809749c4fcbcfee4a19ad0c7559dc9e155a43ca5de6b0c0844b85949534e44a53d0bd15891f7670bcda15096eded048c626e
@@ -0,0 +1 @@
1
+ github: toshimaru
@@ -0,0 +1,14 @@
1
+ name: RuboCop
2
+ on: [pull_request]
3
+ jobs:
4
+ build:
5
+ runs-on: ubuntu-latest
6
+ name: rubocop
7
+ steps:
8
+ - uses: actions/checkout@v2
9
+ - name: Set up Ruby
10
+ uses: actions/setup-ruby@v1
11
+ with:
12
+ ruby-version: 2.6
13
+ - run: bundle install
14
+ - run: bundle exec rubocop
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require: rubocop-minitest
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.3
7
+
8
+ Layout/LineLength:
9
+ Enabled: false
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,20 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-03-13 18:11:21 +0900 using RuboCop version 0.80.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 8
10
+ Style/Documentation:
11
+ Exclude:
12
+ - 'spec/**/*'
13
+ - 'test/**/*'
14
+ - 'lib/rack/simple_user_agent.rb'
15
+ - 'lib/rack/simple_user_agent/detectors.rb'
16
+ - 'lib/rack/simple_user_agent/detectors/android.rb'
17
+ - 'lib/rack/simple_user_agent/detectors/bot.rb'
18
+ - 'lib/rack/simple_user_agent/detectors/ios.rb'
19
+ - 'lib/rack/simple_user_agent/detectors/windows_phone.rb'
20
+ - 'lib/rack/simple_user_agent/railtie.rb'
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.2.5
5
4
  - 2.3.7
6
5
  - 2.4.5
7
6
  - 2.5.3
7
+ - 2.6.4
8
+ - 2.7.0
8
9
  before_install: gem update bundler
data/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ Changelog is maintained under [Github Releases](https://github.com/toshimaru/rack-simple_user_agent/releases).
data/Gemfile CHANGED
@@ -1,4 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in rack-simple_user_agent.gemspec
4
6
  gemspec
7
+
8
+ gem 'coveralls'
9
+ gem 'minitest', '~> 5.0'
10
+ gem 'minitest-reporters'
11
+ gem 'rack-test'
12
+ gem 'rake'
13
+ gem 'rubocop'
14
+ gem 'rubocop-minitest'
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
3
5
 
4
6
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
7
9
  t.test_files = FileList['test/**/*_test.rb']
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
data/bin/console CHANGED
@@ -1,11 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "rack/simple_user_agent"
4
+ require 'bundler/setup'
5
+ require 'rack/simple_user_agent'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # 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
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rack
2
4
  class SimpleUserAgent
3
5
  module Detectors
4
6
  module Android
5
7
  def from_android?
6
- user_agent_string.include?("Android")
8
+ user_agent_string.include?('Android')
7
9
  end
8
10
 
9
11
  def from_android_tablet?
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rack
2
4
  class SimpleUserAgent
3
5
  module Detectors
4
6
  module Bot
5
7
  def from_googlebot?
6
- user_agent_string.include?("Googlebot")
8
+ user_agent_string.include?('Googlebot')
7
9
  end
8
10
 
9
11
  def from_googlebot_news?
10
- user_agent_string.include?("Googlebot-News")
12
+ user_agent_string.include?('Googlebot-News')
11
13
  end
12
14
 
13
15
  def from_googlebot_images?
14
- user_agent_string.include?("Googlebot-Image")
16
+ user_agent_string.include?('Googlebot-Image')
15
17
  end
16
18
 
17
19
  def from_googlebot_video?
18
- user_agent_string.include?("Googlebot-Video")
20
+ user_agent_string.include?('Googlebot-Video')
19
21
  end
20
22
  end
21
23
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rack
2
4
  class SimpleUserAgent
3
5
  module Detectors
@@ -7,15 +9,15 @@ module Rack
7
9
  end
8
10
 
9
11
  def from_iphone?
10
- user_agent_string.include?("iPhone;")
12
+ user_agent_string.include?('iPhone;')
11
13
  end
12
14
 
13
15
  def from_ipad?
14
- user_agent_string.include?("iPad;")
16
+ user_agent_string.include?('iPad;')
15
17
  end
16
18
 
17
19
  def from_ipod?
18
- user_agent_string.include?("iPod touch;")
20
+ user_agent_string.include?('iPod touch;')
19
21
  end
20
22
  end
21
23
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rack
2
4
  class SimpleUserAgent
3
5
  module Detectors
4
6
  module WindowsPhone
5
7
  def from_windows_phone?
6
- user_agent_string.include?("Windows Phone")
8
+ user_agent_string.include?('Windows Phone')
7
9
  end
8
10
  end
9
11
  end
@@ -1,7 +1,9 @@
1
- require "rack/simple_user_agent/detectors/android"
2
- require "rack/simple_user_agent/detectors/bot"
3
- require "rack/simple_user_agent/detectors/ios"
4
- require "rack/simple_user_agent/detectors/windows_phone"
1
+ # frozen_string_literal: true
2
+
3
+ require 'rack/simple_user_agent/detectors/android'
4
+ require 'rack/simple_user_agent/detectors/bot'
5
+ require 'rack/simple_user_agent/detectors/ios'
6
+ require 'rack/simple_user_agent/detectors/windows_phone'
5
7
 
6
8
  module Rack
7
9
  class SimpleUserAgent
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rack
2
4
  class SimpleUserAgent
3
5
  class Railtie < ::Rails::Railtie
4
- initializer "rack-simple_user_agent.configure_rails_initialization" do |app|
6
+ initializer 'rack-simple_user_agent.configure_rails_initialization' do |app|
5
7
  app.config.middleware.use Rack::SimpleUserAgent
6
8
 
7
9
  ActiveSupport.on_load(:action_controller) do
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rack
2
4
  class SimpleUserAgent
3
- VERSION = "0.4.0"
5
+ VERSION = '0.5.0'
4
6
  end
5
7
  end
@@ -1,5 +1,7 @@
1
- require "rack/simple_user_agent/version"
2
- require "rack/simple_user_agent/detectors"
1
+ # frozen_string_literal: true
2
+
3
+ require 'rack/simple_user_agent/version'
4
+ require 'rack/simple_user_agent/detectors'
3
5
  require 'rack/simple_user_agent/railtie' if defined?(Rails)
4
6
 
5
7
  module Rack
@@ -1,30 +1,24 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'rack/simple_user_agent/version'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "rack-simple_user_agent"
8
+ spec.name = 'rack-simple_user_agent'
7
9
  spec.version = Rack::SimpleUserAgent::VERSION
8
- spec.authors = ["toshimaru"]
9
- spec.email = ["me@toshimaru.net"]
10
+ spec.authors = ['toshimaru']
11
+ spec.email = ['me@toshimaru.net']
10
12
 
11
- spec.summary = %q{Rack::SimpleUserAgent is stupidly simple UA detector}
12
- spec.description = %q{Rack::SimpleUserAgent is Rack::Request extension which detects user-agent from user-agent string. No complicated logic for the detection, it simply(stupidly) checks if user-agent includes particular string or not.}
13
- spec.homepage = "https://github.com/toshimaru/rack-simple_user_agent"
14
- spec.license = "MIT"
13
+ spec.summary = 'Rack::SimpleUserAgent is stupidly simple UA detector'
14
+ spec.description = 'Rack::SimpleUserAgent is Rack::Request extension which detects user-agent from user-agent string. No complicated logic for the detection, it simply(stupidly) checks if user-agent includes particular string or not.'
15
+ spec.homepage = 'https://github.com/toshimaru/rack-simple_user_agent'
16
+ spec.license = 'MIT'
15
17
 
16
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sample)/}) }
17
- spec.bindir = "exe"
19
+ spec.bindir = 'exe'
18
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
- spec.require_paths = ["lib"]
20
-
21
- spec.required_ruby_version = ">= 2.2.2"
21
+ spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.11"
24
- spec.add_development_dependency "rake", "~> 11.0"
25
- spec.add_development_dependency "minitest", "~> 5.0"
26
- spec.add_development_dependency "minitest-reporters"
27
- spec.add_development_dependency "pry"
28
- spec.add_development_dependency "rack-test"
29
- spec.add_development_dependency "coveralls"
23
+ spec.required_ruby_version = '>= 2.3'
30
24
  end
metadata CHANGED
@@ -1,113 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-simple_user_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - toshimaru
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-03 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.11'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.11'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '11.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '11.0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '5.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest-reporters
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: pry
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rack-test
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: coveralls
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
11
+ date: 2020-03-13 00:00:00.000000000 Z
12
+ dependencies: []
111
13
  description: Rack::SimpleUserAgent is Rack::Request extension which detects user-agent
112
14
  from user-agent string. No complicated logic for the detection, it simply(stupidly)
113
15
  checks if user-agent includes particular string or not.
@@ -117,8 +19,13 @@ executables: []
117
19
  extensions: []
118
20
  extra_rdoc_files: []
119
21
  files:
22
+ - ".github/FUNDING.yml"
23
+ - ".github/workflows/rubocop.yml"
120
24
  - ".gitignore"
25
+ - ".rubocop.yml"
26
+ - ".rubocop_todo.yml"
121
27
  - ".travis.yml"
28
+ - CHANGELOG.md
122
29
  - CODE_OF_CONDUCT.md
123
30
  - Gemfile
124
31
  - LICENSE.txt
@@ -147,15 +54,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
54
  requirements:
148
55
  - - ">="
149
56
  - !ruby/object:Gem::Version
150
- version: 2.2.2
57
+ version: '2.3'
151
58
  required_rubygems_version: !ruby/object:Gem::Requirement
152
59
  requirements:
153
60
  - - ">="
154
61
  - !ruby/object:Gem::Version
155
62
  version: '0'
156
63
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.7.6
64
+ rubygems_version: 3.1.2
159
65
  signing_key:
160
66
  specification_version: 4
161
67
  summary: Rack::SimpleUserAgent is stupidly simple UA detector