bootsnap 0.2.9 → 0.2.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe31f9a445fa33edd58c5f58e0f661c0e08d2004
4
- data.tar.gz: e01345ff505baf0ce9aa6a104325a93092d0ab53
3
+ metadata.gz: fcd4e8ebf4dd23bfc40fc7050f2c514a3290942f
4
+ data.tar.gz: a26b06131e80497bb4c223c7db9ee7287cb03bf9
5
5
  SHA512:
6
- metadata.gz: c319a87aa7d1db72c3535e0af539cd8629852238b4b88bcc1b4a7cf57ea978707aa82b879730815e293c5944b4c40d8b2531a8639780491853c58b66de01191e
7
- data.tar.gz: d2d6042b09014425a6d4feb3d1abe28c1a1eaeddd1c29fff8752ba907322349129d065c38109b6d460438b667a72b04626165a59cde12f7af509c9043ba254e5
6
+ metadata.gz: 34d6e350baf6ba66ba9dcb3533066153f34e9303897ecea815e651624064af479eabe23075d7f36f063dc927b9570cdff26891087fde7233ada51fafecf2ca96
7
+ data.tar.gz: f603e54de0100b3f464a2ca9dee119db9d338f3c7f84ffe3952f5b9c83213d0371d7e0b7d54d7903423d6a787af1c51c3adc824cdf698ffd7b9994aed5a13d4e
data/dev.yml CHANGED
@@ -1,3 +1,6 @@
1
+ env:
2
+ BOOTSNAP_PEDANTIC: '1'
3
+
1
4
  up:
2
5
  - ruby: 2.3.3
3
6
  - bundler
@@ -1,6 +1,17 @@
1
1
  require "mkmf"
2
- $CFLAGS << ' -O3 -std=c99'
3
- $CFLAGS << ' -Wall -Wextra -Wpedantic -Werror'
4
- $CFLAGS << ' -Wno-unused-parameter' # VALUE self has to be there but we don't care what it is.
5
- $CFLAGS << ' -Wno-keyword-macro' # hiding return
2
+ $CFLAGS << ' -O3 '
3
+ $CFLAGS << ' -std=c99'
4
+
5
+ # ruby.h has some -Wpedantic fails in some cases
6
+ # (e.g. https://github.com/Shopify/bootsnap/issues/15)
7
+ unless ['0', '', nil].include?(ENV['BOOTSNAP_PEDANTIC'])
8
+ $CFLAGS << ' -Wall'
9
+ $CFLAGS << ' -Werror'
10
+ $CFLAGS << ' -Wextra'
11
+ $CFLAGS << ' -Wpedantic'
12
+
13
+ $CFLAGS << ' -Wno-unused-parameter' # VALUE self has to be there but we don't care what it is.
14
+ $CFLAGS << ' -Wno-keyword-macro' # hiding return
15
+ end
16
+
6
17
  create_makefile("bootsnap/bootsnap")
@@ -54,22 +54,20 @@ module Bootsnap
54
54
  x = search_index(feature)
55
55
  return x if x
56
56
 
57
+ # Ruby has some built-in features that require lies about.
58
+ # For example, 'enumerator' is built in. If you require it, ruby
59
+ # returns false as if it were already loaded; however, there is no
60
+ # file to find on disk. We've pre-built a list of these, and we
61
+ # return false if any of them is loaded.
62
+ raise LoadPathCache::ReturnFalse if BUILTIN_FEATURES.key?(feature)
63
+
57
64
  # The feature wasn't found on our preliminary search through the index.
58
65
  # We resolve this differently depending on what the extension was.
59
66
  case File.extname(feature)
60
67
  # If the extension was one of the ones we explicitly cache (.rb and the
61
68
  # native dynamic extension, e.g. .bundle or .so), we know it was a
62
69
  # failure and there's nothing more we can do to find the file.
63
- when *CACHED_EXTENSIONS # .rb, .bundle or .so
64
- nil
65
- # If no extension was specified, it's the same situation, since we
66
- # try appending both cachable extensions in search_index. However,
67
- # there's a special-case for 'enumerator'. Before ruby 1.9, you had
68
- # to `require 'enumerator'` to use it. In 1.9+, it's pre-loaded, but
69
- # doesn't correspond to any entry on the filesystem. Ruby lies. So we
70
- # lie too, forcing our monkeypatch to return false like ruby would.
71
- when ""
72
- raise LoadPathCache::ReturnFalse if BUILTIN_FEATURES.key?(feature)
70
+ when '', *CACHED_EXTENSIONS # no extension, .rb, (.bundle or .so)
73
71
  nil
74
72
  # Ruby allows specifying native extensions as '.so' even when DLEXT
75
73
  # is '.bundle'. This is where we handle that case.
@@ -122,6 +120,7 @@ module Bootsnap
122
120
  @store.transaction do
123
121
  paths.map(&:to_s).each do |path|
124
122
  p = Path.new(path)
123
+ next if p.non_directory?
125
124
  entries, dirs = p.entries_and_dirs(@store)
126
125
  # push -> low precedence -> set only if unset
127
126
  dirs.each { |dir| @dirs[dir] ||= true }
@@ -134,6 +133,7 @@ module Bootsnap
134
133
  @store.transaction do
135
134
  paths.map(&:to_s).reverse.each do |path|
136
135
  p = Path.new(path)
136
+ next if p.non_directory?
137
137
  entries, dirs = p.entries_and_dirs(@store)
138
138
  # unshift -> high precedence -> unconditional set
139
139
  dirs.each { |dir| @dirs[dir] = true }
@@ -23,6 +23,13 @@ module Bootsnap
23
23
  @path = path.to_s
24
24
  end
25
25
 
26
+ # True if the path exists, but represents a non-directory object
27
+ def non_directory?
28
+ !File.stat(path).directory?
29
+ rescue Errno::ENOENT
30
+ false
31
+ end
32
+
26
33
  # Return a list of all the requirable files and all of the subdirectories
27
34
  # of this +Path+.
28
35
  def entries_and_dirs(store)
@@ -1,3 +1,3 @@
1
1
  module Bootsnap
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.12"
3
3
  end
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: 0.2.9
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-25 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler