raindown 0.21.2 → 0.21.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/raindown/yjit.rb +15 -7
  3. data/lib/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14386d5918ff2a82381d76226f8d51f2464681836ab62438e9820a5e3622bd98
4
- data.tar.gz: 5d54b9b4656de75b45333f566f7a6ddd6903ab96611c4edbef98c44b14234b3c
3
+ metadata.gz: 714d64b4843d94b4752da53527dcc7c2f3e1fe77ce4aea56aec0ca0b76dfaa6a
4
+ data.tar.gz: be27d12a02197bcac1b2ef6f404779de9a47a3d8047787db4291731e4ff3cbc9
5
5
  SHA512:
6
- metadata.gz: 953e7b73e969477ec22dba2d0364404a2885ed51e78e3a9607535c303344015b13b40786f344ba60c1aa0803f4e286d2d48cc57a308ed1ffb3aac8b26b779101
7
- data.tar.gz: 1c3fc1c75e2b0d15cb596c2a0824f5e6ced56da43edd66b9875d6daed8796c22e13f2aeb789cd2762734798ab96ff783b2e885ae66a74a3a2267c5fbaac59a0e
6
+ metadata.gz: b90a67a177422426703135277ab357e1d332968303ca4adaca91043f99b8ae70f91ab52de03097d1f307ea52519ef687edce28f4b08eafd9d69b0a6caf8b9885
7
+ data.tar.gz: 6d1e00f5edcdaabeecc8bb87b2a9854f075649efe4dee83447156eaff48c5c3f4d58ae4ba88a0ab8bfd21f69902b10cc0996f8f5969ae2d3c2276999b1506d99
data/lib/raindown/yjit.rb CHANGED
@@ -1,20 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raindown
4
- # Ruby leaves YJIT off unless asked, which makes nodes that compute in loops several times faster.
4
+ # Ruby leaves YJIT off unless asked, which makes nodes that compute in loops several times faster. A Ruby built
5
+ # without it, like ruby.wasm's, has no RubyVM::YJIT.
5
6
  module Yjit
7
+ # The runtime a macOS binary carries, signed to allow YJIT, as its folder in tebako's cache and its SHA-256, which
8
+ # rakelib's tebako task writes into the package.
9
+ RUNTIME = File.expand_path('../../yjit_runtime', __dir__)
10
+
6
11
  module_function
7
12
 
8
13
  def enable
9
- RubyVM::YJIT.enable if available?
14
+ RubyVM::YJIT.enable if defined?(RubyVM::YJIT) && allowed?
10
15
  end
11
16
 
12
- # A Ruby built without YJIT, like ruby.wasm's, has no RubyVM::YJIT. macOS kills a tebako binary, which is signed ad
13
- # hoc, as soon as it runs code YJIT compiled, so the binary's files, under /__tfs__/, leave it off there.
14
- def available?
15
- return false unless defined?(RubyVM::YJIT)
17
+ # macOS kills a binary as soon as it runs code YJIT compiled, unless its runtime's signed to allow it. The binary
18
+ # carries one that is, but tebako runs the one it cached first, which an earlier binary may have left, tebako's own.
19
+ def allowed?
20
+ return true unless RUBY_PLATFORM.include?('darwin') && __dir__.start_with?('/__tfs__/')
21
+ return false unless File.exist?(RUNTIME)
16
22
 
17
- !(RUBY_PLATFORM.include?('darwin') && __dir__.start_with?('/__tfs__/'))
23
+ folder, digest = File.read(RUNTIME).split
24
+ cached = File.join(Dir.home, '.tebako', 'runtimes', folder, 'sha256')
25
+ File.exist?(cached) && File.read(cached).start_with?(digest)
18
26
  end
19
27
  end
20
28
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Raindown
4
- VERSION = '0.21.2'
4
+ VERSION = '0.21.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raindown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.2
4
+ version: 0.21.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - maedi