Module: Bootsnap
- Extended by:
- Bootsnap
- Included in:
- Bootsnap
- Defined in:
- lib/bootsnap.rb,
lib/bootsnap/bundler.rb,
lib/bootsnap/version.rb,
lib/bootsnap/compile_cache.rb,
lib/bootsnap/load_path_cache.rb,
lib/bootsnap/explicit_require.rb,
lib/bootsnap/compile_cache/iseq.rb,
lib/bootsnap/compile_cache/yaml.rb,
lib/bootsnap/load_path_cache/path.rb,
lib/bootsnap/load_path_cache/cache.rb,
lib/bootsnap/load_path_cache/store.rb,
lib/bootsnap/load_path_cache/path_scanner.rb,
lib/bootsnap/load_path_cache/realpath_cache.rb,
lib/bootsnap/load_path_cache/change_observer.rb,
lib/bootsnap/load_path_cache/loaded_features_index.rb,
lib/bootsnap/load_path_cache/core_ext/active_support.rb,
lib/bootsnap/load_path_cache/core_ext/kernel_require.rb,
ext/bootsnap/bootsnap.c
Defined Under Namespace
Modules: CompileCache, ExplicitRequire, LoadPathCache
Constant Summary
collapse
- InvalidConfiguration =
Class.new(StandardError)
- VERSION =
"1.4.0"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.setup(cache_dir:, development_mode: true, load_path_cache: true, autoload_paths_cache: true, disable_trace: false, compile_cache_iseq: true, compile_cache_yaml: true) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/bootsnap.rb', line 9
def self.setup(
cache_dir:,
development_mode: true,
load_path_cache: true,
autoload_paths_cache: true,
disable_trace: false,
compile_cache_iseq: true,
compile_cache_yaml: true
)
if autoload_paths_cache && !load_path_cache
raise(InvalidConfiguration, "feature 'autoload_paths_cache' depends on feature 'load_path_cache'")
end
setup_disable_trace if disable_trace
Bootsnap::LoadPathCache.setup(
cache_path: cache_dir + '/bootsnap-load-path-cache',
development_mode: development_mode,
active_support: autoload_paths_cache
) if load_path_cache
Bootsnap::CompileCache.setup(
cache_dir: cache_dir + '/bootsnap-compile-cache',
iseq: compile_cache_iseq,
yaml: compile_cache_yaml
)
end
|
.setup_disable_trace ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/bootsnap.rb', line 37
def self.setup_disable_trace
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
warn(
"from #{caller_locations(1, 1)[0]}: The 'disable_trace' method is not allowed with this Ruby version. " \
"current: #{RUBY_VERSION}, allowed version: < 2.5.0",
)
else
RubyVM::InstructionSequence.compile_option = { trace_instruction: false }
end
end
|
Instance Method Details
#bundler? ⇒ Boolean
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/bootsnap/bundler.rb', line 4
def bundler?
return false unless defined?(::Bundler)
%w(BUNDLE_BIN_PATH BUNDLE_GEMFILE).each do |current|
return true if ENV.key?(current)
end
false
end
|