Sha256: 17196487115ff51e27d93725659e7958eae6db7a04dab6812d040c80463244ed

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

module ForemanAzureRm
  class Engine < ::Rails::Engine
    engine_name 'foreman_azure_rm'

    #autoloading all files inside lib dir
    config.eager_load_paths += Dir["#{config.root}/lib"]
    config.eager_load_paths += Dir["#{config.root}/app/models/concerns/foreman_azure_rm/vm_extensions/"]

    initializer 'foreman_azure_rm.register_plugin', :before => :finisher_hook do
      Foreman::Plugin.register :foreman_azure_rm do
        requires_foreman '>= 1.17'
        compute_resource ForemanAzureRm::AzureRm
        parameter_filter ComputeResource, :azure_vm, :tenant, :app_ident, :secret_key, :sub_id, :region
      end
    end

    initializer "foreman_azure_rm.add_rabl_view_path" do
      Rabl.configure do |config|
        config.view_paths << ForemanAzureRm::Engine.root.join('app', 'views')
      end
    end

    initializer 'foreman_azure_rm.register_gettext', after: :load_config_initializers do
      locale_dir    = File.join(File.expand_path('../../../', __FILE__), 'locale')
      locale_domain = 'foreman_azure_rm'
      Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
    end

    config.to_prepare do
      require 'azure_mgmt_resources'
      require 'azure_mgmt_network'
      require 'azure_mgmt_storage'
      require 'azure_mgmt_compute'

      # Use excon as default so that HTTP Proxy settings of foreman works
      Faraday::default_adapter=:excon

      ::HostsController.send(:include, ForemanAzureRm::Concerns::HostsControllerExtensions)

      Api::V2::ComputeResourcesController.send(:include, ForemanAzureRm::Concerns::ComputeResourcesControllerExtensions)
    end

    rake_tasks do
      load "foreman_azure_rm.rake"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_azure_rm-2.0.6 lib/foreman_azure_rm/engine.rb
foreman_azure_rm-2.0.5 lib/foreman_azure_rm/engine.rb
foreman_azure_rm-2.0.4 lib/foreman_azure_rm/engine.rb