• Stars
    star
    51
  • Rank 568,706 (Top 12 %)
  • Language
    Crystal
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Kemal application generator

fez Build Status

Fez is an application generator for projects with Kemal.

Setting up a Kemal app is super simple, but if the app you're building is a little more than "super simple", there's a bit of things you'll end up doing each time you start a project. Why not have a mini generator that will do it for you?

This generator will generate a somewhat opinionated version of:

  • Simple app with assets and views (customizable between ECR and Slang) setup
  • Simple API with api versioning
  • Simple app backed by a database (not implemented)

Installation

Since this is an application generator, there's no need to include it as a dependency, or shard. Just install it locally, and build the executable.

$ git clone [email protected]:jwoertink/fez.git
$ cd fez/
$ make

You should now have a bin/fez file to run. You can symlink this to a more global location like /usr/local/bin to make it easier to use.

Optionally, you can use homebrew to install.

brew tap jwoertink/fez
brew install fez

NOTE If you have issues running from homebrew, install from github, and report the error to homebrew-fez

Usage

Using fez is pretty easy. To see a help menu just run fez -h. You can see the version of fez you're running with fez -v

TL;DR fez yourappname

Naming your app

To set the name of your application, you run fez with the name of the project. This is required in order to run.

This example will generate a ./my_cool_app/ folder.

$ fez my_cool_app

Specifying the directory name

Fez gives you the option to create a different name for the directory your app is in than the actual app name. You can do this with the --directory or -d flag. This flag is optional.

This example will generate an app called my_cool_app in a myapp.cr folder.

$ fez my_cool_app -d ~/Projects/myapp.cr

or

$ fez my_cool_app --directory=~/Projects/myapp.cr

If you don't specify a directory, fez will assume you want to use the current directory you're in.

Templates

Fez comes out of the box with several different templates:

  • Kemal with slang
  • Kemal with ECR
  • Kemal as an API
  • more coming later...

By default, fez uses Kemal with Slang as the default template. If you would like to switch back to using Crystal's built in ECR, or build an api, you will use the --template or -t flag. This flag is optional.

$ fez my_cool_app -t ecr

or

$ fez my_cool_app --template=ecr

Generating an API only application

If you're building an API, and don't need HTML, CSS and JavaScript, you can use Fez to generate an API only app.

$ fez my_api -t api

By default a JSON API will be generated with route versioning. You can read up on kave for more info about api customization.

Working with a fez generated app

Now that you've generated your shiny new Kemal app, it's time to start doing development on it. The generated app will contain a README.md file that has all the instructions on how to start development.

Your app will have 2 primary dependencies to run.

If you have those two installed, then your next step is to cd in to your new app's directory and run make install.

$ cd ~/Projects
Projects $ fez supertrain
Projects $ cd supertrain
Projects/supertrain $ make install

Running make install will install the shard dependencies for your app (like Kemal, duh!), and then install the ruby gem dependencies. You may be asking yourself why have ruby gem dependencies?... Ruby has tools that work great like guard and sass. Plus, chances are, you came to Crystal from Ruby anyway, and if you're on a Mac, Ruby is installed by default.

Ok, now that your app dependencies are installed, you have 2 options to boot this baby.

  1. make run - This compiles your assets in to their natural form, and then boots kemal.
  2. guard - This will boot your kemal and then watch for any changes to the files.

Both of these options will boot a server on localhost:3001. The difference is that using guard allows you to do live-reloading.

If you need to use a console (REPL) for development, you can use the make console command. You will have access to whatever has been required in your app's config.cr

Projects/supertrain $ make console
 => ok
icr(0.19.1) > Kemal
 => Kemal
icr(0.19.1) >

Now that you have a handle on developing your app, you will want to deploy it! There's a lot of different methods to deploying an app in to production, and fez takes the Capistrano appraoch.

  1. Edit your config/deploy.rb file with the necessary changes.
  2. Edit your config/deploy/production.rb file with more necessary changes
  3. Run cap production deploy.
  4. Pray it all works!

Alternitively, if you're looking to deploy to Heroku, you can use Crystal Heroku Build Pack to deploy.

Development

