bootsnap 1.4.0 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +110 -0
- data/README.md +68 -13
- data/exe/bootsnap +5 -0
- data/ext/bootsnap/bootsnap.c +285 -87
- data/ext/bootsnap/extconf.rb +20 -14
- data/lib/bootsnap/bundler.rb +1 -0
- data/lib/bootsnap/cli/worker_pool.rb +135 -0
- data/lib/bootsnap/cli.rb +246 -0
- data/lib/bootsnap/compile_cache/iseq.rb +24 -7
- data/lib/bootsnap/compile_cache/yaml.rb +113 -39
- data/lib/bootsnap/compile_cache.rb +15 -2
- data/lib/bootsnap/explicit_require.rb +1 -0
- data/lib/bootsnap/load_path_cache/cache.rb +44 -9
- data/lib/bootsnap/load_path_cache/change_observer.rb +5 -1
- data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +30 -6
- data/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb +11 -0
- data/lib/bootsnap/load_path_cache/loaded_features_index.rb +43 -11
- data/lib/bootsnap/load_path_cache/path.rb +3 -2
- data/lib/bootsnap/load_path_cache/path_scanner.rb +53 -27
- data/lib/bootsnap/load_path_cache/realpath_cache.rb +5 -5
- data/lib/bootsnap/load_path_cache/store.rb +28 -14
- data/lib/bootsnap/load_path_cache.rb +10 -16
- data/lib/bootsnap/setup.rb +2 -33
- data/lib/bootsnap/version.rb +2 -1
- data/lib/bootsnap.rb +91 -15
- metadata +17 -29
- data/.gitignore +0 -17
- data/.rubocop.yml +0 -20
- data/.travis.yml +0 -24
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -21
- data/Gemfile +0 -8
- data/README.jp.md +0 -231
- data/Rakefile +0 -12
- data/bin/ci +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bin/test-minimal-support +0 -7
- data/bin/testunit +0 -8
- data/bootsnap.gemspec +0 -45
- data/dev.yml +0 -10
- data/lib/bootsnap/load_path_cache/core_ext/active_support.rb +0 -100
- data/shipit.rubygems.yml +0 -4
data/Rakefile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require('rake/extensiontask')
|
2
|
-
require('bundler/gem_tasks')
|
3
|
-
|
4
|
-
gemspec = Gem::Specification.load('bootsnap.gemspec')
|
5
|
-
Rake::ExtensionTask.new do |ext|
|
6
|
-
ext.name = 'bootsnap'
|
7
|
-
ext.ext_dir = 'ext/bootsnap'
|
8
|
-
ext.lib_dir = 'lib/bootsnap'
|
9
|
-
ext.gem_spec = gemspec
|
10
|
-
end
|
11
|
-
|
12
|
-
task(default: :compile)
|
data/bin/ci
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require("bundler/setup")
|
4
|
-
require("bootsnap")
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require("irb")
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/bin/test-minimal-support
DELETED
data/bin/testunit
DELETED
data/bootsnap.gemspec
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require('bootsnap/version')
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "bootsnap"
|
8
|
-
spec.version = Bootsnap::VERSION
|
9
|
-
spec.authors = ["Burke Libbey"]
|
10
|
-
spec.email = ["burke.libbey@shopify.com"]
|
11
|
-
|
12
|
-
spec.license = "MIT"
|
13
|
-
|
14
|
-
spec.summary = "Boot large ruby/rails apps faster"
|
15
|
-
spec.description = spec.summary
|
16
|
-
spec.homepage = "https://github.com/Shopify/bootsnap"
|
17
|
-
|
18
|
-
spec.metadata = {
|
19
|
-
'bug_tracker_uri' => 'https://github.com/Shopify/bootsnap/issues',
|
20
|
-
'changelog_uri' => 'https://github.com/Shopify/bootsnap/blob/master/CHANGELOG.md',
|
21
|
-
'source_code_uri' => 'https://github.com/Shopify/bootsnap',
|
22
|
-
}
|
23
|
-
|
24
|
-
spec.files = %x(git ls-files -z).split("\x0").reject do |f|
|
25
|
-
f.match(%r{^(test|spec|features)/})
|
26
|
-
end
|
27
|
-
spec.require_paths = %w(lib)
|
28
|
-
|
29
|
-
spec.required_ruby_version = '>= 2.0.0'
|
30
|
-
|
31
|
-
if RUBY_PLATFORM =~ /java/
|
32
|
-
spec.platform = 'java'
|
33
|
-
else
|
34
|
-
spec.platform = Gem::Platform::RUBY
|
35
|
-
spec.extensions = ['ext/bootsnap/extconf.rb']
|
36
|
-
end
|
37
|
-
|
38
|
-
spec.add_development_dependency("bundler")
|
39
|
-
spec.add_development_dependency('rake', '~> 10.0')
|
40
|
-
spec.add_development_dependency('rake-compiler', '~> 0')
|
41
|
-
spec.add_development_dependency("minitest", "~> 5.0")
|
42
|
-
spec.add_development_dependency("mocha", "~> 1.2")
|
43
|
-
|
44
|
-
spec.add_runtime_dependency("msgpack", "~> 1.0")
|
45
|
-
end
|
data/dev.yml
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
module Bootsnap
|
2
|
-
module LoadPathCache
|
3
|
-
module CoreExt
|
4
|
-
module ActiveSupport
|
5
|
-
def self.without_bootsnap_cache
|
6
|
-
prev = Thread.current[:without_bootsnap_cache] || false
|
7
|
-
Thread.current[:without_bootsnap_cache] = true
|
8
|
-
yield
|
9
|
-
ensure
|
10
|
-
Thread.current[:without_bootsnap_cache] = prev
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.allow_bootsnap_retry(allowed)
|
14
|
-
prev = Thread.current[:without_bootsnap_retry] || false
|
15
|
-
Thread.current[:without_bootsnap_retry] = !allowed
|
16
|
-
yield
|
17
|
-
ensure
|
18
|
-
Thread.current[:without_bootsnap_retry] = prev
|
19
|
-
end
|
20
|
-
|
21
|
-
module ClassMethods
|
22
|
-
def autoload_paths=(o)
|
23
|
-
super
|
24
|
-
Bootsnap::LoadPathCache.autoload_paths_cache.reinitialize(o)
|
25
|
-
end
|
26
|
-
|
27
|
-
def search_for_file(path)
|
28
|
-
return super if Thread.current[:without_bootsnap_cache]
|
29
|
-
begin
|
30
|
-
Bootsnap::LoadPathCache.autoload_paths_cache.find(path)
|
31
|
-
rescue Bootsnap::LoadPathCache::ReturnFalse
|
32
|
-
nil # doesn't really apply here
|
33
|
-
rescue Bootsnap::LoadPathCache::FallbackScan
|
34
|
-
nil # doesn't really apply here
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def autoloadable_module?(path_suffix)
|
39
|
-
Bootsnap::LoadPathCache.autoload_paths_cache.load_dir(path_suffix)
|
40
|
-
end
|
41
|
-
|
42
|
-
def remove_constant(const)
|
43
|
-
CoreExt::ActiveSupport.without_bootsnap_cache { super }
|
44
|
-
end
|
45
|
-
|
46
|
-
def require_or_load(*)
|
47
|
-
CoreExt::ActiveSupport.allow_bootsnap_retry(true) do
|
48
|
-
super
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# If we can't find a constant using the patched implementation of
|
53
|
-
# search_for_file, try again with the default implementation.
|
54
|
-
#
|
55
|
-
# These methods call search_for_file, and we want to modify its
|
56
|
-
# behaviour. The gymnastics here are a bit awkward, but it prevents
|
57
|
-
# 200+ lines of monkeypatches.
|
58
|
-
def load_missing_constant(from_mod, const_name)
|
59
|
-
CoreExt::ActiveSupport.allow_bootsnap_retry(false) do
|
60
|
-
super
|
61
|
-
end
|
62
|
-
rescue NameError => e
|
63
|
-
# This function can end up called recursively, we only want to
|
64
|
-
# retry at the top-level.
|
65
|
-
raise if Thread.current[:without_bootsnap_retry]
|
66
|
-
# If we already had cache disabled, there's no use retrying
|
67
|
-
raise if Thread.current[:without_bootsnap_cache]
|
68
|
-
# NoMethodError is a NameError, but we only want to handle actual
|
69
|
-
# NameError instances.
|
70
|
-
raise unless e.class == NameError
|
71
|
-
# We can only confidently handle cases when *this* constant fails
|
72
|
-
# to load, not other constants referred to by it.
|
73
|
-
raise unless e.name == const_name
|
74
|
-
# If the constant was actually loaded, something else went wrong?
|
75
|
-
raise if from_mod.const_defined?(const_name)
|
76
|
-
CoreExt::ActiveSupport.without_bootsnap_cache { super }
|
77
|
-
end
|
78
|
-
|
79
|
-
# Signature has changed a few times over the years; easiest to not
|
80
|
-
# reiterate it with version polymorphism here...
|
81
|
-
def depend_on(*)
|
82
|
-
super
|
83
|
-
rescue LoadError
|
84
|
-
# If we already had cache disabled, there's no use retrying
|
85
|
-
raise if Thread.current[:without_bootsnap_cache]
|
86
|
-
CoreExt::ActiveSupport.without_bootsnap_cache { super }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
module ActiveSupport
|
95
|
-
module Dependencies
|
96
|
-
class << self
|
97
|
-
prepend(Bootsnap::LoadPathCache::CoreExt::ActiveSupport::ClassMethods)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
data/shipit.rubygems.yml
DELETED