class Object

Constants

HTML_TEMPLATE
TEMPLATE

Public Instance Methods

help() click to toggle source
# File bin/prism, line 54
def help
  puts <<-HEREDOC.strip
Usage: prism <command> [options]

Commands:
  init [<path>]
    initializes a new prism application at the given path
    default: ./app.rb

  server [<port> <host>]
    runs a dev server on the given host and port
    default: 3000 127.0.0.1

  HEREDOC
end
init(path = "app.rb") click to toggle source
# File bin/prism, line 40
def init(path = "app.rb")
  fail "#{path} already exists" if File.exist?(path)
  File.write(path, TEMPLATE) # TODO - there's a race condition here where the file is created between the previous statement and this one
  puts "Created new Prism app at app.rb\n\nRun prism server to see your app."
end
server(port = 3042, host = '127.0.0.1') click to toggle source
# File bin/prism, line 46
def server(port = 3042, host = '127.0.0.1')
  IO.popen("node #{__dir__}/../wasm-server.js #{port} #{host}") do |f|
    until f.eof?
      puts f.gets
    end
  end
end