Sha256: 90ee1bc594bb0605776bfaa72cb0fe954757d797161b3fe28493198bdfa0e193

Contents?: true

Size: 1.91 KB

Versions: 4

Compression:

Stored size: 1.91 KB

Contents

module Yoda
  module Store
    # Return paths for each Ruby version.
    class VersionStore
      SOURCE_PATH_BASE = File.expand_path("~/.yoda/sources")
      REGISTRY_PATH_BASE = File.expand_path('~/.yoda/registry')

      # @return [VersionStore]
      def self.for_current_version
        new(RUBY_VERSION)
      end

      attr_reader :ruby_version

      # @param version [String]
      def initialize(ruby_version)
        @ruby_version = ruby_version
      end

      # Return the path to store the version's Ruby.
      # @return [String]
      def ruby_source_path
        File.join(SOURCE_PATH_BASE, "ruby-#{ruby_version}")
      end

      # Return the path to store yard document index of the core library.
      # @return [String]
      def core_yardoc_path
        File.join(ruby_source_path, '.yardoc')
      end

      # Return the path to store yard document index of the standard library.
      # @return [String]
      def stdlib_yardoc_path
        File.join(ruby_source_path, '.yardoc-stdlib')
      end

      # Return the path to store registries.
      # @return [String]
      def registries_path
        File.join(REGISTRY_PATH_BASE, ruby_version)
      end

      # Return the path to store registry of the gem.
      # @param name [String]
      # @param version [String]
      # @return [String]
      def registry_path_for_gem(name:, version:)
        library_registry_path
      end

      # Return the path to store registry of the core library.
      # @return [String]
      def registry_path_for_core
        library_registry_path
      end

      # Return the path to store registry of the standard library.
      # @return [String]
      def registry_path_for_stdlib
        library_registry_path
      end

      # Return the path to store registry of whole library
      # @return [String]
      def library_registry_path
        File.join(registries_path, Registry.registry_name, "library")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/store/version_store.rb
yoda-language-server-0.10.0 lib/yoda/store/version_store.rb
yoda-language-server-0.9.0 lib/yoda/store/version_store.rb
yoda-language-server-0.8.0 lib/yoda/store/version_store.rb