Module: Dradis::Plugins::Templates::Samples::ClassMethods

Defined in:
lib/dradis/plugins/templates/samples.rb

Instance Method Summary collapse

Instance Method Details

#copy_samples(args = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dradis/plugins/templates/samples.rb', line 13

def copy_samples(args = {})
  destination = args.fetch(:to)

  destination_dir = File.join(destination, plugin_name.to_s)
  FileUtils.mkdir_p(destination_dir) if integration_samples.any?

  integration_samples.each do |template|
    destination_file = File.join(destination_dir, File.basename(template))

    Rails.logger.info do
      "Updating templates for #{plugin_name} plugin. "\
      "Destination: #{destination}"
    end
    FileUtils.cp(template, destination_file)
  end
end