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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1bf0e9189a33d19e8121e188f245bc738d7d2fe
4
- data.tar.gz: 214e8efc673b76c1eb4fdce6a076f72ec8952d86
3
+ metadata.gz: b5a4eed56375a193f8dde0b4aef4bdcb5ffac59e
4
+ data.tar.gz: 0c9a6e16ba2aa2147d3474d7be9710d314a67c30
5
5
  SHA512:
6
- metadata.gz: 07d8b865970b3bc77bb10474554dd77c0413fdd6ff2c3b386dfef0809793b9739009d13182fba426c6ac559761865ec8dad68b8d2d10ac876261f4d45933e647
7
- data.tar.gz: 6702914fcce11e5344ea9ea1af2bbeee95442f4e836ed57251e78cba7e12a57f86e5caf2ee4a2581281b43b6c2fe20744b2b4a48808ebee6d5441af1c770b10e
6
+ metadata.gz: e863df1b2d2a400d29d770482f0b8f8a0e60e39ed4850bba500ed232eccacd2fdac3fb0de11fd28fd3be20a30d873904ece13584d0e0486ce0756204de27b16a
7
+ data.tar.gz: 443d742eb6f825169dd0de640bd1fb094b9c6edbad3343ef430b68a563baecfda9f0af9cbf197c1d1df35c77ddcec88a778df209fcb19ef5c7f72996d58183cb
@@ -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
- unless absolute = @path.start_with?(SLASH)
18
- warn "Bootscale: Cannot speedup load for relative path #{@path}"
19
- end
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
@@ -1,3 +1,3 @@
1
1
  module Bootscale
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier