Sha256: f815da2d597c6605126d9231d18509c450ef9cdfd4f3f9d644c8deb6e6dbeac9

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 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__) if (Setting.table_exists? rescue(false))
    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.1.1 lib/foreman_discovery/engine.rb
foreman_discovery-1.0.2 lib/foreman_discovery/engine.rb
foreman_discovery-1.0.0 lib/foreman_discovery/engine.rb