class Retrospec::Plugins::V1::Plugin

Attributes

config_data[RW]
module_path[RW]
plugin_name[R]

Public Class Methods

file_type() click to toggle source

the main file type that is used to help discover what the module is

# File lib/retrospec/plugins/v1/plugin.rb, line 58
def self.file_type
  raise NotImplementedError
end
new(supplied_module_path='.',config={}) click to toggle source
# File lib/retrospec/plugins/v1/plugin.rb, line 18
def initialize(supplied_module_path='.',config={})
  @config_data = config
  @module_path = File.expand_path(supplied_module_path)
end
plugin_name() click to toggle source

the name of the plugin that will be sent to the cli the cli turns this into a subcommand where the user interacts with your plugin

# File lib/retrospec/plugins/v1/plugin.rb, line 48
def self.plugin_name
  self.name.split('::').last.downcase
end
run_cli(global_opts, global_config, plugin_config) click to toggle source

used to display subcommand options to the cli the global options are passed in for your usage

# File lib/retrospec/plugins/v1/plugin.rb, line 42
def self.run_cli(global_opts, global_config, plugin_config)
  raise NotImplemented
end
valid_module_dir?(dir) click to toggle source

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 this is used in the discover method

# File lib/retrospec/plugins/v1/plugin.rb, line 27
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

Public Instance Methods

config=(config_map) click to toggle source

sets the config which should be a hash

# File lib/retrospec/plugins/v1/plugin.rb, line 53
def config=(config_map)
  @config = config_map
end
run() click to toggle source

the main entry point that is called when retrospec is run using this as the starting point after initialization

# File lib/retrospec/plugins/v1/plugin.rb, line 64
def run
  raise NotImplementedError
end