bootscale 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootscale/entry.rb +10 -10
- data/lib/bootscale/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5a4eed56375a193f8dde0b4aef4bdcb5ffac59e
|
4
|
+
data.tar.gz: 0c9a6e16ba2aa2147d3474d7be9710d314a67c30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e863df1b2d2a400d29d770482f0b8f8a0e60e39ed4850bba500ed232eccacd2fdac3fb0de11fd28fd3be20a30d873904ece13584d0e0486ce0756204de27b16a
|
7
|
+
data.tar.gz: 443d742eb6f825169dd0de640bd1fb094b9c6edbad3343ef430b68a563baecfda9f0af9cbf197c1d1df35c77ddcec88a778df209fcb19ef5c7f72996d58183cb
|
data/lib/bootscale/entry.rb
CHANGED
@@ -8,26 +8,26 @@ module Bootscale
|
|
8
8
|
NORMALIZE_NATIVE_EXTENSIONS = !DL_EXTENSIONS.include?(DOT_SO)
|
9
9
|
ALTERNATIVE_NATIVE_EXTENSIONS_PATTERN = /\.(o|bundle|dylib)\z/
|
10
10
|
SLASH = '/'.freeze
|
11
|
+
BUNDLE_PATH = Bundler.bundle_path.cleanpath.to_s << SLASH
|
11
12
|
|
12
13
|
def initialize(path)
|
13
|
-
@path = path
|
14
|
+
@path = Pathname.new(path).cleanpath
|
15
|
+
@absolute = @path.absolute?
|
16
|
+
warn "Bootscale: Cannot speedup load for relative path #{@path}" unless @absolute
|
17
|
+
@relative_slice = (@path.to_s.size + 1)..-1
|
18
|
+
@contains_bundle_path = BUNDLE_PATH.start_with?(@path.to_s)
|
14
19
|
end
|
15
20
|
|
16
21
|
def requireables
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
path_prefix = (@path.end_with?(SLASH) ? @path.size : @path.size + 1)
|
22
|
-
relative_part = path_prefix..-1
|
23
|
-
Dir[File.join(@path, REQUIREABLE_FILES)].map do |absolute_path|
|
24
|
-
relative_path = absolute_path.slice(relative_part)
|
22
|
+
Dir[File.join(@path, REQUIREABLE_FILES)].each_with_object([]) do |absolute_path, all|
|
23
|
+
next if @contains_bundle_path && absolute_path.start_with?(BUNDLE_PATH)
|
24
|
+
relative_path = absolute_path.slice(@relative_slice)
|
25
25
|
|
26
26
|
if NORMALIZE_NATIVE_EXTENSIONS
|
27
27
|
relative_path.sub!(ALTERNATIVE_NATIVE_EXTENSIONS_PATTERN, DOT_SO)
|
28
28
|
end
|
29
29
|
|
30
|
-
[relative_path, (absolute ? absolute_path : :relative)]
|
30
|
+
all << [relative_path, (@absolute ? absolute_path : :relative)]
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/lib/bootscale/version.rb
CHANGED