Class: Yoda::Store::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/store/project.rb,
lib/yoda/store/project/cache.rb,
lib/yoda/store/project/library_doc_loader.rb

Defined Under Namespace

Classes: Cache, LibraryDocLoader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ Project

Returns a new instance of Project.

Parameters:

  • root_path (String)


16
17
18
19
20
# 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

Instance Attribute Details

#registryRegistry? (readonly)

Returns:



13
14
15
# File 'lib/yoda/store/project.rb', line 13

def registry
  @registry
end

#root_pathString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/yoda/store/project.rb', line 10

def root_path
  @root_path
end

Instance Method Details

#build_cacheArray<BaseError>

Returns:



35
36
37
38
39
40
41
# 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

#clearObject

Delete all data from registry



29
30
31
32
# File 'lib/yoda/store/project.rb', line 29

def clear
  setup
  registry.clear
end

#read_source(source_path) ⇒ Object

Parameters:

  • source_path (String)


53
54
55
# File 'lib/yoda/store/project.rb', line 53

def read_source(source_path)
  Actions::ReadFile.run(registry, source_path)
end

#rebuild_cacheObject



43
44
45
46
# File 'lib/yoda/store/project.rb', line 43

def rebuild_cache
  clear
  build_cache
end

#setupObject



22
23
24
25
26
# File 'lib/yoda/store/project.rb', line 22

def setup
  return if registry
  make_dir
  @registry = cache.prepare_registry
end

#yoda_dirObject



48
49
50
# File 'lib/yoda/store/project.rb', line 48

def yoda_dir
  File.expand_path('.yoda', root_path)
end