Blog
Webby - Part 2
Essential Features
2008-04-13In my first post ( Webby - Part 1 ) I gave a basic description of Webby, a ultra-lightweight content management tool. In this post, I intend to cover the most essential features of Webby, starting with the creation of a new project and an overview of the rake tasks. From there I'll cover some of the helper methods that come with Webby.
What is Webby Doing?
Webby is useful because it allows the use of Ruby code as well as helpers, layouts, partials, filters (more on that later), and templates. From this Webby will create the file structure and html (or xml, atom, rss, etc.). This, seems to be done, in a very basic sense, by "running" the Ruby through one time and saving the files created. This is similar to what a page cache would do but, it is done manually due to the infrequency of an update.
Install Webby
First, in order to use Webby you have to install it. Thankfully, there is a
gem, making this step very simple. Open the Terminal application (or what
you would normally use to install a gem) and install Webby (with any
dependencies).
sudo gem install webby
Optional Installs
Personally, I like using Haml, so I installed that already. Webby is able to use a series of "filters" to make use of Haml, Sass, Textile, Markdown, and by default, erb. On top of the filters available to transform text, Webby has support for CodeRay and UltraViolet syntax highlighting.
Create a Project
Onto creating a project. Webby comes with a command, webby. We use this and
the name of our project in one command and Webby will create the structure
for the project, in the current location in the filesystem. To view the
full list of options for the webby command, add the -h/--help flag (Hint:
there aren't many).
webby your_project_name_here
Rake Tasks
Many Ruby developers are experienced using Rake. Change to the project
directory in Terminal and try this.
rake -T
The most frequently used tasks (for me, at least) are:
rake create:whatever
The create task is provided a type of document to create (from a template).
By default these include a page, a partial, or an atom feed. I will discuss
adding to these templates in my next post.
The autobuild tasks starts the included heel webserver and builds the files
whenever it detects a "dirty" or changed file. This is very handy in
development because you can instantly check your changes in a browser.
Finally, the deploy task. Using either rsync or ssh, Webby will deploy the
output files to your designated webserver.
rake autobuild
rake deploy:however
Until next time you should read the official tutorial from Webby.
Next time I'll talk about extending these essential features, making Webby an extremely powerful tool.