Sha256: 46852fec7836a2db2230915cd89382f2fb8f559125866cc5925cd9456aa300c9

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# This module contains basic Upload plugin functions to control template
# sample and field management for the Plugin Manager.
#
module Dradis
  module Plugins
    module Upload
      class Base
        attr_accessor :content_service, :logger, :template_service

        def initialize(args={})
          @logger = args.fetch(:logger, Rails.logger)

          @content_service = args[:content_service] || default_content_service
          @template_service = args[:template_service] || default_template_service

          content_service.logger = logger
          template_service.logger = logger

          post_initialize(args)
        end

        def import(args={})
          raise "The import() method is not implemented in this plugin [#{self.class.name}]."
        end

        # This method can be overwriten by plugins to do initialization tasks.
        def post_initialize(args={})
        end

        private
        def default_content_service
          @content ||= Dradis::Plugins::ContentService.new
        end

        def default_template_service
          @template ||= Dradis::Plugins::TemplateService.new
        end
      end # Base

    end # Upload
  end # Plugins
end # Core

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dradis-plugins-3.0.0 lib/dradis/plugins/upload/base.rb
dradis-plugins-3.0.0.pre lib/dradis/plugins/upload/base.rb