Sha256: 06c8cddd5c0d7413d29bac571bd81b88bbd14c8dc35c1921c7779d6260a08431

Contents?: true

Size: 1.44 KB

Versions: 47

Compression:

Stored size: 1.44 KB

Contents

module RBS
  # Copies RBS files loaded through `loader` under `vendor_dir`.
  #
  # Core libraries and library RBS files will be copied.
  #
  # ```rb
  # loader = RBS::EnvironmentLoader.new()
  #
  # loader.add(library: set)               # Libraries will be copied.
  # loader.add(library: "minitest", version: "1.2.3")
  #
  # loader.add(path: Pathname("sig"))      # Dirs will be ignored.
  #
  # vendorer = RBS::Vendorer.new(vendor_dir: Pathname("vendor/rbs"), loader: loader)
  # vendorer.clean!
  # vendorer.copy!
  # ```
  #
  # The result will be:
  #
  # ```
  # vendor/rbs/core            => Will include core RBSs
  # vendor/rbs/set-0           => Will include `set` library RBSs.
  # vendor/rbs/minitest-1.2.3  => Will include `minitest` library RBSs.
  # ```
  #
  # The vendorerd RBSs will be loaded through :dir source.
  #
  # ```rb
  # loader = RBS::EnvironmentLoader.new(core_root: nil, repository: RBS::Repository.new(no_stdlib: true))
  # loader.add(path: Pathname("vendor/rbs"))
  # loader.add(path: Pathname("sig"))
  # ```
  #
  class Vendorer
    attr_reader vendor_dir: Pathname
    attr_reader loader: EnvironmentLoader

    def initialize: (vendor_dir: Pathname, loader: EnvironmentLoader) -> void

    # Copy RBS files into `vendor_dir`.
    # Ensures the `vendor_dir` exists.
    def copy!: () -> void

    # Deletes `vendor_dir` and its content if exists.
    #
    def clean!: () -> void

    def ensure_dir: [A] () { () -> A } -> A
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
rbs-3.7.0.dev.1 sig/vendorer.rbs
rbs-3.6.1 sig/vendorer.rbs
rbs-3.6.0 sig/vendorer.rbs
rbs-3.6.0.pre.3 sig/vendorer.rbs
rbs-3.6.0.pre.2 sig/vendorer.rbs
rbs-3.6.0.pre.1 sig/vendorer.rbs
rbs-3.6.0.dev.1 sig/vendorer.rbs
rbs-3.5.3 sig/vendorer.rbs
rbs-3.5.2 sig/vendorer.rbs
rbs-3.5.1 sig/vendorer.rbs
rbs-3.5.1.pre.1 sig/vendorer.rbs
rbs-3.5.0 sig/vendorer.rbs
rbs-3.5.0.pre.2 sig/vendorer.rbs
rbs-3.5.0.pre.1 sig/vendorer.rbs
rbs-3.4.4 sig/vendorer.rbs
rbs-3.4.3 sig/vendorer.rbs
rbs-3.4.2 sig/vendorer.rbs
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/rbs-2.8.4/sig/vendorer.rbs
rbs-3.4.1 sig/vendorer.rbs
rbs-3.4.0 sig/vendorer.rbs