29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 
     | 
    
      # File 'lib/dradis/plugins/templates/migrate_templates.rb', line 29
def migrate_templates_to_mappings(args = {})
    return unless paths['dradis/templates'].existent.any?
  @integration_name = plugin_name.to_s
    return if ::Mapping.where(component: @integration_name).any?
  templates_dir = args.fetch(:from)
  integration_templates_dir = File.join(templates_dir, @integration_name)
  if uploaders.count > 1
    migrate_multiple_uploaders(@integration_name, integration_templates_dir)
  else
    template_files = Dir["#{integration_templates_dir}/*.template"]
    return unless template_files.any?
    template_files.each do |template_file|
      next unless File.exist?(template_file)
      source = File.basename(template_file, '.template')
            migrate(template_file, source)
      rename_file(template_file)
    end
  end
end
     |