class Lookbook::Engine
def app_name
def app_name name = if Rails.application.class.respond_to?(:module_parent_name) Rails.application.class.module_parent_name else Rails.application.class.parent_name end name.underscore end
def component_paths
def component_paths @_component_paths ||= Array(PathUtils.to_absolute(opts.components_path)) end
def file_watcher
def file_watcher @_file_watcher ||= FileWatcher.new(force_polling: opts.listen_use_polling) end
def hooks
def hooks @_hooks ||= HookStore.init_from_config end
def inputs
def inputs @_inputs ||= InputStore.init_from_config end
def last_changed
def last_changed @_last_changed ||= (Time.now.to_f * 1000).to_i end
def listen?
def listen? opts.listen && process.supports_listening? end
def mark_changed
def mark_changed @_last_changed = nil end
def mount_path
def mount_path routes.find_script_name({}) end
def mounted?
def mounted? mount_path.present? end
def opts
def opts Lookbook.config end
def page_paths
def page_paths @_page_paths ||= PathUtils.normalize_paths(opts.page_paths) end
def pages
def pages @_pages ||= PageCollection.new end
def panels
def panels @_panels ||= PanelStore.init_from_config end
def parser
def parser @_parser ||= PreviewParser.new(opts.preview_paths, Engine.tags) end
def preview_paths
def preview_paths @_preview_paths ||= PathUtils.normalize_paths(opts.preview_paths) end
def previews
def previews @_previews ||= PreviewCollection.new end
def process
def process @_process ||= Process.new(env: Rails.env) end
def run_hooks(event_name, *args)
def run_hooks(event_name, *args) Engine.hooks.for_event(event_name).each do |hook| hook.call(Lookbook, *args) end end
def tags
def tags @_tags ||= TagStore.init_from_config end
def websocket
def websocket if mounted? use_websocket = opts.auto_refresh && opts.listen && process.supports_listening? @websocket ||= use_websocket ? Websocket.new(mount_path, logger: Lookbook.logger) : Websocket.noop else Websocket.noop end end