If you'd like to help contribute, check out the Projects tab, or issues.

Contributing

  1. Fork it ( https://github.com/jwoertink/fez/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

More Repositories

1

kave

Kemal API Version Extension
Crystal
31
star
2

sitemapper

Sitemap generator for Crystal apps
Crystal
24
star
3

medley

A crystal shard for doing music related stuff
Crystal
17
star
4

crono

2D Video Game framework
Crystal
17
star
5

crystal_orm_test

Benchmark different ORMs for crystal and postgres
Crystal
16
star
6

dopewars

Ruby port of the Dopewars / Drugwars game
Ruby
15
star
7

lucky-cluster

Boot multiple lucky processes
Crystal
13
star
8

psst

Send encrypted string between ruby and crystal
Ruby
11
star
9

webrtc-demo

How to get started with WebRTC
JavaScript
9
star
10

Waves

JRuby + jMonkeyEngine 3D fun
Ruby
9
star
11

pcotm

Phone Case of the Monster
Ruby
5
star
12

bootcamp

Defunct project
Ruby
5
star
13

guard-kemal

A Kemal guard watcher plugin
Ruby
5
star
14

maze_craze

jMonkeyEngine & JRuby dynamic maze game
Ruby
5
star
15

node-chat-demo

Learning NodeJS through the node-chat application
JavaScript
4
star
16

ruby-in-water

Example app with a mock sinatra and really fast connection
Ruby
3
star
17

Pathbox

Path(http://www.path.com/) style box from iPhone app
JavaScript
3
star
18

transfer-util

This is a yahoo store web scraper, and RTML transfer util
Ruby
3
star
19

jko_api

api versioning gem for rails
Ruby
3
star
20

vite_lucky

Crystal
3
star
21

nacha

A Crystal shard for parsing and generating Nacha (ACH) files
Crystal
2
star
22

JustTheTip

jQuery Tool Tip Plug-in
JavaScript
2
star
23

omgwtfmmo

game tutorial
JavaScript
2
star
24

tourets

A Rails gem for using RETS
Ruby
2
star
25

gosu-example

Simple Gosu Example
Ruby
2
star
26

JustSlide

jQuery content slider
JavaScript
2
star
27

jmonkeyengine-ruby

A ruby gem for easily including JME3 into your project
Ruby
2
star
28

rw_depot_store

Depot Store for RubyWeekend
Ruby
2
star
29

ruby-encryptor

a fun little encryption app built in ruby
Ruby
1
star
30

blackjack_example

Ruby
1
star
31

rw_depot_theme

Default theme for the RubyWeekend Depot App
Ruby
1
star
32

jqxmaslights

jQuery Christmas lights for a container element
JavaScript
1
star
33

crono-samples

Sample games written using Crono
Crystal
1
star
34

woert.ink

My personal site
Crystal
1
star
35

rspec-interactions-test

Trying to test this bug.
Ruby
1
star
36

kemal-session-client-engine

Kemal session for client side storage
Crystal
1
star
37

JustCopy

jQuery clipboard copy
JavaScript
1
star
38

pirates-ios

A Pirate game based on the Udemy Course Challenge
Objective-C
1
star
39

shellac

HTTP Cache server
Elixir
1
star
40

recursinator

Traverse a directory to do stuff in Ruby or Crystal
Crystal
1
star
41

tictacnode

tic tac toe game written in nodeJS
JavaScript
1
star
42

rails-upgrade-tracker

make upgrading rails a little easier
Ruby
1
star
43

rr10-team-208

Repository for the RailsRumble 2010 Team 208
Ruby
1
star
44

enom-ruby

Ruby wrapper for the Enom reseller API
Ruby
1
star
45

godaddy-api.cr

Simple Godaddy API for crystal
Crystal
1
star
46

json_fields

A Rails add-on to create a simple UI for json fields
Ruby
1
star
47

lucky-basic-auth

HTTP Basic auth shard for Lucky
Crystal
1
star
48

memory-js

JavaScript
1
star
49

bsky

A BlueSky social API for Crystal
Crystal
1
star
50

blocked-numbers

A list of phone number from robo calls to block
Ruby
1
star