Skip to content

Commit

Permalink
@ #277 | use DEFAULT_EXTENSION_LOOKUP_PATH constant
Browse files Browse the repository at this point in the history
  • Loading branch information
hoatle committed Aug 17, 2018
1 parent 0f91f07 commit 6c18021
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/teracy-dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module TeracyDev

BASE_DIR = File.join(File.dirname(__FILE__), '..')
EXTENSION_ENTRY_PATH = ENV['TERACY_DEV_EXTENSION_ENTRY_PATH'] ||= 'workspace/teracy-dev-entry'
DEFAULT_EXTENSION_LOOKUP_PATH = 'extensions' # relative to the Vagrantfile

@@logger = TeracyDev::Logging.logger_for(self)
# we can only create one Loader instance and accessible on this only
Expand Down
4 changes: 2 additions & 2 deletions lib/teracy-dev/extension/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def install(extensions)

def sync(extension)
return if extension['enabled'] != true
lookup_path = File.join(TeracyDev::BASE_DIR, extension['path']['lookup'] || 'extensions')
lookup_path = File.join(TeracyDev::BASE_DIR, extension['path']['lookup'] ||= DEFAULT_EXTENSION_LOOKUP_PATH)
path = File.join(lookup_path, extension['path']['extension'])
git = extension['location']['git'] # maybe we'll support for protocols
branch = extension['location']['tag'] || extension['location']['branch']
branch = extension['location']['tag'] ||= extension['location']['branch']
ref = extension['location']['ref'] # TODO: support sync to a specific revision

@logger.debug("path: #{path}")
Expand Down
2 changes: 1 addition & 1 deletion lib/teracy-dev/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def load_extension_entry_files(settings)
extensions = settings['teracy-dev']['extensions'] ||= []
extensions.each do |extension|
next if extension['enabled'] != true
lookup_path = File.join(TeracyDev::BASE_DIR, extension['path']['lookup'] || 'extensions')
lookup_path = File.join(TeracyDev::BASE_DIR, extension['path']['lookup'] ||= DEFAULT_EXTENSION_LOOKUP_PATH)
path = File.join(lookup_path, extension['path']['extension'])
entry_file_path = File.join(path, 'teracy-dev-ext.rb')
@logger.debug("load_extension_entry_files: entry_file_path: #{entry_file_path}")
Expand Down
2 changes: 1 addition & 1 deletion lib/teracy-dev/settings/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def build_extensions_settings(extensions)
extensions_settings = []
extensions.each do |extension|
next if extension['enabled'] != true
lookup_path = File.join(TeracyDev::BASE_DIR, extension['path']['lookup'] || 'extensions')
lookup_path = File.join(TeracyDev::BASE_DIR, extension['path']['lookup'] ||= DEFAULT_EXTESION_LOOKUP_PATH)
path = File.join(lookup_path, extension['path']['extension'])
extensions_settings << Util.build_settings_from(File.join(path, 'config_default.yaml'))
end
Expand Down

0 comments on commit 6c18021

Please sign in to comment.