Skip to content

Commit

Permalink
@ teracyhq#277 | move extension_lookup_path to util
Browse files Browse the repository at this point in the history
  • Loading branch information
hoatle committed Aug 16, 2018
1 parent 2b11603 commit 1ae28fb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/teracy-dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions lib/teracy-dev/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ae28fb

Please sign in to comment.