crystal-repl-server
crystal-repl-server
Experimental tool to run a Crystal REPL as an HTTP Server.
Installation
Prerequisites
- The latest version of crystal.
- Be able to compile crystal from sources.
Usage
After building the bin/crystal-repl-server
binary, run it with:
./bin/crystal-repl-server /tmp/crystal-repl-0001.sock
Then, in another terminal, run:
% curl -X POST --unix-socket /tmp/crystal-repl-0001.sock http://server/v1/start
{"status":"ok"}
% curl -X POST --unix-socket /tmp/crystal-repl-0001.sock http://server/v1/eval -d '1 + 2'
{"value":"3","runtime_type":"Int32","static_type":"Int32","type":"success"}
Development
To build crystal-repl-server using the install crystal compiler run:
make bin/crystal-repl-server
# or
make all
You will need to have the same llvm version installed as the one informed in crystal --version
.
To build crystal-repl-server using crystal sources run:
make all CRYSTAL=~/path/to/crystal-clone/bin/crystal
You will need to run make clean deps
in your crystal-clone first.
In either case, the crystal-repl-server binary will be left in the ./bin/crystal-repl-server
.
To specify a specific llvm-config, use the LLVM_CONFIG
environment variable.
To build the repl with --relase
pass FLAGS=--release
.
make clean bin/crystal-repl-server FLAGS=--release
Specs
To run the specs do
make system_spec
# or
make all
Contributing
- Fork it (https://github.com/bcardiff/crystal-repl-server/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Brian J. Cardiff - creator and maintainer
crystal-repl-server
- 3
- 0
- 0
- 0
- 0
- about 1 year ago
- September 13, 2023
MIT License
Thu, 21 Nov 2024 17:35:53 GMT