Class: Diggit::Analysis Abstract

Inherits:
Runnable show all
Defined in:
lib/dgit/plugins.rb

Overview

This class is abstract.

Subclass and override run and clean to implement a custom analysis class.

Base class for analyses. Diggit analyses are applied on each source that has been succesfully cloned. They can access the Diggit addons through the addons attribute.

Examples:

A sample analysis using an addon

class AnalysisWithAddon < Diggit::Analysis
	require_addons "db"

	def run
		db.do_something
		puts @options
		puts @source
		puts "Runned!"
	end

	def clean
		puts "Cleaned!"
	end
end

See Also:

Instance Attribute Summary collapse

Attributes inherited from Runnable

#addons

Attributes inherited from Plugin

#options

Instance Method Summary collapse

Methods inherited from Runnable

#clean, require_addons, required_addons, #run

Methods inherited from Plugin

#name, name, #read_option

Constructor Details

#initialize(options) ⇒ Analysis

Returns a new instance of Analysis.



180
181
182
183
# File 'lib/dgit/plugins.rb', line 180

def initialize(options)
	super(options)
	@source = nil
end

Instance Attribute Details

#sourceSource

Returns the source to be analyzed.

Returns:

  • (Source)

    the source to be analyzed.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/dgit/plugins.rb', line 177

class Analysis < Runnable
	attr_accessor :source

	def initialize(options)
		super(options)
		@source = nil
	end

	# Returns the rugged repository associated to the source.
	#
	# @return [Rugged::Repository]
	def repo
		@source.repository
	end
end

Instance Method Details

#repoRugged::Repository

Returns the rugged repository associated to the source.

Returns:

  • (Rugged::Repository)


188
189
190
# File 'lib/dgit/plugins.rb', line 188

def repo
	@source.repository
end