infopark_fiona_connector 7.0.1.5.2.7.rc1 → 7.0.1.6.1.6.rc2

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: d079283aa8959f1deefca7270e6e9c8931ee31cd4f9efb9387dd49664558a8ef
4
- data.tar.gz: 1c7305e98b9315a2eedb526289e23788f6c6e430ab2ceccca6a82abab01c7d9a
3
+ metadata.gz: 354adf51aab5a30ed1a7760f4543f8dfcbbb67e0390bf20c57f9f2da31e8c4c9
4
+ data.tar.gz: 3e9e8398ea686d96065f77c4565136364b2b36fe2a76ad83a832d50e60629717
5
5
  SHA512:
6
- metadata.gz: adca530e56f1697ebc35eb7e462f02a2a561bd9094cf6c7c1d0e0ad5a16c83e7f3b1ccaa41c0ddcedef58414ad523c760991abc6176941eff3c22915af74e54a
7
- data.tar.gz: 163ae40500f19873ca1d10870529a81f57752390f834d786508e1a9affb64d4bf65cf30c4b14240b5c3f60d342d403c51b7176f9dd360d1b9c5e1d54cde34fa9
6
+ metadata.gz: 0fb8ab8a8ebb91a9c2f94569efd01da7dcff2495cb5a1958a81ecbea1869751b4ba3246f22b685d67852e4e24aac3639543ad8f0b87dcfa28c9516e1d3a08d01
7
+ data.tar.gz: 5cfebc09e5ce14e2a8bd287e1c026c92714ef880c5edd5baac100a9ef1f11d5b0aad32141efa2899b00483298d70577fbaad2d2fbeb45da07d7d1d2638126311
@@ -1,2 +1,3 @@
1
1
  # ::NamedLink is just a shortcut
2
- ::NamedLink = RailsConnector::NamedLink
2
+ class NamedLink < RailsConnector::NamedLink
3
+ end
@@ -19,10 +19,9 @@ module ::RailsConnector
19
19
  end
20
20
 
21
21
  require "rails_connector/core_extensions"
22
- require "rails_connector/rack_middlewares"
23
22
  require "rails_connector/errors"
24
- require "rails_connector/fiona_datetime"
25
- ActiveRecord::Type.register(:fiona_datetime, ::FionaDateTime)
23
+ require "rails_connector/fiona_date_time"
24
+ require "rails_connector/rack_middlewares"
26
25
 
27
26
  # @api public
28
27
  module RailsConnector
@@ -40,5 +39,7 @@ module RailsConnector
40
39
  autoload_all_sources
41
40
  end
42
41
 
42
+ module InfoparkFionaConnector; end
43
+
43
44
  require "rails_connector/engine" if defined?(Rails)
44
45
  require "rails_connector/fiona_engine" if defined?(Rails)
data/lib/obj.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  # empty implementation for Obj
2
2
  # only unsed in case the app does not define Obj itself
3
- ::Obj = Class.new(RailsConnector::BasicObj)
3
+ class Obj < RailsConnector::BasicObj
4
+ end
@@ -1,6 +1,5 @@
1
1
  require "json"
2
2
  require "openssl"
3
- require "rails_connector/fiona_datetime"
4
3
 
5
4
  module RailsConnector
6
5
  # The CMS file class
@@ -37,12 +36,12 @@ module RailsConnector
37
36
  end
38
37
 
39
38
  def self.configure_column_information(table_name_postfix, use_cached_permissions)
40
- reset_column_information
41
-
42
39
  self.table_name = "#{table_name_prefix}#{table_name_postfix}"
43
40
  self.primary_key = "obj_id"
44
41
  self.inheritance_column = "obj_class"
45
42
 
43
+ reset_column_information
44
+
46
45
  @@use_cached_permissions = use_cached_permissions
47
46
  descendants.each do |klass|
48
47
  klass.reset_table_name
@@ -128,7 +127,7 @@ module RailsConnector
128
127
 
