Sha256: d135081288040e2e975b42c34504aa5445671105bf403806a79cf41cb65663c3

Contents?: true

Size: 1.07 KB

Versions: 24

Compression:

Stored size: 1.07 KB

Contents

module Dradis
  module Plugins
    module Base
      extend ActiveSupport::Concern

      included do
        # mattr_accessor :plugin_name

        @features = []
        @name = 'Use plugin_info(args) with :name to provide a name for this plugin.'
        Plugins::register(self)

        # Extend the engine with other functionality
        include Dradis::Plugins::Configurable
        include Dradis::Plugins::Templates
        include Dradis::Plugins::Thor
      end

      module ClassMethods
        def description(new_description)
          @description = new_description
        end

        def plugin_description
          @description ||= "This plugin doesn't provide a :description"
        end

        def plugin_name
          @plugin_name ||= self.name.split('::')[-2].underscore.to_sym
        end

        def provides(*list)
          @features = list
          if list.include?(:upload)
            include Dradis::Plugins::Upload::Base
          end
        end

        def provides?(feature)
          @features.include?(feature)
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
dradis-plugins-3.8.0 lib/dradis/plugins/base.rb
dradis-plugins-3.7.0 lib/dradis/plugins/base.rb
dradis-plugins-3.6.0 lib/dradis/plugins/base.rb
dradis-plugins-3.5.0 lib/dradis/plugins/base.rb