Sha256: 63531ab1d5451c179ecba8c000005c761953c3a4ca29aef31587130e73ba217d

Contents?: true

Size: 1.91 KB

Versions: 7

Compression:

Stored size: 1.91 KB

Contents

require 'express_admin/menu'
require 'express_admin/version'
require 'express_templates'
require 'jquery-rails'
require 'select2-rails'
require 'foundation_apps_styles'
require 'bourbon'
require 'gravatar_image_tag'
require 'kaminari'
require 'responders'
require 'tinymce-rails'
require 'inherited_resources'

# should be a way to add this folder to rails' autoload paths
components = Dir.glob(File.join(File.dirname(__FILE__), '..', '..', 'app', 'components', '**', '*.rb'))
components.each {|component| require component }

module ExpressAdmin
  class Engine < ::Rails::Engine

   initializer :assets do |config|
    engine_assets_path = File.join(File.dirname(__FILE__), '..', '..', 'app', 'assets')
    all_assets = Dir.glob File.join(engine_assets_path, 'stylesheets', '**', '*.css*')
    all_assets += Dir.glob File.join(engine_assets_path, 'javascripts', '**', '*.js*')
    all_assets.each {|path| path.gsub!("#{engine_assets_path}/stylesheets/", '')}
    all_assets.each {|path| path.gsub!("#{engine_assets_path}/javascripts/", '')}
    all_assets.each {|path| path.gsub!("#{engine_assets_path}/fonts/", '')}
    all_assets.each {|path| path.gsub!(/.(scss|coffee)$/, '')}
    Rails.application.config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
    Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
    Rails.application.config.assets.precompile << /\.(?:png)$/
    Rails.application.config.assets.precompile += all_assets
  end

    def all_rails_engines
      Rails.application.eager_load!
      @all_engines ||= ::Rails::Engine.descendants
    end

    # Find all the rails engines that have
    # :addon_name presumably from including
    # ExpressAdmin::Menu::Loader
    def all_addons
      @all_addons ||= all_rails_engines.select do |engine|
        engine.methods.include?(:addon_name)
      end
    end

  end

  class Railtie < ::Rails::Railtie
    config.app_generators.template_engine :et
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
express_admin-1.4.3 lib/express_admin/engine.rb
express_admin-1.4.2 lib/express_admin/engine.rb
express_admin-1.4.1 lib/express_admin/engine.rb
express_admin-1.4.0 lib/express_admin/engine.rb
express_admin-1.3.2 lib/express_admin/engine.rb
express_admin-1.3.1 lib/express_admin/engine.rb
express_admin-1.3.0 lib/express_admin/engine.rb