bootsnap 1.2.1-java → 1.3.0.beta2-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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/bootsnap/load_path_cache.rb +4 -1
- data/lib/bootsnap/load_path_cache/cache.rb +1 -1
- data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +16 -0
- data/lib/bootsnap/load_path_cache/realpath_cache.rb +32 -0
- data/lib/bootsnap/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c23429f6bae9a603329d2efa2aa686e91d305a02
|
4
|
+
data.tar.gz: de49aa225d4c82832cf4471692ef52661e5c7c2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87b7e39d81d09380239275c22db7fd5a76bfedb5bb8e5bf1fdd2c721054cb1b705ec1bcc1edaf1b5750bb69c61af852122c8db7406df481cfda25f04d29b9421
|
7
|
+
data.tar.gz: 11cc3544fb2744ee6c4778b7a82ef79395762298165d48d3a88612579d01c314aa7fef01bff372e8df15d4a7b3837a6a6ac9dc990596acf27148e18d1e0092d9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -21,12 +21,14 @@ module Bootsnap
|
|
21
21
|
CACHED_EXTENSIONS = DLEXT2 ? [DOT_RB, DLEXT, DLEXT2] : [DOT_RB, DLEXT]
|
22
22
|
|
23
23
|
class << self
|
24
|
-
attr_reader :load_path_cache, :autoload_paths_cache,
|
24
|
+
attr_reader :load_path_cache, :autoload_paths_cache,
|
25
|
+
:loaded_features_index, :realpath_cache
|
25
26
|
|
26
27
|
def setup(cache_path:, development_mode:, active_support: true)
|
27
28
|
store = Store.new(cache_path)
|
28
29
|
|
29
30
|
@loaded_features_index = LoadedFeaturesIndex.new
|
31
|
+
@realpath_cache = RealpathCache.new
|
30
32
|
|
31
33
|
@load_path_cache = Cache.new(store, $LOAD_PATH, development_mode: development_mode)
|
32
34
|
require_relative 'load_path_cache/core_ext/kernel_require'
|
@@ -53,3 +55,4 @@ require_relative 'load_path_cache/cache'
|
|
53
55
|
require_relative 'load_path_cache/store'
|
54
56
|
require_relative 'load_path_cache/change_observer'
|
55
57
|
require_relative 'load_path_cache/loaded_features_index'
|
58
|
+
require_relative 'load_path_cache/realpath_cache'
|
@@ -9,7 +9,7 @@ module Bootsnap
|
|
9
9
|
@development_mode = development_mode
|
10
10
|
@store = store
|
11
11
|
@mutex = defined?(::Mutex) ? ::Mutex.new : ::Thread::Mutex.new # TODO: Remove once Ruby 2.2 support is dropped.
|
12
|
-
@path_obj = path_obj
|
12
|
+
@path_obj = path_obj.map! { |f| File.exist?(f) ? File.realpath(f) : f }
|
13
13
|
@has_relative_paths = nil
|
14
14
|
reinitialize
|
15
15
|
end
|
@@ -36,6 +36,14 @@ module Kernel
|
|
36
36
|
require_with_bootsnap_lfi(path)
|
37
37
|
end
|
38
38
|
|
39
|
+
alias_method :require_relative_without_bootsnap, :require_relative
|
40
|
+
def require_relative(path)
|
41
|
+
realpath = Bootsnap::LoadPathCache.realpath_cache.call(
|
42
|
+
caller_locations(1..1).first.absolute_path, path
|
43
|
+
)
|
44
|
+
require(realpath)
|
45
|
+
end
|
46
|
+
|
39
47
|
alias_method :load_without_bootsnap, :load
|
40
48
|
def load(path, wrap = false)
|
41
49
|
if resolved = Bootsnap::LoadPathCache.load_path_cache.find(path)
|
@@ -78,6 +86,14 @@ class << Kernel
|
|
78
86
|
require_with_bootsnap_lfi(path)
|
79
87
|
end
|
80
88
|
|
89
|
+
alias_method :require_relative_without_bootsnap, :require_relative
|
90
|
+
def require_relative(path)
|
91
|
+
realpath = Bootsnap::LoadPathCache.realpath_cache.call(
|
92
|
+
caller_locations(1..1).first.absolute_path, path
|
93
|
+
)
|
94
|
+
require(realpath)
|
95
|
+
end
|
96
|
+
|
81
97
|
alias_method :load_without_bootsnap, :load
|
82
98
|
def load(path, wrap = false)
|
83
99
|
if resolved = Bootsnap::LoadPathCache.load_path_cache.find(path)
|
@@ -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
|
+
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/lib/bootsnap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0.beta2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/bootsnap/load_path_cache/loaded_features_index.rb
|
135
135
|
- lib/bootsnap/load_path_cache/path.rb
|
136
136
|
- lib/bootsnap/load_path_cache/path_scanner.rb
|
137
|
+
- lib/bootsnap/load_path_cache/realpath_cache.rb
|
137
138
|
- lib/bootsnap/load_path_cache/store.rb
|
138
139
|
- lib/bootsnap/setup.rb
|
139
140
|
- lib/bootsnap/version.rb
|
@@ -153,9 +154,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
153
154
|
version: 2.0.0
|
154
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
156
|
requirements:
|
156
|
-
- - "
|
157
|
+
- - ">"
|
157
158
|
- !ruby/object:Gem::Version
|
158
|
-
version:
|
159
|
+
version: 1.3.1
|
159
160
|
requirements: []
|
160
161
|
rubyforge_project:
|
161
162
|
rubygems_version: 2.4.8
|