Class: Lesli::System
- Inherits:
-
Object
- Object
- Lesli::System
- Defined in:
- app/lib/lesli/system.rb
Constant Summary collapse
- ENGINES =
{}
Class Method Summary collapse
-
.engine(engine, property = nil) ⇒ Object
engine(“LesliAdmin”) engine(“LesliAdmin”, “name”).
- .engines ⇒ Object
Class Method Details
.engine(engine, property = nil) ⇒ Object
engine(“LesliAdmin”) engine(“LesliAdmin”, “name”)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/lib/lesli/system.rb', line 39 def self.engine(engine, property=nil) engine = engine.camelize engines() if ENGINES.empty? # the Root engine represents the host Rails app engine = "Root" unless LESLI_ENGINES.include?(engine) # return specific property if requested return ENGINES[engine][property.to_sym] unless property.blank? # return the engine info return ENGINES[engine] end |
.engines ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'app/lib/lesli/system.rb', line 55 def self.engines return ENGINES unless ENGINES.empty? # due we do not know the engine mounted path we have to look up for it every # time we load the html view so we can use the dynamic route from the main rails app # we use this in the url plugin LESLI_ENGINES.each do |engine| next unless Object.const_defined?(engine) engine_instance = "#{engine}".constantize ENGINES[engine] = { :code => engine.underscore, :name => lesli_engine_name(engine), :path => engine_instance::Engine.routes.find_script_name({}), :version => engine_instance::VERSION, :build => engine_instance::BUILD, :dir => Gem::Specification.find_by_name(engine.underscore).gem_dir } end ENGINES["Root"] = { :code => "root", :name => "Root", :path => "/", :version => "1.0.0", :build => "0000000", :dir => Rails.root.to_s } ENGINES end |