[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Wee 0.5.0

Michael Neumann

1/27/2005 2:34:00 AM

Hi,

Wee 0.5.0 is out. Have fun!

Major changes are:

* Support for live-updates (see examples/live-update.rb). Only
client-side is missing (javascript).

* Factored out all continuation-dependent code into wee/continuation.
By default Wee uses no continuations until you require
'wee/continuation'. This has the nice effect, that
non-continuation-based application now run a little bit faster and
uses less memory.

* Added an OgScaffolder class (see examples/og-test.rb). You can
create/update/delete Og domain-objects. This was just a test for
using Wee+Og. It's not a very advanced scaffolder. Nemo[1] can do
better.

* Added an experimental property system, which can make your
components more independent of external resources (e.g.
image-path).

* Changed the status from alpha to beta ;-)
I consider Wee now as pretty stable (run-time wise). Few code will
probably change.

For the full list of changes (since I started the ChangeLog) see [2].

== The Ultimate Hello World

require 'wee'

class HelloWorld < Wee::Component
def click
@clicks = (@clicks || 0) + 1
end

def render
r.h1.onclick_callback(:click).with("Hello World!")
r.text "#{ @clicks || 'No' } clicks"
end
end

# And start the WEBrick web-server
require 'wee/utils'
require 'wee/adaptors/webrick'

app = Wee::Utils.app_for {
c = HelloWorld.new
c.add_decoration(Wee::PageDecoration.new(title="Hello World"))
c
}
Wee::WEBrickAdaptor.register('/app' => app).start

Make sure you run this application with the -rubygems option. Then point
your browser to http://localhost:2000/app and click on the h1-header.
Every time you click on it, you should see that the number of clicks
increases. Have fun!

== Future Work

I am currently implementing Cookie-support and Page-less sessions (no
backtracking). It's already done and works well, but needs some further
refactoring. This let's you write dynamic web-sites whose URL looks like
"http://blah.net... all the time. If you want you can change the URL
after /app to whatever you want, but note that it's model is completely
different that e.g. Rails. Wee does not has multiple controllers, it has
exactly one root-component with as many sub-components and
sub-sub-components as you like.

A simple tutorial is also on my todo list ;-)

== Documentation

Look here [3].



Regards,

Michael


---------------------------------------------------------------------
[1] http://rubyforge.org/pro...
[2] http://www.ntecs.de/viewcv...Wee/trunk/ChangeLog...
[3]
http://www.ntecs.de/viewcv...*checkout*/Wee/trunk/doc/rdoc/index.html


18 Answers

Michael Neumann

1/27/2005 2:44:00 AM

0

Michael Neumann wrote:
> Hi,
>
> Wee 0.5.0 is out. Have fun!

Oops, I forgot to mention how to install it ;-)

gem install wee

And don't forget -rubygems or require 'rubygems' if you use Rubygems...

Regards,

Michael


Curt Sampson

1/27/2005 3:26:00 AM

0

Joao Pedrosa

1/27/2005 3:30:00 AM

0

Hi,

On Thu, 27 Jan 2005 12:26:10 +0900, Curt Sampson <cjs@cynic.net> wrote:
> On Thu, 27 Jan 2005, Michael Neumann wrote:
>
> > Oops, I forgot to mention how to install it ;-)
> > gem install wee
>
> How about a non-gem copy for those of us who use configuration
> management on our ruby code?

I second this. I particularly don't use gems. :-)

Cheers,
Joao


Michael Neumann

1/27/2005 3:33:00 AM

0

Joao Pedrosa wrote:
> Hi,
>
> On Thu, 27 Jan 2005 12:26:10 +0900, Curt Sampson <cjs@cynic.net> wrote:
>
>>On Thu, 27 Jan 2005, Michael Neumann wrote:
>>
>>
>>>Oops, I forgot to mention how to install it ;-)
>>> gem install wee
>>
>>How about a non-gem copy for those of us who use configuration
>>management on our ruby code?
>
>
> I second this. I particularly don't use gems. :-)

