Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/wasify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def self.pack

def self.generate_html(entrypoint)
entrypoint_txt = DepsManager.add_entrypoint(entrypoint)
wasm_wasi_version = ENV["WASIFY_VERSION"] || "2.3.0"
template = 'wasify/template.erb'
html = ERB.new(File.read(File.join(__dir__, template))).result(binding)
File.rename('index.html', 'index.html.bak') if File.exist?('index.html')
Expand Down
3 changes: 2 additions & 1 deletion lib/wasify/cmd_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class Wasify
# methods interacting with the command line
class CMDRunner
def self.download_binary
system('curl -LO https://github.com/ruby/ruby.wasm/releases/latest/download/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz')
version = ENV["WASIFY_VERSION"] || "2.3.0"
system("curl -LO https://github.com/ruby/ruby.wasm/releases/download/#{version}/ruby-3_2-wasm32-unknown-wasi-full-js.tar.gz")
end

def self.unzip_binary
Expand Down
2 changes: 1 addition & 1 deletion lib/wasify/template.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<html>
<script src="https://cdn.jsdelivr.net/npm/@ruby/wasm-wasi@latest/dist/browser.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ruby/wasm-wasi@<%= wasm_wasi_version || "latest" %>/dist/browser.umd.js"></script>
<script>
const { DefaultRubyVM } = window["ruby-wasm-wasi"];
const main = async () => {
Expand Down