Module: Homebrew::Bootsnap Private

Defined in:
startup/bootsnap.rb,
startup/bootsnap.rbi

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Class Method Summary collapse

Class Method Details

.keyString

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



6
7
8
9
10
11
12
13
14
15
16
17
# File 'startup/bootsnap.rb', line 6

def self.key
  @key ||= begin
    require "digest/sha2"

    checksum = Digest::SHA256.new
    checksum << RUBY_VERSION
    checksum << RUBY_PLATFORM
    checksum << Dir.children(File.join(Gem.paths.path, "gems")).join(",")

    checksum.hexdigest
  end
end

.load!(compile_cache: true) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:

  • compile_cache (Boolean) (defaults to: true)


40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'startup/bootsnap.rb', line 40

def self.load!(compile_cache: true)
  return unless enabled?

  require ENV.fetch("HOMEBREW_BOOTSNAP_GEM_PATH")

  ::Bootsnap.setup(
    cache_dir:,
    ignore_directories:,
    # In development environments the bootsnap compilation cache is
    # generated on the fly when source files are loaded.
    # https://github.com/Shopify/bootsnap?tab=readme-ov-file#precompilation
    development_mode:   true,
    load_path_cache:    true,
    compile_cache_iseq: compile_cache,
    compile_cache_yaml: compile_cache,
    compile_cache_json: compile_cache,
  )
end

.reset!void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.



59
60
61
62
63
64
65
66
67
# File 'startup/bootsnap.rb', line 59

def self.reset!
  return unless enabled?

  ::Bootsnap.unload_cache!
  @key = nil

  # The compile cache doesn't get unloaded so we don't need to load it again!
  load!(compile_cache: false)
end