No problem, will do. Hm, now the question is, which install.rb program I
should use? Any hints? Can I expect rake (Ruby make) to be installed?

Regards,

Michael


Lloyd Zusman

1/27/2005 3:38:00 AM

0

Michael Neumann <mneumann@ntecs.de> writes:

> Michael Neumann wrote:
>> Hi,
>> Wee 0.5.0 is out. Have fun!

Thanks a lot for all your work on this great piece of software.


> Oops, I forgot to mention how to install it ;-)
>
> gem install wee

I just tried that, but I got the following error:

# gem --version
0.8.4
# gem install wee
Attempting local installation of 'wee'
Local gem file not found: wee*.gem
Attempting remote installation of 'wee'
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find wee (> 0) in the repository


What am I missing?

Thanks.


--
Lloyd Zusman
ljz@asfast.com
God bless you.



Joao Pedrosa

1/27/2005 3:40:00 AM

0

Hi,

On Thu, 27 Jan 2005 12:33:17 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
> Joao Pedrosa wrote:
> > Hi,
> >
> > On Thu, 27 Jan 2005 12:26:10 +0900, Curt Sampson <cjs@cynic.net> wrote:
> >
> >>On Thu, 27 Jan 2005, Michael Neumann wrote:
> >>
> >>
> >>>Oops, I forgot to mention how to install it ;-)
> >>> gem install wee
> >>
> >>How about a non-gem copy for those of us who use configuration
> >>management on our ruby code?
> >
> >
> > I second this. I particularly don't use gems. :-)
>
> No problem, will do. Hm, now the question is, which install.rb program I
> should use? Any hints? Can I expect rake (Ruby make) to be installed?

This one?
http://raa.ruby-lang.org/proj...

Thanks a lot.

Cheers,
Joao


Bill Atkins

1/27/2005 3:40:00 AM

0

What's the philosophy behind Wee? What are some of its features?

Bill

On Thu, 27 Jan 2005 11:34:19 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
> Hi,
>
> Wee 0.5.0 is out. Have fun!
>
> Major changes are:
>
> * Support for live-updates (see examples/live-update.rb). Only
> client-side is missing (javascript).
>
> * Factored out all continuation-dependent code into wee/continuation.
> By default Wee uses no continuations until you require
> 'wee/continuation'. This has the nice effect, that
> non-continuation-based application now run a little bit faster and
> uses less memory.
>
> * Added an OgScaffolder class (see examples/og-test.rb). You can
> create/update/delete Og domain-objects. This was just a test for
> using Wee+Og. It's not a very advanced scaffolder. Nemo[1] can do
> better.
>
> * Added an experimental property system, which can make your
> components more independent of external resources (e.g.
> image-path).
>
> * Changed the status from alpha to beta ;-)
> I consider Wee now as pretty stable (run-time wise). Few code will
> probably change.
>
> For the full list of changes (since I started the ChangeLog) see [2].
>
> == The Ultimate Hello World
>
> require 'wee'
>
> class HelloWorld < Wee::Component
> def click
> @clicks = (@clicks || 0) + 1
> end
>
> def render
> r.h1.onclick_callback(:click).with("Hello World!")
> r.text "#{ @clicks || 'No' } clicks"
> end
> end
>
> # And start the WEBrick web-server
> require 'wee/utils'
> require 'wee/adaptors/webrick'
>
> app = Wee::Utils.app_for {
> c = HelloWorld.new
> c.add_decoration(Wee::PageDecoration.new(title="Hello World"))
> c
> }
> Wee::WEBrickAdaptor.register('/app' => app).start
>
> Make sure you run this application with the -rubygems option. Then point
> your browser to http://localhost:2000/app and click on the h1-header.
> Every time you click on it, you should see that the number of clicks
> increases. Have fun!
>
> == Future Work
>
> I am currently implementing Cookie-support and Page-less sessions (no
> backtracking). It's already done and works well, but needs some further
> refactoring. This let's you write dynamic web-sites whose URL looks like
> "http://blah.net... all the time. If you want you can change the URL
> after /app to whatever you want, but note that it's model is completely
> different that e.g. Rails. Wee does not has multiple controllers, it has
> exactly one root-component with as many sub-components and
> sub-sub-components as you like.
>
> A simple tutorial is also on my todo list ;-)
>
> == Documentation
>
> Look here [3].
>
> Regards,
>
> Michael
>
> ---------------------------------------------------------------------
> [1] http://rubyforge.org/pro...
> [2] http://www.ntecs.de/viewcv...Wee/trunk/ChangeLog...
> [3]
> http://www.ntecs.de/viewcv...*checkout*/Wee/trunk/doc/rdoc/index.html
>
>


