| 1 |
= Vintage - The super slim, microwebframework of doom! |
|---|
| 2 |
|
|---|
| 3 |
Vintage is a very small web framework based on the original idea of Merb: Mongrel serving up |
|---|
| 4 |
ERb (Embedded Ruby) templates. The idea has been expanded and now Vintage helps you serve up |
|---|
| 5 |
ERb, HAML, Textile, Markdown, and Markaby templates. |
|---|
| 6 |
|
|---|
| 7 |
== Basic Usage |
|---|
| 8 |
|
|---|
| 9 |
To use Vintage, you have two options. You can use it in standard mode or application mode. In |
|---|
| 10 |
standard mode, there is no configuration and Vintage will serve up templates and static files |
|---|
| 11 |
from the current folder. To get this mode, then simply type <tt>vintage start</tt> in any folder. |
|---|
| 12 |
|
|---|
| 13 |
$ vintage start |
|---|
| 14 |
- vintage version 0.0.1 |
|---|
| 15 |
starting server on port 5000 |
|---|
| 16 |
|
|---|
| 17 |
Now navigating to a URL will look in the current folder for the file or template. For example, going |
|---|
| 18 |
to <tt>http://localhost:5000/my_template</tt> will look for <tt>my_template.erb</tt> (or whatever template |
|---|
| 19 |
engine you are using) in the current folder and render it if available. If a static file is requested, then |
|---|
| 20 |
it is served up. If you request <tt>http://localhost:5000/my_folder/my_template</tt>, then the application |
|---|
| 21 |
will look in <tt>my_folder</tt> for the <tt>my_template</tt> template. |
|---|
| 22 |
|
|---|
| 23 |
=== Vintage as an application server |
|---|
| 24 |
|
|---|
| 25 |
Vintage can also be configured to be used as an application server. To do so, you can either generate an |
|---|
| 26 |
application or hand create a <tt>configuration.yml</tt> file (see one from a generated project for an example). |
|---|
| 27 |
To generate an application, simple run +vintage+ with a project name as the argument. |
|---|
| 28 |
|
|---|
| 29 |
vintage my_project |
|---|
| 30 |
|
|---|
| 31 |
This command will generate a number of files. Chief among these is <tt>configuration.yml</tt> which tells |
|---|
| 32 |
Vintage how you'd like to run it. Other files include a sample template and the proper folder structure |
|---|
| 33 |
for the generated configuration to work properly. This setup allows you to more easily segment your code |
|---|
| 34 |
for easier maintenance. |
|---|
| 35 |
|
|---|
| 36 |
== Helpers |
|---|
| 37 |
|
|---|
| 38 |
Vintage comes with a few helpers that live in Vintage::Helpers. You can add your own helpers by creating a |
|---|
| 39 |
<tt>helpers</tt> folder and stashing modules in there. As of right now, helpers must live in the Vintage::Helpers |
|---|
| 40 |
module, but this will hopefully be changing very soon. |
|---|