129
128
  def self.reset_reflections
130
129
  has_many :children, class_name: "Obj", foreign_key: "parent_obj_id", validate: false
131
- belongs_to :parent, class_name: "Obj", foreign_key: "parent_obj_id"
130
+ belongs_to :parent, class_name: "Obj", foreign_key: "parent_obj_id", optional: true
132
131
  end
133
132
 
134
133
  # @api public
@@ -37,16 +37,6 @@ module RailsConnector
37
37
  true
38
38
  end
39
39
 
40
- def attribute_for_inspect(attr_name)
41
- value = read_attribute(attr_name)
42
-
43
- if value.is_a?(RailsConnector::LinkList)
44
- value.destination_objects.map(&:to_s)
45
- else
46
- super
47
- end
48
- end
49
-
50
40
  class << self
51
41
  # The prefix of the table name is determined by using the instance name followed by an underscore.
52
42
  # Set the instance_name in your environment to the CMS instance name (defaults to 'default').
@@ -0,0 +1,76 @@
1
+ # Patches for ActiveRecord::Core (see include in engine.rb)
2
+ module RailsConnector
3
+ module CoreExtensions
4
+ module ActiveRecord
5
+ module Core
6
+ # Reason for patch: activerecord/lib/active_record/core#inspect does not support RailsConnector::Linklist.
7
+ # We need to transform RailsConnector::Linklist to a string to prevent circular references.
8
+ # Rails 6.0 does not make use of `attribute_for_inspect`, therefore we need to patch `format_for_inspect` directly.
9
+ # `format_for_inspect` in > 6.1 uses two parameters
10
+ #
11
+ # Reason for change: activerecord/lib/active_record/core#inspect might change in future Rails versions.
12
+ if Rails::VERSION::MAJOR < 6
13
+ def attribute_for_inspect(attr_name)
14
+ value = read_attribute(attr_name)
15
+
16
+ if value.is_a?(RailsConnector::LinkList)
17
+ value.destination_objects.map(&:to_s)
18
+ else
19
+ super
20
+ end
21
+ end
22
+ elsif Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR.zero?
23
+ def format_for_inspect(value)
24
+ if value.is_a?(RailsConnector::LinkList)
25
+ value.destination_objects.map(&:to_s)
26
+ else
27
+ super
28
+ end
29
+ end
30
+ else
31
+ def attribute_for_inspect(attr_name)
32
+ attr_name = attr_name.to_s
33
+ attr_name = self.class.attribute_aliases[attr_name] || attr_name
34
+ value = _read_attribute(attr_name)
35
+ if value.present? && value.is_a?(RailsConnector::LinkList)
36
+ value.destination_objects.map(&:to_s)
37
+ else
38
+ super
39
+ end
40
+ end
41
+ end
42
+
43
+ # Reason for patch: activerecord/lib/active_record/core#pretty_print ends up in circular reference,
44
+ # as RailsConnector::Linklist was not handled. infopark_reactor/lib/reactor/attributes.rb#_read_attribute(attr_name) overwrites
45
+ # the method, which is called by activerecord/lib/active_record/core#pretty_print.
46
+ #
47
+ # Reason for change: activerecord/lib/active_record/core#pretty_print might change in future Rails versions.
48
+ # Check rails console output of an Obj with RailsConnector::Linklist attributes.
49
+ def pretty_print(pp)
50
+ return super if custom_inspect_method_defined?
51
+
52
+ pp.object_address_group(self) do
53
+ if defined?(@attributes) && @attributes
54
+ attr_names = self.class.attribute_names.select { |name| has_attribute?(name) }
55
+ pp.seplist(attr_names, proc { pp.text "," }) do |attr_name|
56
+ pp.breakable " "
57
+ pp.group(1) do
58
+ pp.text attr_name
59
+ pp.text ":"
60
+ pp.breakable
61
+ value = _read_attribute(attr_name)
62
+ value = value.destination_objects.map(&:to_s) if value.present? && value.is_a?(RailsConnector::LinkList)
63
+ value = inspection_filter.filter_param(attr_name, value) unless value.nil?
64
+ pp.pp value
65
+ end
66
+ end
67
+ else
68
+ pp.breakable " "
69
+ pp.text "not initialized"
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -1 +1,2 @@
1
1
  require "rails_connector/core_extensions/time"
