[ANN] Wee 0.5.0

M

Michael Neumann

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/app" 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
 
M

Michael Neumann

Michael said:
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
 
C

Curt Sampson

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?

cjs
 
J

Joao Pedrosa

Hi,

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
 
M

Michael Neumann

Joao said:
Hi,




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
 
L

Lloyd Zusman

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

Bill Atkins

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

Bill

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/app" 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/projects/nemo
[2] http://www.ntecs.de/viewcvs/viewcvs/Wee/trunk/ChangeLog?view=auto
[3]
http://www.ntecs.de/viewcvs/viewcvs/*checkout*/Wee/trunk/doc/rdoc/index.html
 
M

Michael Neumann

Bill said:
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/viewcvs/viewcvs/*checkout*/Wee/trunk/doc/rdoc/index.html

Stay tuned! I'm currently working on setting up a page dedicated to Wee:
http://ruwee.de (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

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/app" 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/projects/nemo
[2] http://www.ntecs.de/viewcvs/viewcvs/Wee/trunk/ChangeLog?view=auto
[3]
http://www.ntecs.de/viewcvs/viewcvs/*checkout*/Wee/trunk/doc/rdoc/index.html
 
M

Michael Neumann

Lloyd said:
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
 
E

Ezra Zygmuntowicz

Michael-
Can you explain once more how to start a web app up after gem
installing wee? What am I supposed to do next? I'm not entirely sure
about how to proceed but I would like to check wee out.

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
Mail from ezmobius1 won't change you life or will it?!?
 
G

George Moschovitis

Hello Michael,

congratulations for another strong release. I especially like the
no-continuation support (not to mention the rather cool OgScaffolder
:))

keep up the great work!
George.
 
C

Curt Sampson

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

Well, here's an excerpt from my install script.

BASEDIR=$(cd $(dirname $0)/../.. && /bin/pwd)
INSTALL_DIR=$BASEDIR/install
RUBY_LIB=$BASEDIR/install/lib/ruby

cd $(dirname $0)
mkdir -p $RUBY_LIB

config_args="
--prefix=$INSTALL_DIR
--std-ruby=/usr/local/ruby/1.8
--site-ruby-common=$RUBY_LIB
--site-ruby=$RUBY_LIB
--so-dir=$RUBY_LIB
"

if [ ! -f $RUBY_LIB/mysql.so ]; then
(cd mysql-ruby
&& ruby extconf.rb --with-mysql-config $config_args
&& make
&& ruby -run -e install -- -vpm 0755 mysql.so $RUBY_LIB/
&& make realclean && rm mysql.c
)
fi

# [many packages deleted here]

if [ ! -f $RUBY_LIB/activerecord.rb ]; then
(cd activerecord && ruby install.rb $RUBY_LIB)
fi

Every package seems to install slightly differently, which is annoying.
But the basic idea is that I have the correct versions of most of the
stuff I need in CVS. To deploy, I do a checkout, build all of the
stuff (C libraries, apache, php, php libs, ruby libs, etc. etc.) into
a special install dir, and run using that. Thus, I don't care what
particular ruby libraries happen to be installed on a machine: I know
that I'm using the correct ones that I tested my software with in
development.

cjs
 
L

Lloyd Zusman

Michael Neumann said:
Works fine here. Please try again.

I have tried again, and I am getting the same result. I then
re-installed rubygems-0.8.4 and retried: still the same result.

Whem I do a "gem query --remote", I don't see anything named "wee". If
I do a "gem install" on any of the names that do show up when I do a
"gem query --remote", the installation of that package indeed works.

So, it looks like my rubygems installation is not looking in the right
place for wee. But as far as I can tell, I'm using the standard
rubygems configuration.

I'm at a loss as to what to do here.

Can anyone think of something that I might be doing wrong?
 
M

Michael Neumann

Ezra said:
Michael-
Can you explain once more how to start a web app up after gem
installing wee? What am I supposed to do next? I'm not entirely sure
about how to proceed but I would like to check wee out.

Okay, if you have put the example I gave in my announce post into file
"hello.rb", then you start it like this:

ruby -rubygems hello.rb

Alternatively, set the RUBYOPT environment variable to -rubygems:

export RUBYOPT=-rubygems

Or for csh:

setenv RUBYOPT -rubygems

Then you can start hello.rb like this:

ruby hello.rb

The third way is to simply put this line

require 'rubygems'

at the top of hello.rb. Now you can start it like any other Ruby file
(this should easily work on windows too).

Hope this helps!

Regards,

Michael
 
C

cyberco

Looks really interesting, and I'got it working, but I'm having trouble
doing useful stuff. Is there a quickstart somewhere?
Keep up the good work!
CyBerco
 
M

Michael Neumann

cyberco said:
Looks really interesting, and I'got it working, but I'm having trouble
doing useful stuff. Is there a quickstart somewhere?
Keep up the good work!

I'm currently working on "translating" the Onlamp turorial to Wee ;-)
Just finished a prototype Og scaffolder... need probably some more
days... stay tuned.

Regards,

Michael
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top