== Welcome to Lazibi
Lazibi is a preprocessor that allows you to use Python style indentation in Ruby.
The idea is to edit .py.rb files in a meta directory and let the engine generates .rb files in
the real directory for you in real time.
== Examples
Sweeter RSpec [ Thanks Jay ]
describe Bowling
before(:each)
@bowling = Bowling.new
it "should score 0 for gutter game"
20.times { @bowling.hit(0) }
@bowling.score.should == 0
More DIY Rails controller
class AuctionsController < ApplicationController
def index
@auctions = Auction.paginate :page => params[:page]
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @auctions.to_xml }
Even sexier migrations ( with sexy_migration Rails plugin )
class CreateOrders < ActiveRecord::Migration
def self.up
create_table :orders do
fkey :user
fkey :auction
integer :bid_type
timestamps!
def self.down
drop_table :orders
== Download
gem install lazibi
svn checkout svn://rubyforge.org/var/svn/lazibi/trunk lazibi
== Usage
Bootstrap
mkdir shiny_project
cd shiny_project
# put trunk in real
svn co $svn_path/shiny_project/trunk real
lazibi
Make sure everything still works
_start_a_new_terminal_
cd shiny_project/real
rake test / autotest
Start hacking in meta :/
cd shiny_project
$your_editor meta
== Tips
=== Manually create meta files
* Bootstrap your project as usual, just don't run lazibi
* setup environment
mkdir .backup
mkdir meta
* run lazibi
* create .py.rb files in corresponding directories inside 'meta', .rb files will be created and updated in 'real' as usual
=== Prevent certain directories from being parsed during bootstrap ( default is ^vendor )
* Create .lazibi in project/real path
exclude:
- ^vendor
- ^tmp
- etc
=== RSpec taste
* Optional do is only enabled for spec directory. You can customize this behavior by editing .lazibi config file.
filters:
optional_do:
- ^spec
- ^test
- etc
* Personally I would not recommend using this filter outside the context of RSpec
* It's not well tested
* Anything more complex then simple description will get unreadable
== In Practice
Lazibi is written using Lazibi itself ( incrementally ). Personally I think autotest from http://www.zenspider.com/ZSS/Products/ZenTest/ is a must have, and Lazibi works pretty well using TDD.
== Known issues
Here docs, eval, javascript related libs, and complex string evaluation are currently not supported.
Ruby code with above syntax will be preserved as is. So your code should still works, just no parse. In other words, if you don't want your code to be parsed, simply add a dummy here doc string...
== Talk
http://groups.google.com/group/lazibi-talk
== To Do
* Maybe a custom filter for RSpec runner? Still learning though...
* Two way sync between real and meta
== Author
* Jinjing (mailto:[email protected])
Released under the MIT license (included)
Lazibi is a preprocessor that allows you to use Python style indentation in Ruby.
The idea is to edit .py.rb files in a meta directory and let the engine generates .rb files in
the real directory for you in real time.
== Examples
Sweeter RSpec [ Thanks Jay ]
describe Bowling
before(:each)
@bowling = Bowling.new
it "should score 0 for gutter game"
20.times { @bowling.hit(0) }
@bowling.score.should == 0
More DIY Rails controller
class AuctionsController < ApplicationController
def index
@auctions = Auction.paginate :page => params[:page]
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @auctions.to_xml }
Even sexier migrations ( with sexy_migration Rails plugin )
class CreateOrders < ActiveRecord::Migration
def self.up
create_table :orders do
fkey :user
fkey :auction
integer :bid_type
timestamps!
def self.down
drop_table :orders
== Download
gem install lazibi
svn checkout svn://rubyforge.org/var/svn/lazibi/trunk lazibi
== Usage
Bootstrap
mkdir shiny_project
cd shiny_project
# put trunk in real
svn co $svn_path/shiny_project/trunk real
lazibi
Make sure everything still works
_start_a_new_terminal_
cd shiny_project/real
rake test / autotest
Start hacking in meta :/
cd shiny_project
$your_editor meta
== Tips
=== Manually create meta files
* Bootstrap your project as usual, just don't run lazibi
* setup environment
mkdir .backup
mkdir meta
* run lazibi
* create .py.rb files in corresponding directories inside 'meta', .rb files will be created and updated in 'real' as usual
=== Prevent certain directories from being parsed during bootstrap ( default is ^vendor )
* Create .lazibi in project/real path
exclude:
- ^vendor
- ^tmp
- etc
=== RSpec taste
* Optional do is only enabled for spec directory. You can customize this behavior by editing .lazibi config file.
filters:
optional_do:
- ^spec
- ^test
- etc
* Personally I would not recommend using this filter outside the context of RSpec
* It's not well tested
* Anything more complex then simple description will get unreadable
== In Practice
Lazibi is written using Lazibi itself ( incrementally ). Personally I think autotest from http://www.zenspider.com/ZSS/Products/ZenTest/ is a must have, and Lazibi works pretty well using TDD.
== Known issues
Here docs, eval, javascript related libs, and complex string evaluation are currently not supported.
Ruby code with above syntax will be preserved as is. So your code should still works, just no parse. In other words, if you don't want your code to be parsed, simply add a dummy here doc string...
== Talk
http://groups.google.com/group/lazibi-talk
== To Do
* Maybe a custom filter for RSpec runner? Still learning though...
* Two way sync between real and meta
== Author
* Jinjing (mailto:[email protected])
Released under the MIT license (included)