bootsnap 1.4.5 → 1.18.3

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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +264 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +63 -23
  5. data/exe/bootsnap +5 -0
  6. data/ext/bootsnap/bootsnap.c +504 -184
  7. data/ext/bootsnap/extconf.rb +30 -15
  8. data/lib/bootsnap/bundler.rb +3 -1
  9. data/lib/bootsnap/cli/worker_pool.rb +136 -0
  10. data/lib/bootsnap/cli.rb +283 -0
  11. data/lib/bootsnap/compile_cache/iseq.rb +72 -21
  12. data/lib/bootsnap/compile_cache/json.rb +89 -0
  13. data/lib/bootsnap/compile_cache/yaml.rb +316 -41
  14. data/lib/bootsnap/compile_cache.rb +27 -17
  15. data/lib/bootsnap/explicit_require.rb +5 -3
  16. data/lib/bootsnap/load_path_cache/cache.rb +73 -37
  17. data/lib/bootsnap/load_path_cache/change_observer.rb +25 -3
  18. data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +27 -82
  19. data/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb +2 -0
  20. data/lib/bootsnap/load_path_cache/loaded_features_index.rb +63 -29
  21. data/lib/bootsnap/load_path_cache/path.rb +42 -19
  22. data/lib/bootsnap/load_path_cache/path_scanner.rb +60 -29
  23. data/lib/bootsnap/load_path_cache/store.rb +64 -23
  24. data/lib/bootsnap/load_path_cache.rb +40 -38
  25. data/lib/bootsnap/setup.rb +3 -36
  26. data/lib/bootsnap/version.rb +3 -1
  27. data/lib/bootsnap.rb +141 -36
  28. metadata +15 -99
  29. data/.github/CODEOWNERS +0 -2
  30. data/.github/probots.yml +0 -2
  31. data/.gitignore +0 -17
  32. data/.rubocop.yml +0 -20
  33. data/.travis.yml +0 -21
  34. data/CODE_OF_CONDUCT.md +0 -74
  35. data/CONTRIBUTING.md +0 -21
  36. data/Gemfile +0 -8
  37. data/README.jp.md +0 -231
  38. data/Rakefile +0 -12
  39. data/bin/ci +0 -10
  40. data/bin/console +0 -14
  41. data/bin/setup +0 -8
  42. data/bin/test-minimal-support +0 -7
  43. data/bin/testunit +0 -8
  44. data/bootsnap.gemspec +0 -45
  45. data/dev.yml +0 -10
  46. data/lib/bootsnap/load_path_cache/core_ext/active_support.rb +0 -106
  47. data/lib/bootsnap/load_path_cache/realpath_cache.rb +0 -32
  48. data/shipit.rubygems.yml +0 -0
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,10 +0,0 @@
1
- env:
2
- BOOTSNAP_PEDANTIC: '1'
3
-
4
- up:
5
- - ruby: 2.6.0
6
- - bundler
7
- commands:
8
- build: rake compile
9
- test: 'rake compile && exec bin/testunit'
10
- style: 'exec rubocop -D'
@@ -1,106 +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
- raise(e) if e.instance_variable_defined?(Bootsnap::LoadPathCache::ERROR_TAG_IVAR)
64
- e.instance_variable_set(Bootsnap::LoadPathCache::ERROR_TAG_IVAR, true)
65
-
66
- # This function can end up called recursively, we only want to
67
- # retry at the top-level.
68
- raise(e) if Thread.current[:without_bootsnap_retry]
69
- # If we already had cache disabled, there's no use retrying
70
- raise(e) if Thread.current[:without_bootsnap_cache]
71
- # NoMethodError is a NameError, but we only want to handle actual
72
- # NameError instances.
73
- raise(e) unless e.class == NameError
74
- # We can only confidently handle cases when *this* constant fails
75
- # to load, not other constants referred to by it.
76
- raise(e) unless e.name == const_name
77
- # If the constant was actually loaded, something else went wrong?
78
- raise(e) if from_mod.const_defined?(const_name)
79
- CoreExt::ActiveSupport.without_bootsnap_cache { super }
80
- end
81
-
82
- # Signature has changed a few times over the years; easiest to not
83
- # reiterate it with version polymorphism here...
84
- def depend_on(*)
85
- super
86
- rescue LoadError => e
87
- raise(e) if e.instance_variable_defined?(Bootsnap::LoadPathCache::ERROR_TAG_IVAR)
88
- e.instance_variable_set(Bootsnap::LoadPathCache::ERROR_TAG_IVAR, true)
89
-
90
- # If we already had cache disabled, there's no use retrying
91
- raise(e) if Thread.current[:without_bootsnap_cache]
92
- CoreExt::ActiveSupport.without_bootsnap_cache { super }
93
- end
94
- end
95
- end
96
- end
97
- end
98
- end
99
-
100
- module ActiveSupport
101
- module Dependencies
102
- class << self
103
- prepend(Bootsnap::LoadPathCache::CoreExt::ActiveSupport::ClassMethods)
104
- end
105
- end
106
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bootsnap
4
- module LoadPathCache
5
- class RealpathCache
6
- def initialize
7
- @cache = Hash.new { |h, k| h[k] = realpath(*k) }
8
- end
9
-
10
- def call(*key)
11
- @cache[key]
12
- end
13
-
14
- private
15
-
16
- def realpath(caller_location, path)
17
- base = File.dirname(caller_location)
18
- file = find_file(File.expand_path(path, base))
19
- dir = File.dirname(file)
20
- File.join(dir, File.basename(file))
21
- end
22
-
23
- def find_file(name)
24
- ['', *CACHED_EXTENSIONS].each do |ext|
25
- filename = "#{name}#{ext}"
26
- return File.realpath(filename) if File.exist?(filename)
27
- end
28
- name
29
- end
30
- end
31
- end
32
- end
data/shipit.rubygems.yml DELETED
File without changes