fsxNet Wiki

BBS Development & Resources

User Tools

Site Tools


tutorials:crystal_bbs:part_one

This is an old revision of the document!


Crystal BBS - Part One

Getting the ball rolling

OK, so let's start with some actual BBS programming! I've chosen Crystal for this tutorial, so you'll need to install it. At the moment this is being written, the current version is 0.21.1. As the language is still in alpha, a lot may break until it reaches 1.0 (scheduled for later in 2017) and I'll try to keep this updated.

I won't cover installation, since the official docs are pretty good at that. You will need a macOS or Linux setup, either native or in a virtual machine.

Once you have it installed, it's time to get going. Crystal has a “skeleton” too built-in that creates an initial app and creates a local Git repository as well. Git is not part of the tutorial, but you should always keep your code in check with a source code management system, so have a look at it when you can.

To create the initial skeleton, type

crystal init app bbs

This will create the skeleton inside the bbs subfolder of the current directory. Jump into it and have a look around at the files created.

One thing the app creator leaves out is an easy way to compile the project - we can just type crystal build src/bbs.cr –release -o bbs_release every time we want to compile, but that would get old really quick. So instead we'll create a Makefile and use good old make to perform all these repetitive tasks on the project. Here's how it could look:

.PHONY: clean
 
run: bbs
	./bbs_release
clean:
	rm -f bbs_release
 
all: clean
	crystal build src/bbs.cr --release -o bbs_release
 
bbs:
	rm -f bbs_release
	crystal build src/bbs.cr --release -o bbs_release
tutorials/crystal_bbs/part_one.1489961592.txt.gz · Last modified: 2018/03/29 01:58 (external edit)