2018-06-12 17:58:38 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2019-04-24 16:58:30 -07:00
|
|
|
root=$PWD
|
2018-06-12 17:58:38 -07:00
|
|
|
cd docs
|
2019-04-24 16:58:30 -07:00
|
|
|
|
|
|
|
|
bundle exec jekyll serve "$@" &
|
|
|
|
|
|
|
|
|
|
bundle exec ruby <<RUBY &
|
|
|
|
|
require "listen"
|
2019-04-26 19:13:32 -07:00
|
|
|
|
|
|
|
|
def copy_wasm_files
|
2019-09-11 14:44:49 -07:00
|
|
|
`cp $root/lib/binding_web/tree-sitter.{js,wasm} $root/docs/assets/js/`
|
2020-02-21 17:05:46 -08:00
|
|
|
`cp $root/target/release/*.wasm $root/docs/assets/js/`
|
2019-04-24 16:58:30 -07:00
|
|
|
end
|
2019-04-26 19:13:32 -07:00
|
|
|
|
|
|
|
|
puts "Copying WASM files to docs folder..."
|
|
|
|
|
copy_wasm_files
|
|
|
|
|
|
|
|
|
|
puts "Watching release directory"
|
2019-09-11 14:44:49 -07:00
|
|
|
listener = Listen.to("$root/lib/binding_web", only: /^tree-sitter\.(js|wasm)$/, wait_for_delay: 2) do
|
2019-04-26 19:13:32 -07:00
|
|
|
puts "WASM files updated. Copying new files to docs folder..."
|
|
|
|
|
copy_wasm_files
|
|
|
|
|
end
|
|
|
|
|
|
2019-04-24 16:58:30 -07:00
|
|
|
listener.start
|
|
|
|
|
sleep
|
|
|
|
|
RUBY
|
|
|
|
|
|
|
|
|
|
wait
|