Sha256: 710db8923b109e40efef072534c8cf88b5e6adbaf60dc7d18baa31c00bbe7f7f

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 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

    rake_tasks do
      load "#{ForemanDigitalocean::Engine.root}/lib/foreman_digitalocean/tasks/test.rake"
    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

1 entries across 1 versions & 1 rubygems

Version Path
foreman_digitalocean-0.0.1 lib/foreman_digitalocean/engine.rb