stpete_crystal

Version, currently master branch1 version
  • master branchlatestJan 22, 2017

github.com/jasonl99/stpete_crystal

No description declared in shard.yml.

2 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  stpete_crystal:
    github: jasonl99/stpete_crystal
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.20.3
License
MIT
Author
Jason Landry
Target
  • stpete_crystal from src/stpete_crystal.cr

Dependencies

Runtime Dependencies

  • kemal*github: kemalcr/kemal, branch: master
  • slang*github: jeromegn/slang, branch: master
  • kemal-session*github: kemalcr/kemal-session, branch: master

README

stpete_crystal

These are the notes and walk-through for the crystal talk I'm giving (or have already given and I'm too lazy to update this repo). The goal is to walk through the installation of crystal, init a new app, and write an interactive app for the local network. This document describes what you need to do if you want to build the application on your own. The code for the app is also here.

Installation

Crystal

What is Crystal anyway?

Well, crystal-lang.org describes it this way:

  • Have a syntax similar to Ruby (but compatibility with it is not a goal)
  • Statically type-checked but without having to specify the type of variables or method arguments.
  • Be able to call C code by writing bindings to it in Crystal.
  • Have compile-time evaluation and generation of code, to avoid boilerplate code.
  • Compile to efficient native code.

It has the best of both worlds -- the native speed of C with the joy of programming that ruby provides.

Installation

Installing crystal is easy enough, unless you're running Windows. Sorry, no crystal for Windows. You can confirm that it's installed correctly by running crystal -v in a terminal. Right now, I'm running Crystal 0.20.4 [d1f8c42] (2017-01-06).

I use Ubunutu (and this applies to all Debian-based distributions), so I simply add the crystal repository to my system:

curl https://dist.crystal-lang.org/apt/setup.sh | sudo bash
sudo apt-get update
sudo apt-get install crystal

Installation is that simple.

The stpete_crystal app

Initialize the app

My personal preference is to have a ~/crystal folder where all my projects live, so that's where it will exist throughout this demo.

cd ~
mkdir crystal
cd crystal
crystal init app stpete_crystal

The app gets initialized by creating directories for code, libraries, and specs. It also creates an new git repository, convienently adding a .gitignore for files you shouldn't have under version control.

Demo Stages

The demo is organized into different sections as listed below, and each is described in the linked markdown file. There's a git branch in each section, too. So you can see the code as it exists for that section by doing git checkout hello_word.

At this point, the basics are in. We'll fast-forward ahead and show the resulting chat app, and walk through the changes that took us from a live-updating counter to a live updating chat page.

Contributors