2
+ require "rails_connector/core_extensions/active_record/core"
@@ -1,8 +1,6 @@
1
1
  require "rails"
2
2
  require "active_record/railtie"
3
- require "action_view"
4
-
5
- require "rails_connector/configuration"
3
+ require "action_view/railtie"
6
4
 
7
5
  module ::RailsConnector
8
6
  class Engine < Rails::Engine
@@ -12,8 +10,18 @@ module ::RailsConnector
12
10
  # make sure our exceptions cause an adequate error page and http status code
13
11
  config.action_dispatch.rescue_responses["RailsConnector::ResourceNotFound"] = :not_found
14
12
 
13
+ initializer "Rails patches" do
14
+ config.to_prepare do
15
+ ActiveSupport.on_load(:active_record) do
16
+ include RailsConnector::CoreExtensions::ActiveRecord::Core
17
+ end
18
+ end
19
+ end
20
+
15
21
  initializer "rails_connector.add_fiona_time_type" do
16
- ActiveRecord::Type.register(:fiona_datetime, ::FionaDateTime)
22
+ ActiveSupport.on_load(:active_record) do
23
+ ActiveRecord::Type.register(:fiona_datetime, FionaDateTime)
24
+ end
17
25
  end
18
26
 
19
27
  initializer "rails_connector.add_cms_routing_paths", after: :add_routing_paths do |app|
@@ -38,7 +46,7 @@ module ::RailsConnector
38
46
 
39
47
  if runtime
40
48
  RailsConnector::LogSubscriber.attach_to :rails_connector
41
- ActiveSupport.on_load(:action_controller) do
49
+ ActiveSupport.on_load(:action_controller_base) do
42
50
  include runtime
43
51
  end
44
52
  end
@@ -50,14 +58,40 @@ module ::RailsConnector
50
58
 
51
59
  initializer "rails_connector.routing_helpers" do
52
60
  ActionDispatch::TestRequest.include RailsConnector::CmsTestRequest if Rails.env == "test"
61
+ config.to_prepare do
62
+ ActiveSupport.on_load(:action_controller_base) do
63
+ include CmsRoutingHelper
64
+ end
65
+ end
53
66
 
54
- ActionController::Base.include CmsRoutingHelper
55
- ActionView::Base.include CmsRoutingHelper
67
+ ActiveSupport.on_load(:action_view_base) do
68
+ include CmsRoutingHelper
69
+ end
70
+ end
71
+
72
+ initializer "zeitwerk.autoloader" do
73
+ if Rails::VERSION::MAJOR >= 6 && Rails.autoloaders.zeitwerk_enabled?
74
+ Rails.autoloaders.main.inflector.inflect("ses" => "SES")
75
+ Rails.autoloaders.each do |autoloader|
76
+ autoloader.ignore("#{config.root}/lib/generators")
77
+ autoloader.ignore("#{config.root}/lib/meta_eager_loader.rb")
78
+ autoloader.ignore("#{config.root}/lib/version.rb")
79
+ autoloader.ignore("#{config.root}/lib/rails_connector/core_extensions.rb")
80
+ autoloader.ignore("#{config.root}/lib/rails_connector/core_extensions/time.rb")
81
+ autoloader.ignore("#{config.root}/lib/rails_connector/core_extensions/active_record/core.rb")
82
+ autoloader.ignore("#{config.root}/lib/rails_connector/errors.rb")
83
+ autoloader.ignore("#{config.root}/lib/rails_connector/fiona_date_time.rb")
84
+ autoloader.ignore("#{config.root}/lib/rails_connector/rack_middlewares.rb")
85
+ end
86
+ end
56
87
  end
