Db Update draft

This commit is contained in:
erwanlr
2014-09-10 12:52:52 +02:00
parent eb73025338
commit d1a7a0ee1f
4 changed files with 102 additions and 8 deletions

View File

@@ -1,23 +1,20 @@
# encoding: UTF-8
# Factory
class UpdaterFactory
def self.get_updater(repo_directory)
self.available_updaters_classes().each do |updater_symbol|
available_updaters_classes.each do |updater_symbol|
updater = Object.const_get(updater_symbol).new(repo_directory)
if updater.is_installed?
return updater
end
return updater if updater.is_installed?
end
nil
end
protected
# return array of class symbols
# @return [ Array<Symbol> ] The symbols related to code updaters
def self.available_updaters_classes
Object.constants.grep(/^.+Updater$/)
Object.constants.grep(/^(?:Svn|Git|Test)Updater$/)
end
end