Sha256: 65bd7fa6d6b421d55e62688611b6eb5118b6d2657c94e1990baf1bc1ac8c975a

Contents?: true

Size: 1.36 KB

Versions: 3

Compression:

Stored size: 1.36 KB

Contents

require 'fast_gettext'
require 'gettext_i18n_rails'
require 'fog'

module ForemanDigitalocean
  # 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
    engine_name 'foreman_digitalocean'

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

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

    initializer 'foreman_digitalocean.register_plugin', :after => :finisher_hook do
      Foreman::Plugin.register :foreman_digitalocean do
        requires_foreman '> 1.4'
        compute_resource ForemanDigitalocean::Digitalocean
      end
    end
  end

  require 'fog/digitalocean'
  require 'fog/digitalocean/models/compute/image'
  require 'fog/digitalocean/models/compute/server'
  require File.expand_path('../../../app/models/concerns/fog_extensions/digitalocean/server', __FILE__)
  require File.expand_path('../../../app/models/concerns/fog_extensions/digitalocean/image', __FILE__)
  Fog::Compute::DigitalOcean::Image.send(:include, FogExtensions::DigitalOcean::Image)
  Fog::Compute::DigitalOcean::Server.send(:include, FogExtensions::DigitalOcean::Server)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_digitalocean-0.1.0 lib/foreman_digitalocean/engine.rb
foreman_digitalocean-0.0.3 lib/foreman_digitalocean/engine.rb
foreman_digitalocean-0.0.2 lib/foreman_digitalocean/engine.rb