infopark_fiona_connector 7.0.1 → 7.0.1.5.2.3.rc8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/cms_controller.rb +1 -1
- data/app/controllers/rails_connector/default_cms_controller.rb +4 -6
- data/app/helpers/cms_helper.rb +1 -1
- data/app/helpers/cms_routing_helper.rb +1 -1
- data/app/helpers/rails_connector/cms_asset_helper.rb +4 -5
- data/app/helpers/rails_connector/cms_tag_helper.rb +0 -3
- data/app/helpers/rails_connector/default_cms_helper.rb +0 -2
- data/app/helpers/rails_connector/default_cms_routing_helper.rb +15 -16
- data/app/helpers/rails_connector/display_helper.rb +31 -33
- data/app/helpers/rails_connector/editing_helper.rb +2 -8
- data/app/helpers/rails_connector/layout_helper.rb +2 -5
- data/app/helpers/rails_connector/marker_helper.rb +63 -64
- data/app/helpers/rails_connector/table_of_contents_helper.rb +1 -3
- data/config/cms_routes.rb +15 -15
- data/lib/gem_dependencies.rb +8 -7
- data/lib/generators/rails_connector/install/install_generator.rb +6 -6
- data/lib/generators/rails_connector/install/templates/initializers/rails_connector.rb +1 -1
- data/lib/infopark_fiona_connector.rb +7 -6
- data/lib/meta_eager_loader.rb +1 -0
- data/lib/rails_connector/attr_dict.rb +54 -31
- data/lib/rails_connector/attribute.rb +93 -0
- data/lib/rails_connector/authenticable.rb +12 -5
- data/lib/rails_connector/basic_obj.rb +126 -132
- data/lib/rails_connector/blob.rb +4 -5
- data/lib/rails_connector/blob_mapping.rb +15 -0
- data/lib/rails_connector/blob_mysql.rb +3 -5
- data/lib/rails_connector/blob_oracle.rb +5 -7
- data/lib/rails_connector/channel.rb +18 -0
- data/lib/rails_connector/cms_accessible.rb +21 -24
- data/lib/rails_connector/cms_base_model.rb +12 -4
- data/lib/rails_connector/cms_dispatch_controller.rb +9 -12
- data/lib/rails_connector/cms_env.rb +4 -7
- data/lib/rails_connector/cms_test_request.rb +1 -16
- data/lib/rails_connector/configuration.rb +14 -16
- data/lib/rails_connector/content.rb +7 -0
- data/lib/rails_connector/core_extensions/time.rb +3 -4
- data/lib/rails_connector/date_attribute.rb +2 -4
- data/lib/rails_connector/default_search_request.rb +1 -1
- data/lib/rails_connector/engine.rb +18 -17
- data/lib/rails_connector/errors.rb +2 -5
- data/lib/rails_connector/fiona_datetime.rb +14 -0
- data/lib/rails_connector/fiona_engine.rb +3 -4
- data/lib/rails_connector/html_string.rb +0 -2
- data/lib/rails_connector/job.rb +10 -0
- data/lib/rails_connector/link.rb +7 -4
- data/lib/rails_connector/link_list.rb +1 -5
- data/lib/rails_connector/link_resolvable.rb +1 -5
- data/lib/rails_connector/lucene_search_request.rb +20 -24
- data/lib/rails_connector/markdown_string.rb +0 -2
- data/lib/rails_connector/meta.rb +143 -0
- data/lib/rails_connector/meta/eager_loader.rb +84 -0
- data/lib/rails_connector/named_link.rb +25 -14
- data/lib/rails_connector/news.rb +8 -4
- data/lib/rails_connector/obj_class.rb +138 -0
- data/lib/rails_connector/obj_class_attr.rb +5 -0
- data/lib/rails_connector/object_with_meta_data.rb +13 -0
- data/lib/rails_connector/permission.rb +2 -6
- data/lib/rails_connector/rack_middlewares.rb +1 -2
- data/lib/rails_connector/ses.rb +3 -8
- data/lib/rails_connector/ses/verity_accessor.rb +43 -46
- data/lib/rails_connector/string_tagging.rb +0 -3
- data/lib/rails_connector/verity_search_request.rb +6 -9
- data/lib/search_request.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +31 -20
data/lib/rails_connector/blob.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
|
3
2
|
# A binary containing the blob data of a Content or CMS management
|
4
3
|
# data of Attribute (fields), ObjClass (object classes), for example.
|
5
4
|
class Blob < CmsBaseModel
|
@@ -11,7 +10,8 @@ module RailsConnector
|
|
11
10
|
select(:blob_name, :blob_length).find(primary_key)
|
12
11
|
end
|
13
12
|
|
14
|
-
|
13
|
+
alias_method :find_without_excluded_blob_data, :find
|
14
|
+
alias_method :find, :find_with_excluded_blob_data
|
15
15
|
end
|
16
16
|
|
17
17
|
def length
|
@@ -23,7 +23,7 @@ module RailsConnector
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def path_of_stored_data(use_cached_file_if_older_than = Time.now)
|
26
|
-
store_data if !File.
|
26
|
+
store_data if !File.exist?(path) || file_size_differs? || stale?(use_cached_file_if_older_than)
|
27
27
|
path
|
28
28
|
end
|
29
29
|
|
@@ -36,7 +36,7 @@ module RailsConnector
|
|
36
36
|
case adapter_name
|
37
37
|
when /mysql$/i
|
38
38
|
raise "Adapter 'mysql' no longer supported. " +
|
39
|
-
|
39
|
+
"Please change adapter in your database.yml to 'mysql2'."
|
40
40
|
when /mysql2/i
|
41
41
|
require "rails_connector/blob_mysql"
|
42
42
|
include BlobMysql
|
@@ -72,5 +72,4 @@ module RailsConnector
|
|
72
72
|
blob_length != File.stat(path).size
|
73
73
|
end
|
74
74
|
end
|
75
|
-
|
76
75
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RailsConnector
|
2
|
+
class BlobMapping < CmsBaseModel
|
3
|
+
def self.exists?
|
4
|
+
table_exists?
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.get_fingerprint(name)
|
8
|
+
find_by_blob_name(name).fingerprint
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.get_fingerprint_map(blob_names)
|
12
|
+
Hash[where(blob_name: blob_names).select(%i(blob_name fingerprint)).map { |b| [b.blob_name, b.fingerprint] }]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,13 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "mysql2"
|
2
|
+
require "mysql_blob_streaming"
|
3
3
|
|
4
4
|
module RailsConnector
|
5
|
-
|
6
5
|
module BlobMysql
|
7
6
|
def self.included(base)
|
8
7
|
base.instance_eval do
|
9
8
|
define_method :store_data do
|
10
|
-
store_data_atomically {|f| fetch_into_file(f)}
|
9
|
+
store_data_atomically { |f| fetch_into_file(f) }
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
@@ -28,5 +27,4 @@ module RailsConnector
|
|
28
27
|
end
|
29
28
|
end
|
30
29
|
end
|
31
|
-
|
32
30
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
|
3
2
|
module BlobOracle
|
4
3
|
def self.included(base)
|
5
4
|
base.instance_eval do
|
6
5
|
define_method :store_data do
|
7
|
-
store_data_atomically {|f| fetch_into_file(f)}
|
6
|
+
store_data_atomically { |f| fetch_into_file(f) }
|
8
7
|
end
|
9
8
|
end
|
10
9
|
end
|
@@ -17,17 +16,17 @@ module RailsConnector
|
|
17
16
|
GC.start
|
18
17
|
end
|
19
18
|
ensure
|
20
|
-
blob
|
19
|
+
blob&.close
|
21
20
|
end
|
22
21
|
|
23
22
|
private
|
24
23
|
|
25
24
|
def sql
|
26
|
-
%
|
25
|
+
%(
|
27
26
|
SELECT blob_data
|
28
27
|
FROM #{self.class.table_name}
|
29
28
|
WHERE #{self.class.primary_key} = :1
|
30
|
-
|
29
|
+
)
|
31
30
|
end
|
32
31
|
|
33
32
|
def blob_handle
|
@@ -35,5 +34,4 @@ module RailsConnector
|
|
35
34
|
con.exec(sql, id).fetch.first
|
36
35
|
end
|
37
36
|
end
|
38
|
-
|
39
|
-
end
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RailsConnector
|
2
|
+
class Channel < CmsBaseModel
|
3
|
+
self.primary_key = "channel_name"
|
4
|
+
|
5
|
+
def self.table_name
|
6
|
+
"#{table_name_prefix}" "channels"
|
7
|
+
end
|
8
|
+
|
9
|
+
has_many :news, class_name: "RailsConnector::News", foreign_key: "channel_name"
|
10
|
+
has_many :active_news,
|
11
|
+
-> { where(["valid_from <= :now AND valid_until >= :now", { now: Time.now.to_s(:number) }]) },
|
12
|
+
class_name: "RailsConnector::News", foreign_key: "channel_name"
|
13
|
+
|
14
|
+
has_many :objects, through: :news
|
15
|
+
|
16
|
+
scope :with_prefix, ->(prefix) { where(["channel_name LIKE ?", "#{prefix}%"]) }
|
17
|
+
end
|
18
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
|
3
2
|
# @api public
|
4
3
|
module CmsAccessible
|
5
|
-
|
6
|
-
protected
|
4
|
+
protected
|
7
5
|
|
8
6
|
# Filter method to load a CMS object.
|
9
7
|
#
|
10
8
|
# To require the loading for all actions, use this in your controllers:
|
11
|
-
#
|
9
|
+
# before_action :load_object
|
12
10
|
def load_object
|
13
11
|
CmsEnv.new(request.env).load
|
14
12
|
loaded_obj = request.env[CmsEnv::OBJ_ENV_KEY]
|
15
13
|
raise loaded_obj if loaded_obj.is_a?(StandardError)
|
14
|
+
|
16
15
|
@obj = loaded_obj
|
17
16
|
end
|
18
17
|
|
@@ -20,32 +19,30 @@ module RailsConnector
|
|
20
19
|
# not, a 410 Gone error message will be generate (by calling render_obj_error).
|
21
20
|
#
|
22
21
|
# To require the check for all actions, use this in your controllers:
|
23
|
-
#
|
24
|
-
#
|
22
|
+
# before_action :load_object
|
23
|
+
# before_action :ensure_object_is_active
|
25
24
|
def ensure_object_is_active
|
26
25
|
unless @obj.active?
|
27
26
|
@valid_from = @obj.valid_from
|
28
27
|
@valid_until = @obj.valid_until
|
29
28
|
@obj = nil
|
30
29
|
render_obj_error(410, "gone")
|
31
|
-
return false
|
32
30
|
end
|
33
|
-
|
31
|
+
true
|
34
32
|
end
|
35
33
|
|
36
34
|
# Filter method to check if access to the loaded object is permitted. If it is
|
37
35
|
# not, a 403 Forbidden error message will be generated (by calling render_obj_error)
|
38
36
|
#
|
39
37
|
# To require the check for all actions, use this in your controllers:
|
40
|
-
#
|
41
|
-
#
|
38
|
+
# before_action :load_object
|
39
|
+
# before_action :ensure_object_is_permitted
|
42
40
|
def ensure_object_is_permitted
|
43
41
|
unless is_permitted(@obj)
|
44
42
|
@obj = nil
|
45
43
|
render_obj_error(403, "forbidden")
|
46
|
-
return false
|
47
44
|
end
|
48
|
-
|
45
|
+
true
|
49
46
|
end
|
50
47
|
|
51
48
|
# This method is called when rendering an error caused by either {ensure_object_is_permitted}
|
@@ -56,10 +53,10 @@ module RailsConnector
|
|
56
53
|
def render_obj_error(status, name)
|
57
54
|
force_html_format
|
58
55
|
render(
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
56
|
+
template: "errors/#{status}_#{name}",
|
57
|
+
layout: false,
|
58
|
+
status: status,
|
59
|
+
content_type: Mime[:html]
|
63
60
|
)
|
64
61
|
end
|
65
62
|
|
@@ -83,7 +80,7 @@ module RailsConnector
|
|
83
80
|
# to the valid_until date of the current object.
|
84
81
|
def set_google_expire_header
|
85
82
|
if @obj && (date = @obj.valid_until)
|
86
|
-
headers[
|
83
|
+
headers["X-Robots-Tag: unavailable_after"] = date.rfc822
|
87
84
|
end
|
88
85
|
end
|
89
86
|
|
@@ -93,20 +90,20 @@ module RailsConnector
|
|
93
90
|
def deliver_file
|
94
91
|
if @obj.body_data_url
|
95
92
|
redirect_to enforce_protocol_from_request(@obj.body_data_url)
|
96
|
-
elsif stale?(:
|
93
|
+
elsif stale?(last_modified: @obj.last_changed.utc)
|
97
94
|
mime_type = @obj.mime_type
|
98
|
-
mime_type +=
|
95
|
+
mime_type += "; charset=utf-8" if %r{^text/}.match?(mime_type)
|
99
96
|
|
100
97
|
if (filepath = @obj.body_data_path).present?
|
101
98
|
send_file(File.expand_path(filepath), {
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
99
|
+
type: mime_type,
|
100
|
+
filename: @obj.filename,
|
101
|
+
disposition: "inline"
|
102
|
+
})
|
106
103
|
else
|
107
104
|
# generics should send its body, empty files should be delivered as
|
108
105
|
# empty files - and not lead to an application error
|
109
|
-
send_data @obj.body ||
|
106
|
+
send_data @obj.body || "", type: mime_type, filename: @obj.filename, disposition: "inline"
|
110
107
|
end
|
111
108
|
end
|
112
109
|
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
|
3
2
|
# This is the abstract class from which all CMS models derive.
|
4
3
|
# The database connection is set to "infopark_rails_connector_${RAILS_ENV}" and the table prefix is
|
5
4
|
# determined from the instance_name.
|
6
5
|
#
|
7
6
|
# [instance_name] the name of the CMS instance
|
8
7
|
class CmsBaseModel < ActiveRecord::Base
|
9
|
-
@@instance_name =
|
8
|
+
@@instance_name = "default"
|
10
9
|
cattr_accessor :instance_name
|
11
10
|
self.abstract_class = true
|
12
11
|
|
@@ -38,6 +37,16 @@ module RailsConnector
|
|
38
37
|
true
|
39
38
|
end
|
40
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
|
+
|
41
50
|
class << self
|
42
51
|
# The prefix of the table name is determined by using the instance name followed by an underscore.
|
43
52
|
# Set the instance_name in your environment to the CMS instance name (defaults to 'default').
|
@@ -46,9 +55,8 @@ module RailsConnector
|
|
46
55
|
#
|
47
56
|
# ActiveRecord::Base::primary_key_prefix_type has no effect here.
|
48
57
|
def table_name_prefix
|
49
|
-
@@instance_name.blank? ?
|
58
|
+
@@instance_name.blank? ? "" : (@@instance_name + "_")
|
50
59
|
end
|
51
60
|
end
|
52
61
|
end
|
53
|
-
|
54
62
|
end
|
@@ -1,24 +1,22 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
|
3
2
|
class CmsDispatchController < ActionController::Metal
|
4
3
|
def process(action)
|
5
|
-
CmsEnv.new(env).load
|
6
|
-
controller = target_controller(env)
|
7
|
-
env["action_dispatch.request.path_parameters"][:controller] = controller.controller_path
|
4
|
+
CmsEnv.new(request.env).load
|
5
|
+
controller = target_controller(request.env)
|
6
|
+
request.env["action_dispatch.request.path_parameters"][:controller] = controller.controller_path
|
8
7
|
|
9
|
-
if !obj_not_found? && action ==
|
10
|
-
action = loaded_obj.controller_action_name
|
11
|
-
end
|
8
|
+
action = loaded_obj.controller_action_name if !obj_not_found? && action == "index"
|
12
9
|
|
13
|
-
env["action_dispatch.request.path_parameters"][:action] = action
|
10
|
+
request.env["action_dispatch.request.path_parameters"][:action] = action
|
14
11
|
|
15
|
-
self.response = controller.action(action).call(env)
|
12
|
+
self.response = controller.action(action).call(request.env)
|
16
13
|
end
|
17
14
|
|
18
15
|
private
|
19
16
|
|
20
|
-
def target_controller(
|
17
|
+
def target_controller(_env)
|
21
18
|
return default_controller if obj_not_found?
|
19
|
+
|
22
20
|
controller = "#{loaded_obj.controller_name}Controller".constantize
|
23
21
|
|
24
22
|
if controller.respond_to?(:use_for_obj_dispatch?) && controller.use_for_obj_dispatch?
|
@@ -31,7 +29,7 @@ module RailsConnector
|
|
31
29
|
end
|
32
30
|
|
33
31
|
def loaded_obj
|
34
|
-
env[CmsEnv::OBJ_ENV_KEY]
|
32
|
+
request.env[CmsEnv::OBJ_ENV_KEY]
|
35
33
|
end
|
36
34
|
|
37
35
|
def obj_not_found?
|
@@ -42,5 +40,4 @@ module RailsConnector
|
|
42
40
|
CmsController
|
43
41
|
end
|
44
42
|
end
|
45
|
-
|
46
43
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
module RailsConnector
|
2
|
-
|
3
2
|
class CmsEnv
|
4
|
-
|
5
|
-
OBJ_ENV_KEY = "INFOPARK_OBJ"
|
3
|
+
OBJ_ENV_KEY = "INFOPARK_OBJ".freeze
|
6
4
|
|
7
5
|
def initialize(env)
|
8
6
|
@env = env
|
@@ -10,6 +8,7 @@ module RailsConnector
|
|
10
8
|
|
11
9
|
def load
|
12
10
|
return if env[OBJ_ENV_KEY]
|
11
|
+
|
13
12
|
load_object
|
14
13
|
end
|
15
14
|
|
@@ -48,7 +47,7 @@ module RailsConnector
|
|
48
47
|
|
49
48
|
if found_obj.suppressed?
|
50
49
|
raise RailsConnector::ResourceNotFound,
|
51
|
-
|
50
|
+
"Tried to access Obj #{found_obj.inspect}, but it is suppressed (suppress_export is set)!"
|
52
51
|
end
|
53
52
|
|
54
53
|
found_obj
|
@@ -59,10 +58,8 @@ module RailsConnector
|
|
59
58
|
end
|
60
59
|
|
61
60
|
def self.find_permalink_by_param(permalink_param)
|
62
|
-
permalink =
|
61
|
+
permalink = Array(permalink_param).join("/")
|
63
62
|
Obj.find_by_permalink!(permalink)
|
64
63
|
end
|
65
|
-
|
66
64
|
end
|
67
|
-
|
68
65
|
end
|
@@ -1,23 +1,8 @@
|
|
1
1
|
module RailsConnector
|
2
2
|
module CmsTestRequest
|
3
|
-
def for_cms_object(test_obj=nil)
|
3
|
+
def for_cms_object(test_obj = nil)
|
4
4
|
# prepare the env as if the given obj was loaded by CmsEnv
|
5
5
|
env[RailsConnector::CmsEnv::OBJ_ENV_KEY] = test_obj if test_obj
|
6
|
-
class << self
|
7
|
-
# This special behaviour is necessary for testing controllers that descend from DefaultCmsController.
|
8
|
-
# These controllers do not have explicit routes by default.
|
9
|
-
# Instead, they are reached via the CmsDispatchController.
|
10
|
-
# The TestRequest must therefore use CmsDispatchController as a fallback route.
|
11
|
-
def assign_parameters(routes, controller_path, action, parameters = {})
|
12
|
-
super(routes, controller_path, action, parameters)
|
13
|
-
rescue ActionController::UrlGenerationError, ActionController::RoutingError, AbstractController::ActionNotFound => e
|
14
|
-
begin
|
15
|
-
super(routes, "rails_connector/cms_dispatch", action, parameters)
|
16
|
-
rescue ActionController::RoutingError, AbstractController::ActionNotFound
|
17
|
-
raise e
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
6
|
end
|
22
7
|
end
|
23
8
|
end
|
@@ -1,23 +1,21 @@
|
|
1
1
|
require "helpful_configuration"
|
2
|
-
require
|
2
|
+
require "rails_connector/cms_base_model"
|
3
3
|
require "rails_connector/blob"
|
4
4
|
|
5
5
|
module RailsConnector
|
6
|
-
|
7
6
|
# @api public
|
8
7
|
class Configuration
|
9
8
|
# @api public
|
10
9
|
DEFAULT_MODE = :live
|
11
10
|
|
12
11
|
class << self
|
13
|
-
|
14
12
|
# there are three available modes for the rails connector:
|
15
13
|
# <tt>live</tt> (show released contents only),
|
16
14
|
# <tt>preview</tt> (show edited contents)
|
17
15
|
# <tt>editor</tt> (show edited contents and editor interface (e.g. edit markers))
|
18
16
|
# Default mode is <tt>live</tt>.
|
19
17
|
# @api public
|
20
|
-
attr_accessor :
|
18
|
+
attr_accessor :blob_cache_dir, :choose_homepage_callback
|
21
19
|
|
22
20
|
# default options for {SearchRequest}
|
23
21
|
# @api public
|
@@ -32,12 +30,12 @@ module RailsConnector
|
|
32
30
|
# define a non-default blob cache dir.
|
33
31
|
# +fiona connector+ only. has no effect when used with the +cloud connector+.
|
34
32
|
# @api public
|
35
|
-
attr_accessor :blob_cache_dir
|
36
33
|
|
37
34
|
# @api public
|
38
35
|
def mode=(new_mode)
|
39
36
|
new_mode = new_mode.to_sym
|
40
|
-
raise ArgumentError, "Unknown Mode #{new_mode}" unless
|
37
|
+
raise ArgumentError, "Unknown Mode #{new_mode}" unless %i(editor preview live).include?(new_mode)
|
38
|
+
|
41
39
|
@mode = new_mode
|
42
40
|
end
|
43
41
|
|
@@ -77,6 +75,8 @@ module RailsConnector
|
|
77
75
|
end
|
78
76
|
|
79
77
|
def to_prepare
|
78
|
+
BasicObj.reset_reflections
|
79
|
+
|
80
80
|
unless Rails.configuration.cache_classes
|
81
81
|
after_initialize
|
82
82
|
NamedLink.reset_cache
|
@@ -89,8 +89,6 @@ module RailsConnector
|
|
89
89
|
RailsConnector::CmsBaseModel.configure_database(:cms)
|
90
90
|
end
|
91
91
|
|
92
|
-
attr_accessor :choose_homepage_callback
|
93
|
-
|
94
92
|
# Configure a callback to be invoked when the rails connector delivers the homepage.
|
95
93
|
# The given callback will receive the rack env
|
96
94
|
# and must return an Obj to be used as the homepage.
|
@@ -100,15 +98,15 @@ module RailsConnector
|
|
100
98
|
self.choose_homepage_callback = block
|
101
99
|
end
|
102
100
|
|
103
|
-
def cms_routes(*
|
104
|
-
raise <<-EOS.gsub(/\s+/,
|
101
|
+
def cms_routes(*_args)
|
102
|
+
raise <<-EOS.gsub(/\s+/, " ")
|
105
103
|
Calling RailsConnector::Configuration.cms_routes is not needed anymore.
|
106
104
|
Please remove it from config/routes.rb
|
107
105
|
EOS
|
108
106
|
end
|
109
107
|
|
110
|
-
def use_x_sendfile=(
|
111
|
-
raise
|
108
|
+
def use_x_sendfile=(_value)
|
109
|
+
raise "Configuration.use_x_sendfile is now available as Rails configuration:"\
|
112
110
|
' config.action_dispatch.x_sendfile_header = "X-Sendfile"'
|
113
111
|
end
|
114
112
|
|
@@ -128,11 +126,11 @@ module RailsConnector
|
|
128
126
|
protected
|
129
127
|
|
130
128
|
def enable_authentication
|
131
|
-
::ApplicationController.
|
129
|
+
::ApplicationController.include RailsConnector::Authenticable
|
132
130
|
end
|
133
131
|
|
134
132
|
def read_local_config_file
|
135
|
-
contents = YAML.load_file(local_config_file_name) if File.
|
133
|
+
contents = YAML.load_file(local_config_file_name) if File.exist?(local_config_file_name)
|
136
134
|
contents ||= {}
|
137
135
|
|
138
136
|
config = HelpfulConfiguration.new(
|
@@ -159,12 +157,12 @@ module RailsConnector
|
|
159
157
|
"cms_api",
|
160
158
|
"a hash of options that specify access to the cms api"
|
161
159
|
)
|
162
|
-
config.explain
|
160
|
+
config.explain "content_service", "a hash of options that specify access to content service"
|
163
161
|
config
|
164
162
|
end
|
165
163
|
|
166
164
|
def enable_ses
|
167
|
-
require
|
165
|
+
require "rails_connector/ses"
|
168
166
|
|
169
167
|
RailsConnector::SES.enable
|
170
168
|
end
|