Module: Bootsnap::CompileCache
- Defined in:
- lib/bootsnap/compile_cache.rb,
lib/bootsnap/compile_cache/iseq.rb,
lib/bootsnap/compile_cache/yaml.rb,
ext/bootsnap/bootsnap.c
Defined Under Namespace
Modules: ISeq, Native, YAML
Classes: Uncompilable
Constant Summary
collapse
- Error =
Class.new(StandardError)
- PermissionError =
Class.new(Error)
Class Method Summary
collapse
Class Method Details
.permission_error(path) ⇒ Object
27
28
29
30
31
32
33
34
|
# File 'lib/bootsnap/compile_cache.rb', line 27
def self.permission_error(path)
cpath = Bootsnap::CompileCache::ISeq.cache_dir
raise(
PermissionError,
"bootsnap doesn't have permission to write cache entries in '#{cpath}' " \
"(or, less likely, doesn't have permission to read '#{path}')",
)
end
|
.setup(cache_dir:, iseq:, yaml:) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bootsnap/compile_cache.rb', line 7
def self.setup(cache_dir:, iseq:, yaml:)
if iseq
if supported?
require_relative('compile_cache/iseq')
Bootsnap::CompileCache::ISeq.install!(cache_dir)
elsif $VERBOSE
warn("[bootsnap/setup] bytecode caching is not supported on this implementation of Ruby")
end
end
if yaml
if supported?
require_relative('compile_cache/yaml')
Bootsnap::CompileCache::YAML.install!(cache_dir)
elsif $VERBOSE
warn("[bootsnap/setup] YAML parsing caching is not supported on this implementation of Ruby")
end
end
end
|
.supported? ⇒ Boolean
36
37
38
39
40
41
|
# File 'lib/bootsnap/compile_cache.rb', line 36
def self.supported?
RUBY_ENGINE == 'ruby' &&
RUBY_PLATFORM =~ /darwin|linux|bsd|mswin|mingw|cygwin/ &&
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3.0")
end
|