57
88
 
58
89
  config.autoload_paths += paths["lib"].to_a
59
- config.autoload_once_paths += paths["lib"].to_a
90
+ config.autoload_once_paths += paths["lib/rails_connector"].to_a
91
+ config.eager_load_paths += paths["lib/rails_connector"].to_a
60
92
 
61
- RailsConnector.rack_middlewares.each { |middleware| config.app_middleware.use middleware }
93
+ initializer "middleware.config" do
94
+ RailsConnector.rack_middlewares.each { |middleware| config.app_middleware.use middleware }
95
+ end
62
96
  end
63
97
  end
@@ -21,8 +21,8 @@ module RailsConnector
21
21
  if !@obj_classes.fetch(name, nil).nil?
22
22
  @obj_classes[name]
23
23
  else
24
- # TODO: preload_attribute_blobs for obj_class
25
- @obj_classes[name] ||= RailsConnector::ObjClass.find_by_obj_class_name(name)
24
+ obj_class = RailsConnector::ObjClass.find_by_obj_class_name(name)
25
+ @obj_classes[name] = obj_class if obj_class
26
26
  end
27
27
  end
28
28
 
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module RailsConnector
2
2
  module Version
3
3
  def self.get
4
- "7.0.1.5.2.7.rc1"
4
+ "7.0.1.6.1.6.rc2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,43 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1.5.2.7.rc1
4
+ version: 7.0.1.6.1.6.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-05 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '5.2'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '5.0'
22
+ version: '7.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '5.2'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '5.0'
32
+ version: '7.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activerecord
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '5.2'
40
+ - - "<"
32
41
  - !ruby/object:Gem::Version
33
- version: '5.0'
42
+ version: '7.0'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
- - - "~>"
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '5.2'
50
+ - - "<"
39
51
  - !ruby/object:Gem::Version
40
- version: '5.0'
52
+ version: '7.0'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rake
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -208,12 +220,13 @@ files:
208
220
  - lib/rails_connector/configuration.rb
209
221
  - lib/rails_connector/content.rb
210
222
  - lib/rails_connector/core_extensions.rb
223
+ - lib/rails_connector/core_extensions/active_record/core.rb
211
224
  - lib/rails_connector/core_extensions/time.rb
212
225
  - lib/rails_connector/date_attribute.rb
213
226
  - lib/rails_connector/default_search_request.rb
214
227
  - lib/rails_connector/engine.rb
215
228
  - lib/rails_connector/errors.rb
216
- - lib/rails_connector/fiona_datetime.rb
229
+ - lib/rails_connector/fiona_date_time.rb
217
230
  - lib/rails_connector/fiona_engine.rb
218
231
  - lib/rails_connector/html_string.rb
219
232
  - lib/rails_connector/job.rb
@@ -240,7 +253,8 @@ files:
240
253
  homepage: http://www.infopark.de
241
254
  licenses:
242
255
  - LGPL-3.0
243
- metadata: {}
256
+ metadata:
257
+ rubygems_mfa_required: 'true'
244
258
  post_install_message:
245
259
  rdoc_options: []
246
260
  require_paths:
@@ -249,14 +263,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
263
  requirements:
250
264
  - - ">="
251
265
  - !ruby/object:Gem::Version
252
- version: '0'
266
+ version: 2.6.0
253
267
  required_rubygems_version: !ruby/object:Gem::Requirement
254
268
  requirements:
255
269
  - - ">="
256
270
  - !ruby/object:Gem::Version
257
271
  version: 1.3.5
258
272
  requirements: []
259
- rubygems_version: 3.1.6
273
+ rubygems_version: 3.3.7
260
274
  signing_key:
261
275
  specification_version: 4
262
276
  summary: Infopark Fiona Connector