Sha256: 3ccc0dd13dfd811bb6a0a4da68e77f82005df2fd5d5e00be34b2c4211036414f

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'deface'
require 'discovery_home_helper_patch'

module ForemanDiscovery
  #Inherit from the Rails module of the parent app (Foreman), not the plugin.
  #Thus, inherits from ::Rails::Engine and not from Rails::Engine
  class Engine < ::Rails::Engine

    # Load this before the Foreman config initizializers, so that the Setting.descendants
    # list includes the plugin STI setting class
    initializer 'foreman_discovery.load_default_settings', :before => :load_config_initializers do |app|
      require_dependency File.expand_path("../../../app/models/setting/discovered.rb", __FILE__)
    end

    initializer 'foreman_discovery.helper' do |app|
      ActionView::Base.send :include, DiscoversHelper
    end

    # Include extenstions to models in this config.to_prepare block
    config.to_prepare do
      # Include host extenstions
      ::Host::Managed.send :include, Host::ManagedExtensions
      # Patch the menu
      ::HomeHelper.send :include, DiscoveryHomeHelperPatch
    end

    rake_tasks do
      load "tasks.rake"
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0.rc3 lib/foreman_discovery/engine.rb
foreman_discovery-1.0.0.rc2 lib/foreman_discovery/engine.rb
foreman_discovery-1.0.0.rc1 lib/foreman_discovery/engine.rb