bormashino 0.1.4 → 0.1.7

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: 746545a9c19d9636a66fe0f695a2960bf96ec9d549eb54eea02f8421033df62c
4
- data.tar.gz: b5d32e291df6331f2a653ff27a795fc94893dc0d45ad9d793fc3999ce3fe7bd0
3
+ metadata.gz: 19046da45e61a5eb600c18e2081d09bd9637ff1b940d05945ec248560de9db01
4
+ data.tar.gz: f288a032b1ca977e44080893ad30d86de44e4d6f08718cea2f9b66240cc3c5d4
5
5
  SHA512:
6
- metadata.gz: 0a7e007e9615dd0b759c2b8cc30fbb4292c678a241db0bde8dd2ddb472c1f3640e839caac24d2b813ef4be547c01deb69319bc8ebaa61304f63bdc379833d022
7
- data.tar.gz: ebbf53d4c6d772aea0fc4dff5ed9ac204fd0c0e0550eab18906cc8d5a4846a6e9586def616f7eafebc3ae2f4121fa75b6f36c5f7931b4563f638328190fabccc
6
+ metadata.gz: 6ae99fa09be0419565a648ec7d3f9d01613dbf0f4dd1df12d7db866f4d27aaf5ae38ce107dc1186174ee93fff6a224d2d1864eb686e63520745445ad88c782af
7
+ data.tar.gz: c3041acff2f933a2863e0f20f7207b5c1a2a6b423a81a9aa58822a38a5127baaba3679ee1caae0b5529950ec9663e75af8cd6d989baf238621f6a4fb42c460d1
@@ -1,25 +1,42 @@
1
1
  require 'fileutils'
2
2
  require 'uri'
3
+ require 'os'
4
+ require 'digest/md5'
3
5
 
4
6
  RUBY_RELEASE = 'https://github.com/ruby/ruby.wasm/releases/download/2022-04-25-a/ruby-head-wasm32-unknown-wasi-full-js.tar.gz'.freeze
5
7
  WASI_VFS_RELEASE = 'https://github.com/kateinoigakukun/wasi-vfs/releases/download/v0.1.1/wasi-vfs-cli-x86_64-unknown-linux-gnu.zip'.freeze
8
+ WASI_VFS_RELEASE_MAC_X86_64 = 'https://github.com/kateinoigakukun/wasi-vfs/releases/download/v0.1.1/wasi-vfs-cli-x86_64-apple-darwin.zip'.freeze
9
+ WASI_VFS_RELEASE_MAC_ARM64 = 'https://github.com/kateinoigakukun/wasi-vfs/releases/download/v0.1.1/wasi-vfs-cli-aarch64-apple-darwin.zip'.freeze
10
+
6
11
  RUBY_ROOT = File.basename(URI(RUBY_RELEASE).path).split('.').first.sub('ruby-', '')
7
12
  WASI_VFS = './wasi-vfs'.freeze
8
13
  TMP = 'tmp'.freeze
9
14
  DIGEST = 'js/ruby-digest.js'.freeze
10
15
 
11
16
  namespace :bormashino do
12
- desc 'ruby.wasm及びwasi-vfsをダウンロードする'
17
+ desc 'download ruby.wasm and wasi-vfs'
13
18
  task :download do
14
19
  system "curl -L #{RUBY_RELEASE} | tar xz"
15
20
  FileUtils.rm(File.join(RUBY_ROOT, '/usr/local/lib/libruby-static.a'))
16
21
  FileUtils.rm_rf(File.join(RUBY_ROOT, '/usr/local/include'))
17
22
 
18
- system "curl -L '#{WASI_VFS_RELEASE}' | gzip -d > wasi-vfs"
23
+ case
24
+ when OS.linux?
25
+ system "curl -L '#{WASI_VFS_RELEASE}' | gzip -d > wasi-vfs"
26
+ when OS.mac?
27
+ if OS.host_cpu == 'x86_64'
28
+ system "curl -L -o wasi-vfs.zip '#{WASI_VFS_RELEASE_MAC_X86_64}'"
29
+ else
30
+ system "curl -L -o wasi-vfs.zip '#{WASI_VFS_RELEASE_MAC_ARM64}'"
31
+ end
32
+ system 'unzip wasi-vfs.zip'
33
+ system 'rm wasi-vfs.zip'
34
+ end
35
+
19
36
  system 'chmod u+x wasi-vfs'
20
37
  end
21
38
 
22
- desc 'wasi_vfsでアプリに使用するRubyスクリプト群を埋め込む'
39
+ desc 'embed ruby scripts with wasi-vfs'
23
40
  task :pack, [:additional_args] do |_, args|
24
41
  gem_dir = Gem::Specification.find_by_name('bormashino').gem_dir
25
42
 
@@ -35,9 +52,9 @@ namespace :bormashino do
35
52
  ].compact.join(' '))
36
53
  end
37
54
 
38
- desc 'pack済みのruby.wasmのMD5を取りファイル名につけてコピーし、import用のJSを出力する'
55
+ desc 'add MD5 to packed ruby.wasm and write JS for importing'
39
56
  task :digest, [:destination] do |_, args|
40
- digest = `md5sum tmp/ruby.wasm`.split.first
57
+ digest = Digest::MD5.file('tmp/ruby.wasm').hexdigest
41
58
  FileUtils.cp('tmp/ruby.wasm', "#{args[:destination]}/ruby.#{digest}.wasm")
42
59
  File.open(DIGEST, 'w') { |f|
43
60
  f.puts "export default rubyDigest = '#{digest}'
@@ -45,7 +62,7 @@ namespace :bormashino do
45
62
  }
46
63
  end
47
64
 
48
- desc '指定ディレクトリ中のdigest付きruby.wasmを削除する'
65
+ desc 'clean built ruby.wasm files'
49
66
  task :delete_wasms, [:target] do |_, args|
50
67
  Dir.glob(File.join(args[:target], 'ruby.*.wasm')).each { |f| FileUtils.rm(f) }
51
68
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bormashino
4
- VERSION = '0.1.4'
4
+ VERSION = '0.1.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bormashino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenichiro Yasuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-08 00:00:00.000000000 Z
11
+ date: 2022-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_pure
@@ -58,6 +58,26 @@ dependencies:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.0.4
61
+ - !ruby/object:Gem::Dependency
62
+ name: os
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.1'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 1.1.4
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.1'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 1.1.4
61
81
  description: ' With "Bormaŝino" you can build SPAs written in Ruby powered by Ruby
62
82
  WebAssembly build and Sinatra (or other rack-based web application frameworks).
63
83