Project

General

Profile

Download (1.36 KB) Statistics
| Branch: | Tag: | Revision:

foreman_docker / lib / foreman_docker / engine.rb @ 29812b3a

1
require 'fast_gettext'
2
require 'gettext_i18n_rails'
3
require 'fog'
4
require 'fog/fogdocker'
5

    
6
module ForemanDocker
7
  #Inherit from the Rails module of the parent app (Foreman), not the plugin.
8
  #Thus, inherits from ::Rails::Engine and not from Rails::Engine
9
  class Engine < ::Rails::Engine
10

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

    
15
      Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
16
    end
17

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

    
25
    end
26

    
27
  end
28

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