Class: Edgarj::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Edgarj::Engine
- Defined in:
- lib/edgarj/engine.rb
Class Method Summary collapse
-
.load_config ⇒ Object
load this engine’s config (rails_config default loads from only Rails.root/config/…).
-
.load_decorators ⇒ Object
Require/load (based on config) all decorators from app/decorators/.
-
.load_edgarj_conf_in_app ⇒ Object
Require/load application side edgarj config in RAILS_ROOT/config/edgarj/.
-
.make_work_dir ⇒ Object
make edgarj related work directories.
Class Method Details
.load_config ⇒ Object
load this engine’s config (rails_config default loads from only Rails.root/config/…)
13 14 15 16 17 18 |
# File 'lib/edgarj/engine.rb', line 13 def self.load_config engine_config_dir = Pathname.new(File.('../../../config', __FILE__)) Settings.prepend_source!((engine_config_dir + 'settings.yml').to_s) Settings.prepend_source!((engine_config_dir + "settings/#{Rails.env}.yml").to_s) Settings.reload! end |
.load_decorators ⇒ Object
Require/load (based on config) all decorators from app/decorators/
thanks:
36 37 38 39 40 41 42 43 44 |
# File 'lib/edgarj/engine.rb', line 36 def self.load_decorators [ Dir.glob(File.join(Rails.root, "app/decorators/**/*_decorator.rb")) ].flatten.each do |decorator| Rails.application.config.cache_classes ? require(decorator) : load(decorator) end end |
.load_edgarj_conf_in_app ⇒ Object
Require/load application side edgarj config in RAILS_ROOT/config/edgarj/
21 22 23 24 25 26 27 28 29 |
# File 'lib/edgarj/engine.rb', line 21 def self.load_edgarj_conf_in_app [ Dir.glob(File.join(Rails.root, "config/edgarj/**/*.rb")) ].flatten.each do |edgarj_conf| Rails.application.config.cache_classes ? require(edgarj_conf) : load(edgarj_conf) end end |
.make_work_dir ⇒ Object
make edgarj related work directories
47 48 49 50 51 |
# File 'lib/edgarj/engine.rb', line 47 def self.make_work_dir for dir in [Settings.edgarj.work_dir, Settings.edgarj.csv_dir] do FileUtils.mkdir_p(dir) if !File.directory?(dir) end end |