crystal
command to only run our code.crystal
command is pretty useful and does lot more than that. (check crystal --help
for more)crystal
helped us create a new project. Let’s see what it did for us.shard.yml
for dependency management.src
and spec
folders to put our code and tests(ssh..we’ll talk about it soon) in it.shards
. shards
is like bundler
and shard.yml
is like Gemfile
.shard.yml
.shard.yml
and it contains the minimal necessary information about our project. Those arename
specifies the name of the projectversion
specifies the version of the project. Crystal itself uses semver for version management so it’s a good convention for you to follow.authors
section specifies the authors of the project. By default this is taken from your global git
configuration.crystal
specifies the version of Crystal that the project is using.license
specifies the type of your project license. By default this is MIT
.shard.yml
? Well we can use this file to add external libraries(we call it dependency) and manage them without even worrying about any folders / paths e.g.. Sweet isn’t it?shards
let’s add Kemal to our shard.yml
and build a simple web application :)shard.yml
. First we need to add Kemal
as a dependency to our project. We do this by includingKemal
to our project. First, we need to install it.Kemal
in our project. Open up src/sample.cr
require
to access Kemal
in our program.localhost:3000
and see it in action!shard
s :)