Class: Yoda::Server::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/server/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root_uri) ⇒ Session

Returns a new instance of Session.

Parameters:

  • root_uri (String)

    an uri expression of project root path



16
17
18
19
20
# File 'lib/yoda/server/session.rb', line 16

def initialize(root_uri)
  @root_uri = root_uri
  @file_store = FileStore.new
  @project = Store::Project.new(root_path)
end

Instance Attribute Details

#file_storeFileStore (readonly)

Returns:



10
11
12
# File 'lib/yoda/server/session.rb', line 10

def file_store
  @file_store
end

#projectStore::Project (readonly)

Returns:



13
14
15
# File 'lib/yoda/server/session.rb', line 13

def project
  @project
end

#root_uriString (readonly)

Returns:

  • (String)


7
8
9
# File 'lib/yoda/server/session.rb', line 7

def root_uri
  @root_uri
end

Instance Method Details

#registryStore::Registry

Returns:



27
28
29
# File 'lib/yoda/server/session.rb', line 27

def registry
  project.registry
end

#reparse_doc(uri) ⇒ Object



44
45
46
47
# File 'lib/yoda/server/session.rb', line 44

def reparse_doc(uri)
  path = FileStore.path_of_uri(uri)
  project.read_source(path)
end

#root_pathObject



22
23
24
# File 'lib/yoda/server/session.rb', line 22

def root_path
  @root_path ||= FileStore.path_of_uri(root_uri)
end

#setupObject



31
32
33
34
35
36
37
# File 'lib/yoda/server/session.rb', line 31

def setup
  unless Store::Actions::BuildCoreIndex.exists?
    Instrument.instance.initialization_progress(phase: :core, message: 'Downloading and building core index')
    Store::Actions::BuildCoreIndex.run
  end
  project.build_cache
end

#uri_of_path(path) ⇒ Object

Parameters:

  • path (String)


40
41
42
# File 'lib/yoda/server/session.rb', line 40

def uri_of_path(path)
  FileStore.uri_of_path(File.expand_path(path, root_path))
end