Sha256: 922bae760bd8a7cd0151e93df6a4f0df05bf8956b9220885f4ad91e5f41b691b

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

require 'fast_gettext'
require 'gettext_i18n_rails'
require 'fog'
require 'fog/fogdocker'

module ForemanDocker
  #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

    initializer 'foreman_docker.register_gettext', :after => :load_config_initializers do |app|
      locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
      locale_domain = 'docker'

      Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
    end

    initializer 'foreman_docker.register_plugin', :after=> :finisher_hook do |app|
      Foreman::Plugin.register :foreman_docker do
        requires_foreman '> 1.4'
        # Register docker compute resource in foreman
        compute_resource ForemanDocker::Docker
      end

    end

  end

  # extend fog docker server and image models.
  require 'fog/fogdocker/models/compute/server'
  require 'fog/fogdocker/models/compute/image'
  require File.expand_path('../../../app/models/concerns/fog_extensions/fogdocker/server', __FILE__)
  require File.expand_path('../../../app/models/concerns/fog_extensions/fogdocker/image', __FILE__)
  Fog::Compute::Fogdocker::Server.send(:include, ::FogExtensions::Fogdocker::Server)
  Fog::Compute::Fogdocker::Image.send(:include, ::FogExtensions::Fogdocker::Image)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_docker-0.0.3 lib/foreman_docker/engine.rb
foreman_docker-0.0.2 lib/foreman_docker/engine.rb