Project

General

Profile

Download (604 Bytes) Statistics
| Branch: | Tag: | Revision:

foreman_pipeline / lib / foreman_pipeline / tasks / foreman_pipeline_seed.rake @ dce03a1e

1
namespace :foreman_pipeline  do
2

    
3
  desc "seeding the database"
4
  task :seed => :environment do
5
    defaults = {:default => true, :locked => false}
6
    templates = [{:name => "foreman_pipeline_jenkins_pubkey", :source => "snippets/_jenkins_instance_pubkey.erb", :snippet => true}]
7

    
8
    templates.each do |template|
9
      template[:template] = File.read(File.join(ForemanPipeline::Engine.root, "app/views/foreman/unattended", template.delete(:source)))
10

    
11
      ::ConfigTemplate.find_or_create_by_name(template) do |tmplt|
12
        tmplt.update_attributes(defaults.merge(template))
13
      end
14
    end
15
  end
16
end