[ANN] Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamic injection, new builder

G

George Moschovitis

Hello everyone,

new versions of Nitro and Og were just released.

Homepage + Downloads: http://www.nitrohq.com
Mailing list: http://rubyforge.org/mailman/listinfo/nitro-general

Nitro goes from strength to strength as the community gets bigger.
Great new features were introduced and a lot of effort
was spend on cleaning up Nitro's implementation and polishing
'little things'. Many patches were contributed by the community
to make this is a release you will love!

Some notable changes:

* New compiler pipeline replaces the obscure shader mechanism. A
compiler object is responsible for transforming a controller action
and or the associated xhtml templates to a special ruby method
that will respond to given urls with the action output. Using
the aspect oriented features of Nitro or the specialized pipeline
setup method a developer can easily customize the compilation
stage to meet his needs. Here are some examples:

Compiler.setup_template_transformation do |template|
template = Elements.transform(template)
template = Localization.transform(template)
template = Markup.transform(template)
template = Template.transform(template)
end

or

Compiler.before "puts 'Compiling'", :eek:n => :compile
Compiler.after "puts 'Template processed'", :eek:n =>
:transform_template
Compiler.wrap Benchmark, :eek:n => compile
Compiler.before :my_method, :eek:n => compile

Special rendering effects where never easier. If you need run
time effects, just intercept the Render object.

* Integrated the new configuration system that was previewed in
the last release. All the configuration settings are now accessible
either through the owner class or from the global Configuration
variable using Ruby's metaprogramming features.

Moreover, Nitro now dynamically decides the configuration mode
(debug, stage, live/production) from environment variables or
command line arguments so depolying your application is easier
than ever: just run svn update on the live server, the application
will grab the correct configuration parameters automatically.
Of course you can use svn's advanced features to rollback to
earlier versions if you experience problems. The mode specific
configuration settings are defined either on ruby files or
yaml files or both.

Point your browser to http:://my.app.com/settings to browse
the settings for your application.

* Og dynamic queries. You can inject caclulated or join attributes
to your objects. Here is an example:

class Item
property :quantity, Fixnum
property :unit_price, Float

def initialize(quantity, unit_price)
@quantity = quantity
@unit_price = unit_price
end
end

Item.create 2, 3.0
item = Item.find_one :select => 'quantity*unit_price as total_price'
item.total_price # => 6.0

Please note that total_price is a dynamically injected
attribute. Now you can combine SQL's powerful query features
with the simplicity and elegance of Og.

* Og customized join tables allows you to use any Ruby object
as the join relation between other objects. Here comes an
example:

class Category
property :title, String
end

class Article
property :title, String
end

class ArticleToCategory
property :rate, Float
has_one Article
has_one Category
end

c1 = Category.create
c2 = Category.create

a = Article.create
a.categories.add(c1, :rate => 2.3)
a.categories.add(c2, :rate => 1.2)

for c in a.categories
p a.category_join_data(c).rate
end

* Og collections size() is now optimized.

* Og join code support refactoring. The new code is easier to read,
more customizable and generates more efficient code by default.

* Nitro automatically assings reasonable template_roots on
Controllers based on mount points. Moreover, the template_root
overloading feature was improved. If you cant to reuse an
existing controller but customize the view rendering by using
different templates for some actions, just assign a different
template root for this controller, and put the custom templates
inside that dir. The custom templates 'override' the templates
of the parent controller (templates for non customized actions
come from the parent's controller template_root). Creating
a library of reusable controllers (parts) was never easier.

* Major cleanup of the nitro source code, removed many files.

* Greatly improved Wee integration makes Nitro the premium
container for Wee components. Have a look at the updated
wee example.

* Improved builder mechanism for programmatic rendering. The new
builder resuses the controller helper mixins thanks to extensive
refactoring of the implementation. Here is an example:

class MyController
def index
build do
labels = ['George', 'Stella', 'Renos']
html {
head {
title 'A simple test'
}
body {
10.times {
strong 'Hello World'
i 'Hello World222'
}
select:)id => 'names') {
options :labels => labels, :selected => 1
}
}
}
end
end

* Improved helper integration. Helpers are now accessed either
as mixins or through the builder mechanism.

#{form entity}
#{options :labels => [..], :values => [..], :selected => 1}

or

