File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
file "wasi-vfs" do
4
- version = "0.1.1 "
4
+ version = "0.2.0 "
5
5
filename =
6
6
if ENV [ "CI" ]
7
7
"wasi-vfs-cli-x86_64-unknown-linux-gnu.zip"
@@ -19,7 +19,7 @@ file "head-wasm32-unknown-wasi-full-js" do
19
19
version = JSON . parse ( File . read ( "package.json" ) ) [ "dependencies" ] [ "ruby-head-wasm-wasi" ] [ 1 ..]
20
20
filename = "ruby-head-wasm32-unknown-wasi-full-js.tar.gz"
21
21
22
- `curl -LO https://github.com/ruby/ruby.wasm/releases/download/ruby-head-wasm-wasi-#{ version } /#{ filename } `
22
+ `curl -LO https://github.com/ruby/ruby.wasm/releases/download/ruby-head-wasm-wasi-#{ version } /ruby-head-wasm32-unknown-wasi-full-js.tar.gz `
23
23
`tar xfz #{ filename } `
24
24
rm filename
25
25
end
30
30
31
31
file "src/app.wasm" => [ "Gemfile.lock" , "wasi-vfs" , "ruby.wasm" ] do
32
32
require "bundler/setup"
33
- cp_r $:. find { _1 . include? ( "syntax_tree" ) } , "lib"
33
+
34
+ cp_r $:. find { _1 . include? ( "syntax_tree" ) } , "."
35
+ cp_r $:. find { _1 . include? ( "prettier_print" ) } , "."
34
36
35
37
`./wasi-vfs pack ruby.wasm --mapdir /lib::./lib --mapdir /usr::./head-wasm32-unknown-wasi-full-js/usr -o src/app.wasm`
36
38
rm_rf "lib"
Original file line number Diff line number Diff line change @@ -66,10 +66,12 @@ export default async function createRuby() {
66
66
// files to make it work. I'm not sure why I need to explicitly require
67
67
// did_you_mean here, but it doesn't work without it.
68
68
ruby . eval ( `
69
+ require "rubygems"
69
70
require "did_you_mean"
70
71
require "json"
71
72
$:.unshift("/lib")
72
73
require_relative "/lib/syntax_tree"
74
+ require_relative "/lib/prettier_print"
73
75
` ) ;
74
76
75
77
return {
@@ -93,10 +95,8 @@ export default async function createRuby() {
93
95
prettyPrint ( source : string ) {
94
96
const jsonSource = JSON . stringify ( JSON . stringify ( source ) ) ;
95
97
const rubySource = `
96
- PP.format([], 80) do |q|
97
- source = JSON.parse(${ jsonSource } )
98
- SyntaxTree.parse(source).pretty_print(q)
99
- end.join
98
+ source = JSON.parse(${ jsonSource } )
99
+ SyntaxTree.parse(source).pretty_inspect
100
100
` ;
101
101
102
102
return ruby . eval ( rubySource ) . toString ( ) ;
You can’t perform that action at this time.
0 commit comments