mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-06 05:25:29 +00:00
c7ec4f5b9a
* plugins no longer need to implement unused functions * config now is extensible to support changing plugin needs git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@55 bf332499-1b4d-0410-844d-d2d48d5cc64c
26 lines
894 B
Ruby
26 lines
894 B
Ruby
|
|
require "#{$here}/cmock_generator_plugin_expect.rb"
|
|
require "#{$here}/cmock_generator_plugin_ignore.rb"
|
|
require "#{$here}/cmock_generator_plugin_cexception.rb"
|
|
|
|
class CMockPluginManager
|
|
|
|
attr_accessor :plugins
|
|
|
|
def initialize(config, utils)
|
|
plugins_to_load = config.plugins
|
|
@plugins = []
|
|
@plugins << CMockGeneratorPluginExpect.new( config, utils )
|
|
@plugins << CMockGeneratorPluginCException.new( config, utils ) if plugins_to_load.include? 'cexception'
|
|
@plugins << CMockGeneratorPluginIgnore.new( config, utils ) if plugins_to_load.include? 'ignore'
|
|
end
|
|
|
|
def run(method, args=nil)
|
|
if args.nil?
|
|
return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten
|
|
else
|
|
return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten
|
|
end
|
|
end
|
|
end
|