#{emit :form entity}
#{emit :eek:ptions :labels => [..] ...}

* Reimplemented the markup mixin to make this more flexible. You
can easily customize the markup logic that is applied by the
markup macros.

* Updated the documentation.

* Fixed all reported or discovered bugs, many smaller
improvements.


Nitro provides everything you need to develop professional Web
applications using Ruby and Javascript.

Nitro redefines Rapid Application Development by providing a
clean, yet efficient API, a layer of domain specific languages
implemented on top of Ruby and the most powerful and elegant
object relational mapping solution available everywhere.

Nitro is Web 2.0 ready, featuring excellent support for AJAX,
XML, Syndication and Email interraction while staying standards
compliant.

Nitro gives choice to the developer: Multiple paradigms are
implemented, incorporating ideas from Rails, CherryPy, Catalyst,
Wee, PHP, JSP and Microsoft.NET and more. The developer is free
to choose the pattern that better fits his application. This
kind of freedom makes Nitro applicable to a wide range of
applications, spanning from big, scalable web sites with thousands
of concurrent users to simple solutions for deployment on intranet
desktops.

Enjoy this release!
George Moschovitis
 
G

George Moschovitis

Does Og support Sybase?

Not yet, but it is quite easy to add a new Store implementation. If you
care enough to contribute the code I would be more than willing to help
you.

regards,
George.
 
G

gabriele renzi

George Moschovitis ha scritto:
Here are some examples:

Compiler.setup_template_transformation do |template|
template = Elements.transform(template)
template = Localization.transform(template)
template = Markup.transform(template)
template = Template.transform(template)
end

wow this is cool :)
Have you considered overloading >> to get a nicer interface?
i.e. something like
Compiler.setup_template_transformation do |t|
t= t >> Elements >> Localization >> Markup
end

(IIRC I saw this in the ruby-gstreamer api which features a similar
pipeline system)
 
M

Michael Neumann

gabriele said:
George Moschovitis ha scritto:



wow this is cool :)
Have you considered overloading >> to get a nicer interface?
i.e. something like
Compiler.setup_template_transformation do |t|
t= t >> Elements >> Localization >> Markup
end

I submitted a patch that allows to do:

t.transform(Elements).transform(Localization).transform(Markup)

Now, if you alias #transform to #>> this should work!

Regards,

Michael
 
M

Michael Neumann

George said:
Hello everyone,

new versions of Nitro and Og were just released.

Homepage + Downloads: http://www.nitrohq.com
Mailing list: http://rubyforge.org/mailman/listinfo/nitro-general

Nitro goes from strength to strength as the community gets bigger.
Great new features were introduced and a lot of effort
was spend on cleaning up Nitro's implementation and polishing
'little things'. Many patches were contributed by the community
to make this is a release you will love!

Great release George. Thanks!
Some notable changes:
[...]
* Greatly improved Wee integration makes Nitro the premium
container for Wee components. Have a look at the updated
wee example.

Please use Wee 0.10.0 for this.

Regards,

Michael
 
G

George Moschovitis

Nice idea,

Michael Neumann submitted various patches for the compiler pipeline.
Will be integrated in time for the next version :)

If you have more ideas, just let me know...

-g.
 
G

George Moschovitis

t= t | Elements | Localization | Markup

this is a bit unreadable though :) Ie, it looks a lot like OR's.

-g.
 
B

Brian McCallister

On Jul 25, 2005, at 4:37 PM, Christian Neukirchen wrote:\
Or maybe even the Unixish:

t= t | Elements | Localization | Markup

The bitshift conflict is less than ideal, but tsam I like that pipe!
 
E

EdUarDo

Does Og support Sybase?
Not yet, but it is quite easy to add a new Store implementation. If you
care enough to contribute the code I would be more than willing to help
you.

What would I need?
 
E

Esteban Manchado Velázquez

=20
No, it looks like pipes. :)
=20
ls | grep | tail | rs

I agree with George. If I'm programming in Ruby, when I see vertical b=
ars I
don't think about pipes, I think about ORs. If I'm in bash, that's anothe=
r
matter entirely, of course :)

And I guess people coming from Windows won't get it at all.

Perhaps an alias won't hurt...

--=20
Esteban Manchado Vel=E1zquez <[email protected]> - http://www.foton.es
EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top