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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +110 -0
  3. data/README.md +68 -13
  4. data/exe/bootsnap +5 -0
  5. data/ext/bootsnap/bootsnap.c +285 -87
  6. data/ext/bootsnap/extconf.rb +20 -14
  7. data/lib/bootsnap/bundler.rb +1 -0
  8. data/lib/bootsnap/cli/worker_pool.rb +135 -0
  9. data/lib/bootsnap/cli.rb +246 -0
  10. data/lib/bootsnap/compile_cache/iseq.rb +24 -7
  11. data/lib/bootsnap/compile_cache/yaml.rb +113 -39
  12. data/lib/bootsnap/compile_cache.rb +15 -2
  13. data/lib/bootsnap/explicit_require.rb +1 -0
  14. data/lib/bootsnap/load_path_cache/cache.rb +44 -9
  15. data/lib/bootsnap/load_path_cache/change_observer.rb +5 -1
  16. data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +30 -6
  17. data/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb +11 -0
  18. data/lib/bootsnap/load_path_cache/loaded_features_index.rb +43 -11
  19. data/lib/bootsnap/load_path_cache/path.rb +3 -2
  20. data/lib/bootsnap/load_path_cache/path_scanner.rb +53 -27
  21. data/lib/bootsnap/load_path_cache/realpath_cache.rb +5 -5
  22. data/lib/bootsnap/load_path_cache/store.rb +28 -14
  23. data/lib/bootsnap/load_path_cache.rb +10 -16
  24. data/lib/bootsnap/setup.rb +2 -33
  25. data/lib/bootsnap/version.rb +2 -1
  26. data/lib/bootsnap.rb +91 -15
  27. metadata +17 -29
  28. data/.gitignore +0 -17
  29. data/.rubocop.yml +0 -20
  30. data/.travis.yml +0 -24
  31. data/CODE_OF_CONDUCT.md +0 -74
  32. data/CONTRIBUTING.md +0 -21
  33. data/Gemfile +0 -8
  34. data/README.jp.md +0 -231
  35. data/Rakefile +0 -12
  36. data/bin/ci +0 -10
  37. data/bin/console +0 -14
  38. data/bin/setup +0 -8
  39. data/bin/test-minimal-support +0 -7
  40. data/bin/testunit +0 -8
  41. data/bootsnap.gemspec +0 -45
  42. data/dev.yml +0 -10
  43. data/lib/bootsnap/load_path_cache/core_ext/active_support.rb +0 -100
  44. 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
@@ -1,10 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -euxo pipefail
4
-
5
- if [[ "${MINIMAL_SUPPORT-0}" -eq 1 ]]; then
6
- exec bin/test-minimal-support
7
- else
8
- rake
9
- exec bin/testunit
10
- fi
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
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -euxo pipefail
4
-
5
- cd test/minimal_support
6
- bundle
7
- BOOTSNAP_CACHE_DIR=/tmp bundle exec ruby -w -I ../../lib bootsnap_setup.rb
data/bin/testunit DELETED
@@ -1,8 +0,0 @@
1
- #!/bin/bash
2
-
3
- if [[ $# -eq 0 ]]; then
4
- exec ruby -I"test" -w -e 'Dir.glob("./test/**/*_test.rb").each { |f| require f }' -- "$@"
5
- else
6
- path=$1
7
- exec ruby -I"test" -w -e "require '${path#test/}'" -- "$@"
8
- fi
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,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
@@ -1,4 +0,0 @@
1
- dependencies:
2
- bundler:
3
- without:
4
- - development