bootsnap 1.1.8 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +121 -0
  3. data/README.md +72 -14
  4. data/exe/bootsnap +5 -0
  5. data/ext/bootsnap/bootsnap.c +283 -105
  6. data/ext/bootsnap/extconf.rb +21 -14
  7. data/lib/bootsnap.rb +95 -14
  8. data/lib/bootsnap/bundler.rb +6 -3
  9. data/lib/bootsnap/cli.rb +246 -0
  10. data/lib/bootsnap/cli/worker_pool.rb +131 -0
  11. data/lib/bootsnap/compile_cache.rb +32 -4
  12. data/lib/bootsnap/compile_cache/iseq.rb +32 -15
  13. data/lib/bootsnap/compile_cache/yaml.rb +97 -40
  14. data/lib/bootsnap/explicit_require.rb +2 -1
  15. data/lib/bootsnap/load_path_cache.rb +33 -20
  16. data/lib/bootsnap/load_path_cache/cache.rb +65 -29
  17. data/lib/bootsnap/load_path_cache/change_observer.rb +36 -29
  18. data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +70 -53
  19. data/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb +18 -0
  20. data/lib/bootsnap/load_path_cache/loaded_features_index.rb +148 -0
  21. data/lib/bootsnap/load_path_cache/path.rb +8 -7
  22. data/lib/bootsnap/load_path_cache/path_scanner.rb +61 -39
  23. data/lib/bootsnap/load_path_cache/realpath_cache.rb +32 -0
  24. data/lib/bootsnap/load_path_cache/store.rb +27 -14
  25. data/lib/bootsnap/setup.rb +3 -40
  26. data/lib/bootsnap/version.rb +2 -1
  27. metadata +26 -29
  28. data/.gitignore +0 -17
  29. data/.rubocop.yml +0 -20
  30. data/.travis.yml +0 -4
  31. data/CODE_OF_CONDUCT.md +0 -74
  32. data/CONTRIBUTING.md +0 -21
  33. data/Gemfile +0 -8
  34. data/Rakefile +0 -11
  35. data/bin/console +0 -14
  36. data/bin/setup +0 -8
  37. data/bin/testunit +0 -8
  38. data/bootsnap.gemspec +0 -39
  39. data/dev.yml +0 -10
  40. data/lib/bootsnap/load_path_cache/core_ext/active_support.rb +0 -75
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm: ruby-2.4.1
3
- before_script: rake
4
- script: bin/testunit
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at burke@libbey.me. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md DELETED
@@ -1,21 +0,0 @@
1
- # Contributing to Bootsnap
2
-
3
- We love receiving pull requests!
4
-
5
- ## Standards
6
-
7
- * PR should explain what the feature does, and why the change exists.
8
- * PR should include any carrier specific documentation explaining how it works.
9
- * Code _must_ be tested, including both unit and remote tests where applicable.
10
- * Be consistent. Write clean code that follows [Ruby community standards](https://github.com/bbatsov/ruby-style-guide).
11
- * Code should be generic and reusable.
12
-
13
- If you're stuck, ask questions!
14
-
15
- ## How to contribute
16
-
17
- 1. Fork it ( https://github.com/Shopify/bootsnap/fork )
18
- 2. Create your feature branch (`git checkout -b my-new-feature`)
19
- 3. Commit your changes (`git commit -am 'Add some feature'`)
20
- 4. Push to the branch (`git push origin my-new-feature`)
21
- 5. Create a new Pull Request
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in bootsnap.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'rubocop'
8
- end
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- require 'rake/extensiontask'
2
-
3
- gemspec = Gem::Specification.load('bootsnap.gemspec')
4
- Rake::ExtensionTask.new do |ext|
5
- ext.name = 'bootsnap'
6
- ext.ext_dir = 'ext/bootsnap'
7
- ext.lib_dir = 'lib/bootsnap'
8
- ext.gem_spec = gemspec
9
- end
10
-
11
- task(default: :compile)
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
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,39 +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.files = `git ls-files -z`.split("\x0").reject do |f|
19
- f.match(%r{^(test|spec|features)/})
20
- end
21
- spec.require_paths = ["lib"]
22
-
23
- spec.required_ruby_version = '>= 2.0.0'
24
-
25
- if RUBY_PLATFORM =~ /java/
26
- spec.platform = 'java'
27
- else
28
- spec.platform = Gem::Platform::RUBY
29
- spec.extensions = ['ext/bootsnap/extconf.rb']
30
- end
31
-
32
- spec.add_development_dependency "bundler", '~> 1'
33
- spec.add_development_dependency 'rake', '~> 10.0'
34
- spec.add_development_dependency 'rake-compiler', '~> 0'
35
- spec.add_development_dependency "minitest", "~> 5.0"
36
- spec.add_development_dependency "mocha", "~> 1.2"
37
-
38
- spec.add_runtime_dependency "msgpack", "~> 1.0"
39
- end
data/dev.yml DELETED
@@ -1,10 +0,0 @@
1
- env:
2
- BOOTSNAP_PEDANTIC: '1'
3
-
4
- up:
5
- - ruby: 2.3.3
6
- - bundler
7
- commands:
8
- build: rake compile
9
- test: 'rake compile && exec bin/testunit'
10
- style: 'exec rubocop -D'
@@ -1,75 +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
- module ClassMethods
14
- def autoload_paths=(o)
15
- super
16
- Bootsnap::LoadPathCache.autoload_paths_cache.reinitialize(o)
17
- end
18
-
19
- def search_for_file(path)
20
- return super if Thread.current[:without_bootsnap_cache]
21
- begin
22
- Bootsnap::LoadPathCache.autoload_paths_cache.find(path)
23
- rescue Bootsnap::LoadPathCache::ReturnFalse
24
- nil # doesn't really apply here
25
- end
26
- end
27
-
28
- def autoloadable_module?(path_suffix)
29
- Bootsnap::LoadPathCache.autoload_paths_cache.has_dir?(path_suffix)
30
- end
31
-
32
- def remove_constant(const)
33
- CoreExt::ActiveSupport.without_bootsnap_cache { super }
34
- end
35
-
36
- # If we can't find a constant using the patched implementation of
37
- # search_for_file, try again with the default implementation.
38
- #
39
- # These methods call search_for_file, and we want to modify its
40
- # behaviour. The gymnastics here are a bit awkward, but it prevents
41
- # 200+ lines of monkeypatches.
42
- def load_missing_constant(from_mod, const_name)
43
- super
44
- rescue NameError => e
45
- # NoMethodError is a NameError, but we only want to handle actual
46
- # NameError instances.
47
- raise unless e.class == NameError
48
- # We can only confidently handle cases when *this* constant fails
49
- # to load, not other constants referred to by it.
50
- raise unless e.name == const_name
51
- # If the constant was actually loaded, something else went wrong?
52
- raise if from_mod.const_defined?(const_name)
53
- CoreExt::ActiveSupport.without_bootsnap_cache { super }
54
- end
55
-
56
- # Signature has changed a few times over the years; easiest to not
57
- # reiterate it with version polymorphism here...
58
- def depend_on(*)
59
- super
60
- rescue LoadError
61
- CoreExt::ActiveSupport.without_bootsnap_cache { super }
62
- end
63
- end
64
- end
65
- end
66
- end
67
- end
68
-
69
- module ActiveSupport
70
- module Dependencies
71
- class << self
72
- prepend Bootsnap::LoadPathCache::CoreExt::ActiveSupport::ClassMethods
73
- end
74
- end
75
- end