bormashino 0.1.5 → 0.1.8

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
  SHA256:
3
- metadata.gz: 5f967c70309ac21c13ea5ea3bf3e17c1de6eabea2c7710171bef2cab8e79c26f
4
- data.tar.gz: 26b96106a7464d6e999545ed012eaf3fc3ca3dd182e6a308d22dbb6f450a3448
3
+ metadata.gz: a8de488edca64d597da0b74e5e98b0aebdce4113f023b120b01d4070e20e3c0f
4
+ data.tar.gz: 6268a47b831d5684baf75d6b00c11b5b2a74f27190883e91286f208699c18055
5
5
  SHA512:
6
- metadata.gz: c0e96a44588a9fc35067ff4117eaee65f4181315c164857f46ad3218afdd987bdc895b9402569f2730c3b125b8a6beaccfc0327c066fe04b63451e1cb083de61
7
- data.tar.gz: a11375871333d6fe5d849d32a71c0a87ad501e6487746aae270de50dc834e04bf6682872efd57e91a138ecbdfed6a6db0e77eab1ee8f775a9bf7cf33e5f85dc8
6
+ metadata.gz: 63b5d10ddac58d17fabada628478a76f344c4a3eaee4b307c1c33e9fa3f5b268c1eb5d15d7ffa2ab9d94e0b52dcc30674e99aef973d4926e0aef336ac3e43b90
7
+ data.tar.gz: f4000b4278e59ffe53028c722a44f7088933c3a3ef23b60029ed97a4add2855576d3a60bea9c58b297729c838387ff31ddde87bb4ee6d4ee7bf9bc1cfe131087
@@ -1,25 +1,42 @@
1
1
  require 'fileutils'
2
2
  require 'uri'
3
+ require 'os'
4
+ require 'digest/md5'
3
5
 
4
- RUBY_RELEASE = 'https://github.com/ruby/ruby.wasm/releases/download/2022-04-25-a/ruby-head-wasm32-unknown-wasi-full-js.tar.gz'.freeze
6
+ RUBY_RELEASE = 'https://github.com/ruby/ruby.wasm/releases/download/2022-05-30-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.5'
4
+ VERSION = '0.1.8'
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.5
4
+ version: 0.1.8
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-12 00:00:00.000000000 Z
11
+ date: 2022-06-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