Project

General

Profile

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

foreman_pipeline / lib / foreman_pipeline / engine.rb @ be52ca64

1
module ForemanPipeline
2
  class Engine < ::Rails::Engine
3
    isolate_namespace ForemanPipeline
4

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

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

    
15
    initializer 'foreman_pipeline.register_plugin', :after => :finisher_hook do
16
      require 'foreman_pipeline/plugin'
17
      require 'foreman_pipeline/permissions'
18
    end 
19

    
20
    initializer 'foreman_pipeline.assets', :group => :all do |app|
21
      SETTINGS[:foreman_pipeline] = {
22
        :assets => {
23
          :precompile => [
24
            'foreman_pipeline/foreman_pipeline.js'
25
          ]
26
        }
27
      }
28
    end
29

    
30
    initializer 'foreman_pipeline.register_actions', :before => 'foreman_tasks.initialize_dynflow' do |app|
31
      ForemanTasks.dynflow.require!
32

    
33
      action_paths = %W(#{ForemanPipeline::Engine.root}/app/lib/actions)
34
      
35
      ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)
36
    end
37

    
38
    config.to_prepare do
39
      
40
      Bastion.register_plugin({
41
        :name => 'foreman_pipeline',
42
        :javascript => 'foreman_pipeline/foreman_pipeline',
43
        :stylesheet => 'foreman_pipeline/foreman_pipeline',
44
        :pages => %w(
45
            jobs
46
            jenkins_instances
47
          )
48
        })
49

    
50
      # extensions
51
      ::Katello::Repository.send :include, ForemanPipeline::Concerns::RepositoryExtension
52
      ::Katello::ContentViewRepository.send :include, ForemanPipeline::Concerns::ContentViewRepositoryExtension
53
      ::Katello::ContentView.send :include, ForemanPipeline::Concerns::ContentViewExtension
54
      ::Katello::KTEnvironment.send :include, ForemanPipeline::Concerns::KtEnvironmentExtension
55
      ::Hostgroup.send :include, ForemanPipeline::Concerns::HostgroupExtension
56
      ::ComputeResource.send :include, ForemanPipeline::Concerns::ComputeResourceExtension
57
    end
58

    
59
    rake_tasks do
60
      load "#{ForemanPipeline::Engine.root}/lib/foreman_pipeline/tasks/foreman_pipeline_seed.rake"
61
      load "#{ForemanPipeline::Engine.root}/lib/foreman_pipeline/tasks/foreman_pipeline_test.rake"
62
    end
63
       
64
  end
65
end