From 90ca7a9489ef3b30c4966dfe39aa913ab3e5eaeb Mon Sep 17 00:00:00 2001 From: Noah Gibbs Date: Fri, 15 Dec 2023 22:25:51 +0000 Subject: [PATCH 1/5] Allow specifying downloaded version with an environment variable. Default to release 2.3.0 since 2.4.0 changes filenames and behavior significantly So the env var won't work for version 2.4.0+. --- lib/wasify/cmd_runner.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/wasify/cmd_runner.rb b/lib/wasify/cmd_runner.rb index bcefde4..2cb8aa9 100644 --- a/lib/wasify/cmd_runner.rb +++ b/lib/wasify/cmd_runner.rb @@ -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 From 5ec1bcc052770447f903559a5a58543a547ad0f3 Mon Sep 17 00:00:00 2001 From: Noah Gibbs Date: Sat, 30 Dec 2023 11:50:18 +0000 Subject: [PATCH 2/5] Use correct version in HTML template too --- lib/wasify.rb | 1 + lib/wasify/template.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/wasify.rb b/lib/wasify.rb index f1e1090..039dab3 100644 --- a/lib/wasify.rb +++ b/lib/wasify.rb @@ -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') diff --git a/lib/wasify/template.erb b/lib/wasify/template.erb index 2c411e2..09f67cb 100644 --- a/lib/wasify/template.erb +++ b/lib/wasify/template.erb @@ -1,6 +1,6 @@ - +