Project

General

Profile

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

foreman_pipeline / lib / foreman_pipeline / engine.rb @ a8170cc8

1
require 'foreman_pipeline/monkeys'
2
require 'bastion'
3
require 'katello'
4
require 'net/ssh'
5
require 'net/scp'
6

    
7
module ForemanPipeline
8
  class Engine < ::Rails::Engine
9
    isolate_namespace ForemanPipeline
10

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

    
15
    initializer 'foreman_pipeline.load_app_instance_data' do |app|
16
      ForemanPipeline::Engine.paths['db/migrate'].existent.each do |path|
17
        app.config.paths['db/migrate'] << path
18
      end
19
      app.config.autoload_paths += Dir["#{config.root}/app/lib"]
20
      app.config.autoload_paths += Dir["#{config.root}/app/views/foreman"]
21
    end
22

    
23
    initializer 'foreman_pipeline.register_plugin', :after => :finisher_hook do
24
      require 'foreman_pipeline/plugin'
25
      require 'foreman_pipeline/permissions'
26
      require 'foreman_pipeline/roles'
27
    end
28

    
29
    initializer 'foreman_pipeline.assets', :group => :all do |app|
30
      SETTINGS[:foreman_pipeline] = {
31
        :assets => {
32
          :precompile => [
33
            'foreman_pipeline/foreman_pipeline.js'
34
          ]
35
        }
36
      }
37
    end
38

    
39
    initializer "foreman_pipeline.apipie" do
40
      Apipie.configuration.checksum_path += ['/foreman_pipeline/api/']
41
    end
42

    
43
    initializer 'foreman_pipeline.register_actions', :before => 'foreman_tasks.initialize_dynflow' do |app|
44
      ForemanTasks.dynflow.require!
45

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

    
48
      ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)
49
    end
50

    
51
    config.to_prepare do
52

    
53
      ::Bastion.register_plugin({
54
        :name => 'foreman_pipeline',
55
        :javascript => 'foreman_pipeline/foreman_pipeline',
56
        :stylesheet => 'foreman_pipeline/foreman_pipeline',
57
        :pages => %w(
58
            jobs
59
            jenkins_instances
60
          )
61
        })
62

    
63
      # extensions
64
      ::Katello::Repository.send :include, ForemanPipeline::Concerns::RepositoryExtension
65
      ::Katello::ContentViewRepository.send :include, ForemanPipeline::Concerns::ContentViewRepositoryExtension
66
      ::Katello::ContentView.send :include, ForemanPipeline::Concerns::ContentViewExtension
67
      ::Katello::KTEnvironment.send :include, ForemanPipeline::Concerns::KtEnvironmentExtension
68
      ::Hostgroup.send :include, ForemanPipeline::Concerns::HostgroupExtension
69
      ::ComputeResource.send :include, ForemanPipeline::Concerns::ComputeResourceExtension
70
    end
71

    
72
    rake_tasks do
73
      load "#{ForemanPipeline::Engine.root}/lib/foreman_pipeline/tasks/foreman_pipeline_seed.rake"
74
      load "#{ForemanPipeline::Engine.root}/lib/foreman_pipeline/tasks/foreman_pipeline_test.rake"
75
    end
76

    
77
  end
78
end