Sha256: 96ebf972590203d718f8c7f9893f7e44c7bf2a72d29f5cd4f343203803aeb21d

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Retrospec
  module Plugin
    module V1
      attr_accessor :module_path, :module_name, :module_dir_name, :config
      attr_reader   :files, :plugin_name

      # validates that the module meets the plugins criteria
      # returns boolean true if module files are valid, false otherwise
      # validates module directory fits the description of this plugin
      def self.valid_module_dir?(dir)
        if ! File.exist?(dir)
          false
        else
          module_files ||= Dir.glob("#{dir}/**/*#{file_type}")
          if module_files.length < 1
            false
          else
            true
          end
        end
      end

      # sets the config which should be a hash
      def config=(config_map)
        @config = config_map
      end

      # the name of the plugin, defaults to the name of the class
      def self.plugin_name
        self.class.downcase
      end

      # the main file type that is used to help discover what the module is
      def self.file_type
        raise NotImplementedError
      end

      def run
        raise NotImplementedError
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
retrospec-0.1.0 lib/retrospec/plugins/v1/instance.rb