bizside 2.2.3 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5634665dbde8242332a347b6a825042a37a856868397c80efdbbac326def3933
4
- data.tar.gz: 1495baf7676ce3ad9a95751eef646a1c3028d17cc08e1dbd98e9d31bb478c530
3
+ metadata.gz: d4c22002eada30e8bb21db240f3c28c346c7049ccc375ff6f7afd3cfb8fb713e
4
+ data.tar.gz: 6357dee7fe2d59e8619cc0937d6fd0ccc204dcf7387cbc0cf4871681e0cf22bd
5
5
  SHA512:
6
- metadata.gz: 4fc4c314f6c031f41580fe0900f2263001c51c8f6686096b6e45b87e7c06eaeafee39e5cd006963a8d081f4c4e3d110efdf8a37e3f12aa0e20de0cae04f0da7e
7
- data.tar.gz: 14081554a04f3620795cc9ab19ed2eda73c814453649fe0e492f74713960568742bee9a16782bd1b11498c45c4cdb2cb8485f1d6a9d2d7c82691e529e1622610
6
+ metadata.gz: bd28798fd692aef8e7fe202a5de9375362d29a226b19517f1ada70f39f69d94110a260b4cb4c14c3b7c5b6f0d5f92f223f33cd01aff19176b310e491b2de2040
7
+ data.tar.gz: b32b86fa1b621e70b37cf237dfcf7c09dc4fb868fde37727f5f19214f12e207ffc5d9db697ab3210083fd2c1c7dc3c67470e99dac7167460475d9a7d5c8fa4d4
@@ -33,11 +33,13 @@ module Bizside
33
33
  end
34
34
 
35
35
  if Bizside.config.user_agent.enabled?
36
+ if Bizside.config.user_agent.to_h.has_key?('use_variant')
37
+ raise "ERROR: 'use_variant' is obsolete. Delete it from config/bizside.yml"
38
+ end
39
+
36
40
  require_relative 'user_agent'
37
41
 
38
42
  initializer 'user_agent' do
39
- require_relative 'user_agent/action_view'
40
-
41
43
  ActiveSupport.on_load(:action_controller) do
42
44
  include Bizside::UserAgent::ControllerHelper
43
45
  end
@@ -23,7 +23,7 @@ module Bizside
23
23
  self.user_agent = ::Bizside::UserAgent.parse(request.env['HTTP_USER_AGENT'])
24
24
  end
25
25
 
26
- set_request_variant if Bizside.config.user_agent.use_variant?
26
+ set_request_variant
27
27
 
28
28
  request.env['BIZSIDE_DEVICE'] = self.user_agent.name
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Bizside
2
- VERSION = '2.2.3'
2
+ VERSION = '2.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bizside
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bizside-developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2022-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -442,10 +442,6 @@ files:
442
442
  - lib/bizside/uploader/extension_whitelist.rb
443
443
  - lib/bizside/uploader/filename_validator.rb
444
444
  - lib/bizside/user_agent.rb
445
- - lib/bizside/user_agent/action_view.rb
446
- - lib/bizside/user_agent/action_view/action_view_4.rb
447
- - lib/bizside/user_agent/action_view/action_view_6.rb
448
- - lib/bizside/user_agent/action_view/use_variant.rb
449
445
  - lib/bizside/user_agent/controller_helper.rb
450
446
  - lib/bizside/validations.rb
451
447
  - lib/bizside/version.rb
@@ -1,56 +0,0 @@
1
- require 'action_view'
2
-
3
- class ActionView::TemplateRenderer
4
-
5
- def render(context, options)
6
- @view = context
7
- @details = extract_details(options)
8
- template = get_template_by_user_agent(context, options)
9
- context = @lookup_context
10
-
11
- prepend_formats(template.formats)
12
-
13
- unless context.rendered_format
14
- context.rendered_format = template.formats.first || formats.first
15
- end
16
-
17
- render_template(template, options[:layout], options[:locals])
18
- end
19
-
20
- private
21
-
22
- def get_user_agent(context)
23
- if context.respond_to?(:user_agent)
24
- if context.respond_to?(:controller)
25
- if context.controller.respond_to?(:session)
26
- context.user_agent
27
- end
28
- end
29
- end
30
- end
31
-
32
- def get_template_by_user_agent(context, options)
33
- ret = nil
34
- option_for_template = options[:template]
35
-
36
- ua = get_user_agent(context)
37
- if ua
38
- ua.priorities.each do |priority|
39
- begin
40
- options[:template] = option_for_template + '.' + priority
41
- ret = determine_template(options)
42
- break
43
- rescue ActionView::MissingTemplate
44
- end
45
- end
46
- end
47
-
48
- unless ret
49
- options[:template] = option_for_template
50
- ret = determine_template(options)
51
- end
52
-
53
- Rails.logger.debug "UserAgent: #{ua ? ua.name : 'unknown'} => #{ret.identifier}"
54
- ret
55
- end
56
- end
@@ -1,50 +0,0 @@
1
- require 'action_view'
2
-
3
- class ActionView::TemplateRenderer
4
-
5
- def render(context, options)
6
- @details = extract_details(options)
7
- template = get_template_by_user_agent(context, options)
8
-
9
- prepend_formats(template.format)
10
-
11
- render_template(context, template, options[:layout], options[:locals] || {})
12
- end
13
-
14
- private
15
-
16
- def get_user_agent(context)
17
- if context.respond_to?(:user_agent)
18
- if context.respond_to?(:controller)
19
- if context.controller.respond_to?(:session)
20
- context.user_agent
21
- end
22
- end
23
- end
24
- end
25
-
26
- def get_template_by_user_agent(context, options)
27
- ret = nil
28
- option_for_template = options[:template]
29
-
30
- ua = get_user_agent(context)
31
- if ua
32
- ua.priorities.each do |priority|
33
- begin
34
- options[:template] = option_for_template + '.' + priority
35
- ret = determine_template(options)
36
- break
37
- rescue ActionView::MissingTemplate
38
- end
39
- end
40
- end
41
-
42
- unless ret
43
- options[:template] = option_for_template
44
- ret = determine_template(options)
45
- end
46
-
47
- Rails.logger.debug "UserAgent: #{ua ? ua.name : 'unknown'} => #{ret.identifier}"
48
- ret
49
- end
50
- end
@@ -1,4 +0,0 @@
1
- require 'action_view/template/resolver'
2
-
3
- ActionView::PathResolver::EXTENSIONS = { locale: ".", variants: ".", formats: ".", handlers: "." }
4
- ActionView::PathResolver::DEFAULT_PATTERN = ":prefix/:action{.:locale,}{.:variants,}{.:formats,}{.:handlers,}"
@@ -1,16 +0,0 @@
1
- case Rails::VERSION::MAJOR
2
- when 5
3
- if Bizside.config.user_agent.use_variant?
4
- load File.expand_path(File.join('action_view', 'use_variant.rb'), __dir__)
5
- else
6
- load File.expand_path(File.join('action_view', 'action_view_4.rb'), __dir__)
7
- end
8
- when 6
9
- if Bizside.config.user_agent.use_variant?
10
- load File.expand_path(File.join('action_view', 'use_variant.rb'), __dir__)
11
- else
12
- load File.expand_path(File.join('action_view', 'action_view_6.rb'), __dir__)
13
- end
14
- else
15
- raise "Rails#{Rails::VERSION::MAJOR} はサポートしていません。"
16
- end