--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"


Michael Neumann

1/27/2005 3:49:00 AM

0

Joao Pedrosa wrote:
> Hi,
>
> On Thu, 27 Jan 2005 12:33:17 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
>
>>Joao Pedrosa wrote:
>>
>>>Hi,
>>>
>>>On Thu, 27 Jan 2005 12:26:10 +0900, Curt Sampson <cjs@cynic.net> wrote:
>>>
>>>
>>>>On Thu, 27 Jan 2005, Michael Neumann wrote:
>>>>
>>>>
>>>>
>>>>>Oops, I forgot to mention how to install it ;-)
>>>>>gem install wee
>>>>
>>>>How about a non-gem copy for those of us who use configuration
>>>>management on our ruby code?
>>>
>>>
>>>I second this. I particularly don't use gems. :-)
>>
>>No problem, will do. Hm, now the question is, which install.rb program I
>>should use? Any hints? Can I expect rake (Ruby make) to be installed?
>
>
> This one?
> http://raa.ruby-lang.org/proj...

I've rolled on my own install.rb.

Download the tar.gz from here:

http://rubyforge.org/frs/?gr...

Then do a "ruby install.rb".

Regards,

Michael


Michael Neumann

1/27/2005 4:13:00 AM

0

Bill Atkins wrote:
> What's the philosophy behind Wee? What are some of its features?

Wee's core is very small (but powerful). Including lots of documentation
the core is currently just 847 lines. That's where the name originally
comes from.

Features:

* You don't have to care about the HTTP protocol, you don't have to
build URL, add query parameters or name form-fields etc...

* You can write real components.

* Backtracking (Make the browsers back-button working fine)

* It comes with a powerful programmatic HTML renderer. Example:

# select an object from these items
items = [1, 2, 3, 4]

# the labels shown to the user
labels = items.map {|i| i.to_s}

# render it... callback is called with the choosen object from the
# items array
r.select_list(items).labels(labels).callback {|choosen| p choosen}

# render a multi-select list, with objects 2 and 4 selected
r.select_list(items).multi.labels(labels).selected([2,4])

Note that in the example above, you don't have to encode the items
as you would probably have to in Rails. The items could be any
object (Strings, Components... ANY object).

* You can call other components. This replaces the current component
until the called component returns. Note that this only affect the
current component and not it's possible parent components.

* You can add decorations to components, which is a very powerful
concept. Useful for rendering header/footer around a component, or
to prevent unauthorized access to a component etc...

* Pure Ruby. What I like is that you don't have to switch between
different files (controller and view). Both are dependent anyway.
This makes it easier to distribute components, as they are usually
only one file. That does not mean, that you can't use templates,
you can!

* Continuations! This is optional. Might lead to memory problems, but
the last memory stress-test was quite positive... needs further
testing.

* Nemo: rubyforge.org/projects/nemo

You can read more about it's features on that page:

http://www.ntecs.de/viewcv...*checkout*/Wee/trunk/doc/rdoc/index.html

