generys icon indicating copy to clipboard operation
generys copied to clipboard

Wanna-be web framework for Io

h1. Generys, wanna-be web framework for "Io":http://iolanguage.com

h2. What's the point?

Mostly it was a personal goal to learn a bit more about the amazing little language called Io. Another goal was to create a simple web framework which could reliably serve lots of data -- no Views or templates, since all of that can be done within browser, why should I waste my money on expensive servers?

h2. Install

Use "Eerie":http://github.com/josip/Eerie to install Generys.

h2. How to use

Explore. :)

Place all your controllers into app/controllers/ and make sure you assign to a variable whose name ends with "Controller", like CarsController := Controller clone do(...).

Basic documentation is also available, just remember to $ make doc.

h2. Model?

The "framework" is DB-agnostic, yet it contains a small "CouchDB":http://couchdb.apache.org/ library, which is far from complete. IORM seems like a good choice.

h2. View

Even tough there is no baked-in support for templating, Generys has a trick in her sleeve! SelectorDecomposer provides jQuery-like mechanism for querying and modifying instances of SGMLElement. Take a look at samples/Chat/app/Controllers/ExceptionController.io on how to use it.

h2. How to run

You can cd to directory where your application is placed and run io. You can also, run generys -r=/path/to/project, assuming you've installed generys "binary".

h2. Io additions

To work more easily with Io, Generys has few tricks: First of all, you can use JSON syntax for Maps! Yes, this is a valid Io code:

{colour: "Red", favourite: false, numbers:[1, 2, 3]}

To access an item from Map or List you can use square brackets:


anMap["colour"] == anMap at("colour")
anMap["colour", "favourite"] == anMap select(key, value, key == "colour" or key == "favourite")
anList[ 0] == anList at(0)
anList[1,-1] == anList exSlice(1, -1)
"string"[0] == 115
"string"[0, 1] == "string" exSlice(0, 1)

h2. Coding style

Just to make it more fun, all closing brackets are in the same line:


lispy := method(
  self isThisLispInspired ifTrue(
    "Yes, it is!" println))

With one notable exception:


Object clone do(
  methodsAndStuff := true
)

"Class" variables are addressed with self before, just to differentiate them from "instance" variables.


Car := Object clone do(
  a := 4
  b := 5

  switchPlaces := method(
    c := self a
    self a = self b
    self b = c
    self)
)