Class: Yoda::Store::VersionStore

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/store/version_store.rb

Overview

Return paths for each Ruby version.

Constant Summary collapse

SOURCE_PATH_BASE =
File.expand_path("~/.yoda/sources")
REGISTRY_PATH_BASE =
File.expand_path('~/.yoda/registry')

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_version) ⇒ VersionStore

Returns a new instance of VersionStore.

Parameters:

  • version (String)


16
17
18
# File 'lib/yoda/store/version_store.rb', line 16

def initialize(ruby_version)
  @ruby_version = ruby_version
end

Instance Attribute Details

#ruby_versionObject (readonly)

Returns the value of attribute ruby_version.



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

def ruby_version
  @ruby_version
end

Class Method Details

.for_current_versionVersionStore

Returns:



9
10
11
# File 'lib/yoda/store/version_store.rb', line 9

def self.for_current_version
  new(RUBY_VERSION)
end

Instance Method Details

#core_yardoc_pathString

Return the path to store yard document index of the core library.

Returns:

  • (String)


28
29
30
# File 'lib/yoda/store/version_store.rb', line 28

def core_yardoc_path
  File.join(ruby_source_path, '.yardoc')
end

#library_registry_pathString

Return the path to store registry of whole library

Returns:

  • (String)


66
67
68
# File 'lib/yoda/store/version_store.rb', line 66

def library_registry_path
  File.join(registries_path, Registry.registry_name, "library")
end

#registries_pathString

Return the path to store registries.

Returns:

  • (String)


40
41
42
# File 'lib/yoda/store/version_store.rb', line 40

def registries_path
  File.join(REGISTRY_PATH_BASE, ruby_version)
end

#registry_path_for_coreString

Return the path to store registry of the core library.

Returns:

  • (String)


54
55
56
# File 'lib/yoda/store/version_store.rb', line 54

def registry_path_for_core
  library_registry_path
end

#registry_path_for_gem(name:, version:) ⇒ String

Return the path to store registry of the gem.

Parameters:

  • name (String)
  • version (String)

Returns:

  • (String)


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

def registry_path_for_gem(name:, version:)
  library_registry_path
end

#registry_path_for_stdlibString

Return the path to store registry of the standard library.

Returns:

  • (String)


60
61
62
# File 'lib/yoda/store/version_store.rb', line 60

def registry_path_for_stdlib
  library_registry_path
end

#ruby_source_pathString

Return the path to store the version’s Ruby.

Returns:

  • (String)


22
23
24
# File 'lib/yoda/store/version_store.rb', line 22

def ruby_source_path
  File.join(SOURCE_PATH_BASE, "ruby-#{ruby_version}")
end

#stdlib_yardoc_pathString

Return the path to store yard document index of the standard library.

Returns:

  • (String)


34
35
36
# File 'lib/yoda/store/version_store.rb', line 34

def stdlib_yardoc_path
  File.join(ruby_source_path, '.yardoc-stdlib')
end