class Yoda::Store::Project

Attributes

registry[R]

@return [Registry, nil]

root_path[R]

@return [String]

Public Class Methods

new(root_path) click to toggle source

@param root_path [String]

# File lib/yoda/store/project.rb, line 16
def initialize(root_path)
  fail ArgumentError, root_path unless root_path.is_a?(String)

  @root_path = File.absolute_path(root_path)
end

Public Instance Methods

build_cache() click to toggle source

@return [Array<BaseError>]

# File lib/yoda/store/project.rb, line 35
def build_cache
  setup
  loader = LibraryDocLoader.build_for(self)
  loader.run
  load_project_files
  loader.errors
end
clear() click to toggle source

Delete all data from registry

# File lib/yoda/store/project.rb, line 29
def clear
  setup
  registry.clear
end
read_source(source_path) click to toggle source

@param source_path [String]

# File lib/yoda/store/project.rb, line 53
def read_source(source_path)
  Actions::ReadFile.run(registry, source_path)
end
rebuild_cache() click to toggle source
# File lib/yoda/store/project.rb, line 43
def rebuild_cache
  clear
  build_cache
end
setup() click to toggle source
# File lib/yoda/store/project.rb, line 22
def setup
  return if registry
  make_dir
  @registry = cache.prepare_registry
end
yoda_dir() click to toggle source
# File lib/yoda/store/project.rb, line 48
def yoda_dir
  File.expand_path('.yoda', root_path)
end

Private Instance Methods

cache() click to toggle source

@return [Cache]

# File lib/yoda/store/project.rb, line 70
def cache
  @cache ||= Cache.build_for(self)
end
load_project_files() click to toggle source
# File lib/yoda/store/project.rb, line 59
def load_project_files
  Logger.debug('Loading current project files...')
  Instrument.instance.initialization_progress(phase: :load_project_files, message: 'Loading current project files')
  Actions::ReadProjectFiles.new(registry, root_path).run
end
make_dir() click to toggle source
# File lib/yoda/store/project.rb, line 65
def make_dir
  File.exist?(yoda_dir) || FileUtils.mkdir(yoda_dir)
end