class AppKit::Application

Attributes

config[RW]
dashboard_view[RW]
navigation_items[W]
resources[RW]

Public Class Methods

new() click to toggle source
# File lib/app_kit/application.rb, line 8
def initialize
  @config = AppKit::Configuration.new
  @resources = []
  @navigation_items = []
  @dashboard_view = AppKit::Views::Dashboard.new
end

Public Instance Methods

navigation_items(position = :all) click to toggle source
setup!(&block) click to toggle source
# File lib/app_kit/application.rb, line 20
def setup!(&block)
  AppKit::LOAD_PATH.each do |path|
    AppKit::Engine.config.watchable_dirs[path] = [:rb]
  end
  # setup load paths
  ActiveSupport::Dependencies.autoload_paths -= AppKit::LOAD_PATH
  Rails.application.config.eager_load_paths  -= AppKit::LOAD_PATH

  # reload the rails routes after initialization has completed.
  Rails.application.config.after_initialize do
    ActionDispatch::Reloader.to_prepare do
      Rails.application.reload_routes!
    end

    # load DSL files
    files = AppKit::LOAD_PATH.flatten.compact.uniq.map{ |path| Dir["#{path}/**/*.rb"] }.flatten
    files.each { |file| load file }

    # process application dsl
    AppKit.application.instance_exec(&block)
    if config.authentication_enabled?
      require "app_kit/user_resource"
      AppKit::ApplicationController.class_eval("before_filter :authenticate_user!")
    end
  end
end