/
refinerycms-base.rb
40 lines (32 loc) · 1016 Bytes
/
refinerycms-base.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
unless defined? ::Rails
require 'rails'
require 'action_controller/railtie'
end
require File.expand_path('../base/refinery', __FILE__)
module Refinery
module Base
class << self
attr_accessor :root
def root
@root ||= Pathname.new(File.expand_path('../../', __FILE__))
end
end
class Engine < ::Rails::Engine
initializer "serve static assets" do |app|
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
end
config.autoload_paths += %W( #{config.root}/lib )
config.after_initialize do
::Refinery::Plugin.register do |plugin|
plugin.name = "refinerycms_base"
plugin.class_name ="RefineryBaseEngine"
plugin.version = ::Refinery.version
plugin.hide_from_menu = true
plugin.always_allow_access = true
plugin.menu_match = /(refinery|admin)\/(refinery_base)$/
end
end
end
end
end
::Refinery.engines << "base"