Skip to content

Commit

Permalink
Update README for packaging changes and general better editing
Browse files Browse the repository at this point in the history
  • Loading branch information
noahgibbs committed Jul 20, 2024
1 parent 0319a2f commit b949f1e
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,20 @@ That little text/ruby block with Shoes.app inside the Ruby script block? That's

You don't have to have Ruby installed. You don't need to clone the SpaceShoes repository. All you need is to create a little HTML file and open it in the browser. It's even fine as a file URL.

## Local Spacewalk

If you've cloned the repository, you can build your own spacewalk.js. Run "bundle install" to get the appropriate gems and then run this:

./exe/space-shoes --dev build-default

That will build a local packed_ruby.wasm containing a Ruby build and your locally-modified version of SpaceShoes. If you make changes to SpaceShoes, that's a great way to test them.

You can also run the tests:

rake test

There's a little example of using local SpaceShoes in html/templates/shoes_embed.html. It uses the spacewalk.js in html/templates. It won't work with a file URL though, because CORS policy doesn't like file URLs. So you'll need to run a local HTML server in the appropriate directory, something like this:

# From SpaceShoes root directory
ruby -run -e httpd -- -p 4321 .

Then you can access it with a local URL like "http://localhost:4321/html/templates/shoes_embed.html"

## Your Very Own Spacewalk

You can also build a packaged-up file for your app. If you want or need multiple files bundled into a Wasm module, you'll start from the Ruby side.
You can also use SpaceShoes to package up your app. If you want or need multiple files bundled into a Wasm module, you'll start from the Ruby side.

Add SpaceShoes to the application's Gemfile by executing:

$ bundle add space_shoes

Make sure it's installed:

$ bundle install

SpaceShoes will make a package containing specific versions of Ruby and SpaceShoes, plus whatever other gems are in your Gemfile. It will pick up all the local files, including images and Ruby source files. Try not to have any huge files sitting around, or they will be included in your Wasm package!

~~~HTML
<!DOCTYPE html>
<html lang="en">
Expand All @@ -69,7 +56,7 @@ Add SpaceShoes to the application's Gemfile by executing:
<script type="text/ruby">
Shoes.app do
para "Images are good too."
image "my_local_file.png" # TODO: test me!
image "my_local_file.png"
end
</script>

Expand All @@ -81,6 +68,26 @@ Add SpaceShoes to the application's Gemfile by executing:

TODO: more information about how to make this work.


## Developing Spacewalk

If you've cloned the repository, you can build your own spacewalk.js. Run "bundle install" to get the appropriate gems and then run this:

./exe/space-shoes --dev build-default

That will build a local packed_ruby.wasm containing a Ruby build and your locally-modified version of SpaceShoes. If you make changes to SpaceShoes, that's a great way to test them.

You can also run the tests:

rake test

There's a little example of using local SpaceShoes in html/templates/shoes_embed.html. It uses the spacewalk.js in html/templates. It won't work with a file URL though, because CORS policy doesn't like file URLs. So you'll need to run a local HTML server in the appropriate directory, something like this:

# From SpaceShoes root directory
ruby -run -e httpd -- -p 4321 .

Then you can access it with a local URL like "http://localhost:4321/html/templates/shoes_embed.html"

## Binaryen

* https://github.com/WebAssembly/binaryen/releases
Expand Down Expand Up @@ -120,9 +127,9 @@ EvilMartians blog post on using Ruby.wasm's Bundler integration

## History

[Giovanni Borgh](https://github.com/alawysdelta/) wrote the initial scarpe-wasm code, including tools like wasify, for his Google Summer of Code project. Noah Gibbs then adapted it to Scarpe and its dependencies (e.g. Lacci, Scarpe-Components, Calzini).
[Giovanni Borgh](https://github.com/alawysdelta/) wrote the initial scarpe-wasm code, including tools like wasify, for his Google Summer of Code project. Noah Gibbs then adapted it to use Scarpe.

The top-level structure of SpaceShoes is different from scarpe-wasm. But a lot of the actual initial code comes from scarpe-wasm and was co-written by Noah Gibbs and/or Giovanni Borgh. The import of scarpe-wasm doesn't attempt to tease all this apart accurately - there are some commits that credit Giovanni as co-author in general, but mostly the code is just copied over.
Some of the top-level structure of SpaceShoes is different from scarpe-wasm. But a lot of the actual initial code comes from scarpe-wasm and was written by Noah Gibbs and/or Giovanni Borgh.

## License

Expand Down

0 comments on commit b949f1e

Please sign in to comment.