diff --git a/lib/teracy-dev.rb b/lib/teracy-dev.rb index bf6a7256..85f1bd4a 100644 --- a/lib/teracy-dev.rb +++ b/lib/teracy-dev.rb @@ -25,19 +25,6 @@ def self.register_configurator(configurator) @@loader.configManager.register(configurator) end - # find the extension lookup_path by its name - def self.extension_lookup_path(extension_name) - extensions = @@loader.settings['teracy-dev']['extensions'] ||= [] - extensions.each do |ext| - manifest = Extension::Manager.manifest(ext) - if manifest['name'] == extension_name - return ext['path']['lookup'] - end - end - # extension_name not found - return nil - end - @@loader.start end diff --git a/lib/teracy-dev/util.rb b/lib/teracy-dev/util.rb index ac6cbcce..2760e1b1 100644 --- a/lib/teracy-dev/util.rb +++ b/lib/teracy-dev/util.rb @@ -17,6 +17,21 @@ def self.exist?(value) end + # find the extension lookup_path by its name from the provided settings + def self.extension_lookup_path(settings, extension_name) + @@logger.debug("settings: #{settings}") + extensions = settings['teracy-dev']['extensions'] ||= [] + extensions.each do |ext| + manifest = Extension::Manager.manifest(ext) + if manifest['name'] == extension_name + return ext['path']['lookup'] + end + end + # extension_name not found + return nil + end + + def self.load_yaml_file(file_path) if File.exist? file_path # TODO: exception handling