bootsnap 1.1.8-java → 1.5.0-java
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 +5 -5
- data/CHANGELOG.md +89 -0
- data/README.md +46 -6
- data/exe/bootsnap +5 -0
- data/ext/bootsnap/bootsnap.c +125 -87
- data/ext/bootsnap/extconf.rb +3 -1
- data/lib/bootsnap.rb +15 -6
- data/lib/bootsnap/bundler.rb +6 -3
- data/lib/bootsnap/cli.rb +136 -0
- data/lib/bootsnap/compile_cache.rb +32 -4
- data/lib/bootsnap/compile_cache/iseq.rb +25 -16
- data/lib/bootsnap/compile_cache/yaml.rb +75 -42
- data/lib/bootsnap/explicit_require.rb +2 -1
- data/lib/bootsnap/load_path_cache.rb +35 -9
- data/lib/bootsnap/load_path_cache/cache.rb +48 -29
- data/lib/bootsnap/load_path_cache/change_observer.rb +36 -29
- data/lib/bootsnap/load_path_cache/core_ext/active_support.rb +39 -7
- data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +70 -53
- data/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb +18 -0
- data/lib/bootsnap/load_path_cache/loaded_features_index.rb +148 -0
- data/lib/bootsnap/load_path_cache/path.rb +8 -7
- data/lib/bootsnap/load_path_cache/path_scanner.rb +50 -39
- data/lib/bootsnap/load_path_cache/realpath_cache.rb +32 -0
- data/lib/bootsnap/load_path_cache/store.rb +20 -14
- data/lib/bootsnap/setup.rb +11 -13
- data/lib/bootsnap/version.rb +2 -1
- metadata +25 -28
- data/.gitignore +0 -17
- data/.rubocop.yml +0 -20
- data/.travis.yml +0 -4
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -21
- data/Gemfile +0 -8
- data/Rakefile +0 -11
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bin/testunit +0 -8
- data/bootsnap.gemspec +0 -39
- data/dev.yml +0 -10
@@ -0,0 +1,32 @@
|
|
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
|
+
abspath = File.expand_path(path, base).freeze
|
19
|
+
find_file(abspath)
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_file(name)
|
23
|
+
return File.realpath(name).freeze if File.exist?(name)
|
24
|
+
CACHED_EXTENSIONS.each do |ext|
|
25
|
+
filename = "#{name}#{ext}"
|
26
|
+
return File.realpath(filename).freeze if File.exist?(filename)
|
27
|
+
end
|
28
|
+
name
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative('../explicit_require')
|
2
3
|
|
3
|
-
Bootsnap::ExplicitRequire.with_gems('msgpack') { require
|
4
|
+
Bootsnap::ExplicitRequire.with_gems('msgpack') { require('msgpack') }
|
4
5
|
Bootsnap::ExplicitRequire.from_rubylibdir('fileutils')
|
5
6
|
|
6
7
|
module Bootsnap
|
@@ -11,7 +12,8 @@ module Bootsnap
|
|
11
12
|
|
12
13
|
def initialize(store_path)
|
13
14
|
@store_path = store_path
|
14
|
-
|
15
|
+
# TODO: Remove conditional once Ruby 2.2 support is dropped.
|
16
|
+
@txn_mutex = defined?(::Mutex) ? ::Mutex.new : ::Thread::Mutex.new
|
15
17
|
@dirty = false
|
16
18
|
load_data
|
17
19
|
end
|
@@ -21,7 +23,7 @@ module Bootsnap
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def fetch(key)
|
24
|
-
raise
|
26
|
+
raise(SetOutsideTransactionNotAllowed) unless @txn_mutex.owned?
|
25
27
|
v = get(key)
|
26
28
|
unless v
|
27
29
|
@dirty = true
|
@@ -32,7 +34,7 @@ module Bootsnap
|
|
32
34
|
end
|
33
35
|
|
34
36
|
def set(key, value)
|
35
|
-
raise
|
37
|
+
raise(SetOutsideTransactionNotAllowed) unless @txn_mutex.owned?
|
36
38
|
if value != @data[key]
|
37
39
|
@dirty = true
|
38
40
|
@data[key] = value
|
@@ -40,12 +42,14 @@ module Bootsnap
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def transaction
|
43
|
-
raise
|
44
|
-
@
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
raise(NestedTransactionError) if @txn_mutex.owned?
|
46
|
+
@txn_mutex.synchronize do
|
47
|
+
begin
|
48
|
+
yield
|
49
|
+
ensure
|
50
|
+
commit_transaction
|
51
|
+
end
|
52
|
+
end
|
49
53
|
end
|
50
54
|
|
51
55
|
private
|
@@ -60,9 +64,11 @@ module Bootsnap
|
|
60
64
|
def load_data
|
61
65
|
@data = begin
|
62
66
|
MessagePack.load(File.binread(@store_path))
|
63
|
-
|
64
|
-
|
65
|
-
|
67
|
+
# handle malformed data due to upgrade incompatibility
|
68
|
+
rescue Errno::ENOENT, MessagePack::MalformedFormatError, MessagePack::UnknownExtTypeError, EOFError
|
69
|
+
{}
|
70
|
+
rescue ArgumentError => e
|
71
|
+
e.message =~ /negative array size/ ? {} : raise
|
66
72
|
end
|
67
73
|
end
|
68
74
|
|
data/lib/bootsnap/setup.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative('../bootsnap')
|
2
3
|
|
3
4
|
env = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['ENV']
|
4
5
|
development_mode = ['', nil, 'development'].include?(env)
|
5
6
|
|
6
|
-
# only enable on 'ruby' (MRI), POSIX (darin, linux, *bsd), and >= 2.3.0
|
7
|
-
enable_cc =
|
8
|
-
RUBY_ENGINE == 'ruby' &&
|
9
|
-
RUBY_PLATFORM =~ /darwin|linux|bsd/ &&
|
10
|
-
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.3.0")
|
11
|
-
|
12
7
|
cache_dir = ENV['BOOTSNAP_CACHE_DIR']
|
13
8
|
unless cache_dir
|
14
9
|
config_dir_frame = caller.detect do |line|
|
@@ -16,11 +11,11 @@ unless cache_dir
|
|
16
11
|
end
|
17
12
|
|
18
13
|
unless config_dir_frame
|
19
|
-
$stderr.puts
|
20
|
-
$stderr.puts
|
21
|
-
$stderr.puts
|
14
|
+
$stderr.puts("[bootsnap/setup] couldn't infer cache directory! Either:")
|
15
|
+
$stderr.puts("[bootsnap/setup] 1. require bootsnap/setup from your application's config directory; or")
|
16
|
+
$stderr.puts("[bootsnap/setup] 2. Define the environment variable BOOTSNAP_CACHE_DIR")
|
22
17
|
|
23
|
-
raise
|
18
|
+
raise("couldn't infer bootsnap cache directory")
|
24
19
|
end
|
25
20
|
|
26
21
|
path = config_dir_frame.split(/:\d+:/).first
|
@@ -30,12 +25,15 @@ unless cache_dir
|
|
30
25
|
cache_dir = File.join(app_root, 'tmp', 'cache')
|
31
26
|
end
|
32
27
|
|
28
|
+
ruby_version = Gem::Version.new(RUBY_VERSION)
|
29
|
+
iseq_cache_enabled = ruby_version < Gem::Version.new('2.5.0') || ruby_version >= Gem::Version.new('2.6.0')
|
30
|
+
|
33
31
|
Bootsnap.setup(
|
34
32
|
cache_dir: cache_dir,
|
35
33
|
development_mode: development_mode,
|
36
34
|
load_path_cache: true,
|
37
35
|
autoload_paths_cache: true, # assume rails. open to PRs to impl. detection
|
38
36
|
disable_trace: false,
|
39
|
-
compile_cache_iseq:
|
40
|
-
compile_cache_yaml:
|
37
|
+
compile_cache_iseq: iseq_cache_enabled,
|
38
|
+
compile_cache_yaml: true,
|
41
39
|
)
|
data/lib/bootsnap/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
|
-
- - "
|
16
|
+
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
18
|
+
version: '0'
|
19
19
|
name: bundler
|
20
20
|
prerelease: false
|
21
21
|
type: :development
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '0'
|
33
33
|
name: rake
|
34
34
|
prerelease: false
|
35
35
|
type: :development
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
@@ -97,30 +97,21 @@ dependencies:
|
|
97
97
|
description: Boot large ruby/rails apps faster
|
98
98
|
email:
|
99
99
|
- burke.libbey@shopify.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- bootsnap
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
104
|
-
- ".gitignore"
|
105
|
-
- ".rubocop.yml"
|
106
|
-
- ".travis.yml"
|
107
105
|
- CHANGELOG.md
|
108
|
-
- CODE_OF_CONDUCT.md
|
109
|
-
- CONTRIBUTING.md
|
110
|
-
- Gemfile
|
111
106
|
- LICENSE.txt
|
112
107
|
- README.md
|
113
|
-
-
|
114
|
-
- bin/console
|
115
|
-
- bin/setup
|
116
|
-
- bin/testunit
|
117
|
-
- bootsnap.gemspec
|
118
|
-
- dev.yml
|
108
|
+
- exe/bootsnap
|
119
109
|
- ext/bootsnap/bootsnap.c
|
120
110
|
- ext/bootsnap/bootsnap.h
|
121
111
|
- ext/bootsnap/extconf.rb
|
122
112
|
- lib/bootsnap.rb
|
123
113
|
- lib/bootsnap/bundler.rb
|
114
|
+
- lib/bootsnap/cli.rb
|
124
115
|
- lib/bootsnap/compile_cache.rb
|
125
116
|
- lib/bootsnap/compile_cache/iseq.rb
|
126
117
|
- lib/bootsnap/compile_cache/yaml.rb
|
@@ -130,15 +121,22 @@ files:
|
|
130
121
|
- lib/bootsnap/load_path_cache/change_observer.rb
|
131
122
|
- lib/bootsnap/load_path_cache/core_ext/active_support.rb
|
132
123
|
- lib/bootsnap/load_path_cache/core_ext/kernel_require.rb
|
124
|
+
- lib/bootsnap/load_path_cache/core_ext/loaded_features.rb
|
125
|
+
- lib/bootsnap/load_path_cache/loaded_features_index.rb
|
133
126
|
- lib/bootsnap/load_path_cache/path.rb
|
134
127
|
- lib/bootsnap/load_path_cache/path_scanner.rb
|
128
|
+
- lib/bootsnap/load_path_cache/realpath_cache.rb
|
135
129
|
- lib/bootsnap/load_path_cache/store.rb
|
136
130
|
- lib/bootsnap/setup.rb
|
137
131
|
- lib/bootsnap/version.rb
|
138
132
|
homepage: https://github.com/Shopify/bootsnap
|
139
133
|
licenses:
|
140
134
|
- MIT
|
141
|
-
metadata:
|
135
|
+
metadata:
|
136
|
+
bug_tracker_uri: https://github.com/Shopify/bootsnap/issues
|
137
|
+
changelog_uri: https://github.com/Shopify/bootsnap/blob/master/CHANGELOG.md
|
138
|
+
source_code_uri: https://github.com/Shopify/bootsnap
|
139
|
+
allowed_push_host: https://rubygems.org
|
142
140
|
post_install_message:
|
143
141
|
rdoc_options: []
|
144
142
|
require_paths:
|
@@ -147,15 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
145
|
requirements:
|
148
146
|
- - ">="
|
149
147
|
- !ruby/object:Gem::Version
|
150
|
-
version: 2.
|
148
|
+
version: 2.3.0
|
151
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
150
|
requirements:
|
153
151
|
- - ">="
|
154
152
|
- !ruby/object:Gem::Version
|
155
153
|
version: '0'
|
156
154
|
requirements: []
|
157
|
-
|
158
|
-
rubygems_version: 2.4.8
|
155
|
+
rubygems_version: 3.1.4
|
159
156
|
signing_key:
|
160
157
|
specification_version: 4
|
161
158
|
summary: Boot large ruby/rails apps faster
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- http://shopify.github.io/ruby-style-guide/rubocop.yml
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
Exclude:
|
6
|
-
- 'vendor/**/*'
|
7
|
-
- 'tmp/**/*'
|
8
|
-
TargetRubyVersion: '2.2'
|
9
|
-
|
10
|
-
# This doesn't take into account retrying from an exception
|
11
|
-
Lint/HandleExceptions:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
# allow String.new to create mutable strings
|
15
|
-
Style/EmptyLiteral:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
# allow the use of globals which makes sense in a CLI app like this
|
19
|
-
Style/GlobalVars:
|
20
|
-
Enabled: false
|
data/.travis.yml
DELETED
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
|