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

Discussion in 'Ruby' started by George Moschovitis, Jul 25, 2005.

  1. 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

    --
    http://www.nitrohq.com
     
    George Moschovitis, Jul 25, 2005
    #1
    1. Advertising

  2. George  Moschovitis

    EdUarDo Guest

    Re: [ANN] Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamicinjection, new builder

    > new versions of Nitro and Og were just released.

    Does Og support Sybase?
     
    EdUarDo, Jul 25, 2005
    #2
    1. Advertising

  3. Re: Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamic injection, new builder

    > 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.
     
    George Moschovitis, Jul 25, 2005
    #3
  4. Re: [ANN] Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamicinjection, new builder

    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)
     
    gabriele renzi, Jul 25, 2005
    #4
  5. Re: [ANN] Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamicinjection, new builder

    gabriele renzi wrote:
    > 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


    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
     
    Michael Neumann, Jul 25, 2005
    #5
  6. Re: [ANN] Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamicinjection, new builder

    George Moschovitis wrote:
    > 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
     
    Michael Neumann, Jul 25, 2005
    #6
  7. Re: Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamic injection, new builder

    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.
     
    George Moschovitis, Jul 25, 2005
    #7
  8. Re: Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamic injection, new builder

    > t= t | Elements | Localization | Markup

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

    -g.
     
    George Moschovitis, Jul 25, 2005
    #8
  9. 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!
     
    Brian McCallister, Jul 25, 2005
    #9
  10. George  Moschovitis

    EdUarDo Guest

    Re: Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamic injection,new builder

    >>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?
     
    EdUarDo, Jul 26, 2005
    #10
  11. Re: Nitro + Og 0.21.0 Compiler, Og custom joins, Og dynamic injection, new builder

    On Wed, Jul 27, 2005 at 12:14:05AM +0900, Christian Neukirchen wrote:
    > "George Moschovitis" <> writes:
    >=20
    > >> t=3D t | Elements | Localization | Markup

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

    >=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 <> - http://www.foton.es
    EuropeSwPatentFree - http://EuropeSwPatentFree.hispalinux.es
     
    Esteban Manchado Velázquez, Jul 26, 2005
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SKG

    faster joins

    SKG, Jun 24, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    396
    Kevin Spencer
    Jun 25, 2004
  2. Phlip
    Replies:
    5
    Views:
    569
    Stefan Behnel
    Jan 13, 2010
  3. George Moschovitis
    Replies:
    4
    Views:
    127
  4. George Moschovitis
    Replies:
    4
    Views:
    123
    James Britt
    Nov 17, 2005
  5. gabriele renzi

    [Nitro] [ANN] Nitro/Og 0.31.0

    gabriele renzi, Jul 24, 2006, in forum: Ruby
    Replies:
    22
    Views:
    382
    George Moschovitis
    Aug 1, 2006
Loading...

Share This Page