Project

General

Profile

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

foreman_pipeline / lib / foreman_pipeline / engine.rb @ 9fff3c7b

1
module ForemanPipeline
2
  class Engine < ::Rails::Engine
3
    isolate_namespace ForemanPipeline
4
    require 'foreman_deployments'
5
    require 'bastion'
6
    require 'katello'
7

    
8
    initializer 'foreman_pipeline.mount_engine', :after => :build_middleware_stack do |app|
9
      app.routes_reloader.paths << "#{ForemanPipeline::Engine.root}/config/mount_engine.rb"
10
    end
11

    
12
    initializer 'foreman_pipeline.load_app_instance_data' do |app|
13
      app.config.paths['db/migrate'] += ForemanPipeline::Engine.paths['db/migrate'].existent
14
      app.config.autoload_paths += Dir["#{config.root}/app/lib"]
15
      app.config.autoload_paths += Dir["#{config.root}/app/views/foreman"]
16
    end
17

    
18
    initializer 'foreman_pipeline.register_plugin', :after => :finisher_hook do
19
      require 'foreman_pipeline/plugin'
20
      require 'foreman_pipeline/permissions'
21
      require 'foreman_pipeline/roles'
22
    end
23

    
24
    initializer 'foreman_pipeline.assets', :group => :all do |app|
25
      SETTINGS[:foreman_pipeline] = {
26
        :assets => {
27
          :precompile => [
28
            'foreman_pipeline/foreman_pipeline.js'
29
          ]
30
        }
31
      }
32
    end
33

    
34
    initializer "foreman_pipeline.apipie" do
35
      Apipie.configuration.checksum_path += ['/foreman_pipeline/api/']
36
    end
37

    
38
    initializer 'foreman_pipeline.register_actions', :before => 'foreman_tasks.initialize_dynflow' do |app|
39
      ForemanTasks.dynflow.require!
40

    
41
      action_paths = %W(#{ForemanPipeline::Engine.root}/app/lib/actions)
42

    
43
      ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)
44
    end
45

    
46
    config.to_prepare do
47

    
48
      ::Bastion.register_plugin({
49
        :name => 'foreman_pipeline',
50
        :javascript => 'foreman_pipeline/foreman_pipeline',
51
        :stylesheet => 'foreman_pipeline/foreman_pipeline',
52
        :pages => %w(
53
            jobs
54
            jenkins_instances
55
          )
56
        })
57

    
58
      # extensions
59
      ::Katello::Repository.send :include, ForemanPipeline::Concerns::RepositoryExtension
60
      ::Katello::ContentViewRepository.send :include, ForemanPipeline::Concerns::ContentViewRepositoryExtension
61
      ::Katello::ContentView.send :include, ForemanPipeline::Concerns::ContentViewExtension
62
      ::Katello::KTEnvironment.send :include, ForemanPipeline::Concerns::KtEnvironmentExtension
63
      ::Hostgroup.send :include, ForemanPipeline::Concerns::HostgroupExtension
64
      ::ComputeResource.send :include, ForemanPipeline::Concerns::ComputeResourceExtension
65
    end
66

    
67
    rake_tasks do
68
      load "#{ForemanPipeline::Engine.root}/lib/foreman_pipeline/tasks/foreman_pipeline_seed.rake"
69
      load "#{ForemanPipeline::Engine.root}/lib/foreman_pipeline/tasks/foreman_pipeline_test.rake"
70
    end
71

    
72
  end
73
end