Stay tuned! I'm currently working on setting up a page dedicated to Wee:
http:... (it's empty yet).

If you're interested in Wee, you might be also interested in Seaside2,
Wee's big brother: www.seaside.st.

Regards,

Michael

> Bill
>
> On Thu, 27 Jan 2005 11:34:19 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
>
>>Hi,
>>
>>Wee 0.5.0 is out. Have fun!
>>
>>Major changes are:
>>
>> * Support for live-updates (see examples/live-update.rb). Only
>> client-side is missing (javascript).
>>
>> * Factored out all continuation-dependent code into wee/continuation.
>> By default Wee uses no continuations until you require
>> 'wee/continuation'. This has the nice effect, that
>> non-continuation-based application now run a little bit faster and
>> uses less memory.
>>
>> * Added an OgScaffolder class (see examples/og-test.rb). You can
>> create/update/delete Og domain-objects. This was just a test for
>> using Wee+Og. It's not a very advanced scaffolder. Nemo[1] can do
>> better.
>>
>> * Added an experimental property system, which can make your
>> components more independent of external resources (e.g.
>> image-path).
>>
>> * Changed the status from alpha to beta ;-)
>> I consider Wee now as pretty stable (run-time wise). Few code will
>> probably change.
>>
>>For the full list of changes (since I started the ChangeLog) see [2].
>>
>>== The Ultimate Hello World
>>
>> require 'wee'
>>
>> class HelloWorld < Wee::Component
>> def click
>> @clicks = (@clicks || 0) + 1
>> end
>>
>> def render
>> r.h1.onclick_callback(:click).with("Hello World!")
>> r.text "#{ @clicks || 'No' } clicks"
>> end
>> end
>>
>> # And start the WEBrick web-server
>> require 'wee/utils'
>> require 'wee/adaptors/webrick'
>>
>> app = Wee::Utils.app_for {
>> c = HelloWorld.new
>> c.add_decoration(Wee::PageDecoration.new(title="Hello World"))
>> c
>> }
>> Wee::WEBrickAdaptor.register('/app' => app).start
>>
>>Make sure you run this application with the -rubygems option. Then point
>>your browser to http://localhost:2000/app and click on the h1-header.
>>Every time you click on it, you should see that the number of clicks
>>increases. Have fun!
>>
>>== Future Work
>>
>>I am currently implementing Cookie-support and Page-less sessions (no
>>backtracking). It's already done and works well, but needs some further
>>refactoring. This let's you write dynamic web-sites whose URL looks like
>>"http://blah.net... all the time. If you want you can change the URL
>>after /app to whatever you want, but note that it's model is completely
>>different that e.g. Rails. Wee does not has multiple controllers, it has
>>exactly one root-component with as many sub-components and
>>sub-sub-components as you like.
>>
>>A simple tutorial is also on my todo list ;-)
>>
>>== Documentation
>>
>>Look here [3].
>>
>>Regards,
>>
>> Michael
>>
>>---------------------------------------------------------------------
>>[1] http://rubyforge.org/pro...
>>[2] http://www.ntecs.de/viewcv...Wee/trunk/ChangeLog?view=auto
>>[3]
>>http://www.ntecs.de/viewcv...*checkout*/Wee/trunk/doc/rdoc/index.html
>>
>>
>
>
>



Michael Neumann

1/27/2005 4:15:00 AM

0

Lloyd Zusman wrote:
> Michael Neumann <mneumann@ntecs.de> writes:
>> gem install wee
>
>
> I just tried that, but I got the following error:
>
> # gem --version
> 0.8.4
> # gem install wee
> Attempting local installation of 'wee'
> Local gem file not found: wee*.gem
> Attempting remote installation of 'wee'
> ERROR: While executing gem ... (Gem::GemNotFoundException)
> Could not find wee (> 0) in the repository
>
>
> What am I missing?

Works fine here. Please try again.

Regards,

Michael