raindown 0.21.0 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 537d6e6dd373dffcd9616142d4cf5798f281c96d7aa4177fee5731d0060b2226
4
- data.tar.gz: ec9e9426b6c9fc8b41ff9ba59eaff4fd76819cc15462ae3f0ee8f496a15a821d
3
+ metadata.gz: 714d64b4843d94b4752da53527dcc7c2f3e1fe77ce4aea56aec0ca0b76dfaa6a
4
+ data.tar.gz: be27d12a02197bcac1b2ef6f404779de9a47a3d8047787db4291731e4ff3cbc9
5
5
  SHA512:
6
- metadata.gz: ec35463daeacfaad63e3abddd53bf2a4061d5cafdab2a43a79c4afeb00f4c39df5c53d674b84bd5dc9a79f8dfe479976955bfca842a7dffb31e00bcc30f4a42e
7
- data.tar.gz: 7a1dfeb15899ea565fcc430fcacc163c7a0d759af878dfb68fcc9371e408c0f2f31eeba8f8d50e5aa5b9fa84929c1fc0d6000a5cd6af906ab85ac9d049b8ee0b
6
+ metadata.gz: b90a67a177422426703135277ab357e1d332968303ca4adaca91043f99b8ae70f91ab52de03097d1f307ea52519ef687edce28f4b08eafd9d69b0a6caf8b9885
7
+ data.tar.gz: 6d1e00f5edcdaabeecc8bb87b2a9854f075649efe4dee83447156eaff48c5c3f4d58ae4ba88a0ab8bfd21f69902b10cc0996f8f5969ae2d3c2276999b1506d99
data/lib/raindown/cli.rb CHANGED
@@ -13,6 +13,7 @@ require_relative 'server'
13
13
  require_relative 'skeleton'
14
14
  require_relative 'watcher/file_watcher'
15
15
  require_relative 'watcher/supervisor'
16
+ require_relative 'yjit'
16
17
 
17
18
  module Raindown
18
19
  module CLI
@@ -81,6 +82,7 @@ module Raindown
81
82
  def self.run(argv)
82
83
  # Markdown is UTF-8 whatever the locale, as an app opened from the Dock, like Obsidian, starts Raindown without one.
83
84
  Encoding.default_external = Encoding::UTF_8
85
+ Yjit.enable
84
86
  return if command(argv) || Skeleton.run_command(argv)
85
87
 
86
88
  argv = with_path(argv)
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Raindown
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.
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
+
11
+ module_function
12
+
13
+ def enable
14
+ RubyVM::YJIT.enable if defined?(RubyVM::YJIT) && allowed?
15
+ end
16
+
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)
22
+
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)
26
+ end
27
+ end
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.0'
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.0
4
+ version: 0.21.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - maedi
@@ -367,6 +367,7 @@ files:
367
367
  - lib/raindown/workers/worker.rb
368
368
  - lib/raindown/workers/workers.rb
369
369
  - lib/raindown/written.rb
370
+ - lib/raindown/yjit.rb
370
371
  - lib/version.rb
371
372
  homepage: https://github.com/rainpour/raindown
372
373
  licenses: []