wee 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +132 -0
- data/INSTALL +13 -3
- data/README +3 -3
- data/Rakefile +5 -1
- data/bin/wee +100 -0
- data/doc/rdoc/classes/Array.html +12 -12
- data/doc/rdoc/classes/Cache/StorageCache.html +38 -38
- data/doc/rdoc/classes/Cache/Strategy/CapacityBounded.html +30 -30
- data/doc/rdoc/classes/Cache/Strategy/LFU.html +24 -24
- data/doc/rdoc/classes/Cache/Strategy/LRU.html +24 -24
- data/doc/rdoc/classes/Cache/Strategy/Unbounded.html +24 -24
- data/doc/rdoc/classes/Enumerable.html +6 -6
- data/doc/rdoc/classes/Main.html +265 -0
- data/doc/rdoc/classes/Object.html +12 -12
- data/doc/rdoc/classes/OgApplication.html +2 -2
- data/doc/rdoc/classes/OgScaffolder.html +444 -64
- data/doc/rdoc/classes/OgScaffolder/Editor.html +490 -0
- data/doc/rdoc/classes/OgSession.html +4 -4
- data/doc/rdoc/classes/Recipe.html +113 -0
- data/doc/rdoc/classes/String.html +12 -12
- data/doc/rdoc/classes/Struct.html +12 -12
- data/doc/rdoc/classes/Wee.html +10 -1
- data/doc/rdoc/classes/Wee/AnswerDecoration.html +9 -9
- data/doc/rdoc/classes/Wee/Application.html +48 -47
- data/doc/rdoc/classes/Wee/Brush.html +19 -23
- data/doc/rdoc/classes/Wee/Brush/AnchorTag.html +17 -14
- data/doc/rdoc/classes/Wee/Brush/FileUploadTag.html +20 -14
- data/doc/rdoc/classes/Wee/Brush/FormTag.html +25 -21
- data/doc/rdoc/classes/Wee/Brush/GenericEncodedTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/GenericTagBrush.html +234 -100
- data/doc/rdoc/classes/Wee/Brush/GenericTextBrush.html +12 -12
- data/doc/rdoc/classes/Wee/Brush/ImageButtonTag.html +28 -22
- data/doc/rdoc/classes/Wee/Brush/ImageTag.html +23 -24
- data/doc/rdoc/classes/Wee/Brush/InputTag.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/JavascriptTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/Page.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/SelectListTag.html +33 -57
- data/doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html +154 -0
- data/doc/rdoc/classes/Wee/Brush/SelectOptionTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/SubmitButtonTag.html +20 -14
- data/doc/rdoc/classes/Wee/Brush/TableDataTag.html +14 -14
- data/doc/rdoc/classes/Wee/Brush/TableHeaderTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TableRowTag.html +42 -42
- data/doc/rdoc/classes/Wee/Brush/TableTag.html +7 -7
- data/doc/rdoc/classes/Wee/Brush/TextAreaTag.html +27 -21
- data/doc/rdoc/classes/Wee/Brush/TextInputTag.html +20 -14
- data/doc/rdoc/classes/Wee/CallbackRegistry.html +64 -36
- data/doc/rdoc/classes/Wee/CallbackStream.html +21 -21
- data/doc/rdoc/classes/Wee/Canvas.html +24 -24
- data/doc/rdoc/classes/Wee/Component.html +179 -151
- data/doc/rdoc/classes/Wee/Component/OnAnswer.html +12 -12
- data/doc/rdoc/classes/Wee/Decoration.html +42 -42
- data/doc/rdoc/classes/Wee/Delegate.html +27 -27
- data/doc/rdoc/classes/Wee/ErrorResponse.html +14 -14
- data/doc/rdoc/classes/Wee/FormDecoration.html +6 -6
- data/doc/rdoc/classes/Wee/GenericResponse.html +7 -7
- data/doc/rdoc/classes/Wee/HtmlCanvas.html +326 -219
- data/doc/rdoc/classes/Wee/HtmlWriter.html +40 -40
- data/doc/rdoc/classes/Wee/LiteralMethodCallback.html +19 -19
- data/doc/rdoc/classes/Wee/Md5IdGenerator.html +181 -0
- data/doc/rdoc/classes/Wee/MessageBox.html +12 -12
- data/doc/rdoc/classes/Wee/PageDecoration.html +18 -18
- data/doc/rdoc/classes/Wee/PagelessApplication.html +152 -0
- data/doc/rdoc/classes/Wee/PagelessRequest.html +177 -0
- data/doc/rdoc/classes/Wee/PagelessSession.html +320 -0
- data/doc/rdoc/classes/Wee/Presenter.html +145 -89
- data/doc/rdoc/classes/Wee/RedirectResponse.html +7 -7
- data/doc/rdoc/classes/Wee/RefreshResponse.html +7 -7
- data/doc/rdoc/classes/Wee/Request.html +116 -50
- data/doc/rdoc/classes/Wee/RequestHandler.html +31 -31
- data/doc/rdoc/classes/Wee/Response.html +76 -28
- data/doc/rdoc/classes/Wee/Session.html +129 -506
- data/doc/rdoc/classes/Wee/SimpleIdGenerator.html +22 -40
- data/doc/rdoc/classes/Wee/Snapshot.html +19 -19
- data/doc/rdoc/classes/Wee/Utils.html +70 -17
- data/doc/rdoc/classes/Wee/Utils/LRUCache.html +6 -6
- data/doc/rdoc/classes/Wee/ValueHolder.html +18 -18
- data/doc/rdoc/classes/Wee/WEBrickAdaptor.html +82 -49
- data/doc/rdoc/classes/Wee/WrapperDecoration.html +6 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/INSTALL.html +17 -5
- data/doc/rdoc/files/README.html +9 -11
- data/doc/rdoc/files/lib/wee/adaptors/webrick_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/application_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/components/page_decoration_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/continuation/session_rb.html +1 -3
- data/doc/rdoc/files/lib/wee/core/callback_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core/component_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/core_rb.html +3 -3
- data/doc/rdoc/files/lib/wee/databases/og/application_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/databases/og/session_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/databases/og_rb.html +4 -1
- data/doc/rdoc/files/lib/wee/idgen/md5_rb.html +115 -0
- data/doc/rdoc/files/lib/wee/idgen/simple_rb.html +107 -0
- data/doc/rdoc/files/lib/wee/pageless/application_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/pageless/request_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/pageless/session_rb.html +108 -0
- data/doc/rdoc/files/lib/wee/pageless_rb.html +110 -0
- data/doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html +8 -1
- data/doc/rdoc/files/lib/wee/request_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/response_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/session_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html +114 -0
- data/doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/skeleton/og/run_rb.html +115 -0
- data/doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html +111 -0
- data/doc/rdoc/files/lib/wee/template_rb.html +101 -0
- data/doc/rdoc/files/lib/wee/utils/autoreload_rb.html +1 -1
- data/doc/rdoc/files/lib/wee/utils/helper_rb.html +1 -1
- data/doc/rdoc/files/lib/wee_rb.html +4 -2
- data/doc/rdoc/fr_class_index.html +8 -4
- data/doc/rdoc/fr_file_index.html +17 -1
- data/doc/rdoc/fr_method_index.html +312 -267
- data/examples/live-update.rb +1 -1
- data/install.rb +14 -0
- data/lib/wee.rb +6 -2
- data/lib/wee/adaptors/webrick.rb +17 -5
- data/lib/wee/application.rb +2 -1
- data/lib/wee/continuation/session.rb +1 -146
- data/lib/wee/core/callback.rb +11 -5
- data/lib/wee/core/component.rb +14 -10
- data/lib/wee/databases/og.rb +3 -113
- data/lib/wee/databases/og/application.rb +3 -0
- data/lib/wee/databases/og/old_scaffolder.rb +98 -0
- data/lib/wee/databases/og/scaffolder.rb +174 -0
- data/lib/wee/databases/og/session.rb +9 -0
- data/lib/wee/idgen/md5.rb +21 -0
- data/lib/wee/{idgen.rb → idgen/simple.rb} +2 -4
- data/lib/wee/pageless.rb +3 -0
- data/lib/wee/pageless/application.rb +9 -0
- data/lib/wee/pageless/request.rb +15 -0
- data/lib/wee/pageless/session.rb +89 -0
- data/lib/wee/renderer/html/brushes.rb +100 -115
- data/lib/wee/renderer/html/canvas.rb +32 -2
- data/lib/wee/request.rb +36 -24
- data/lib/wee/response.rb +8 -1
- data/lib/wee/session.rb +13 -7
- data/lib/wee/skeleton/og/README +38 -0
- data/lib/wee/skeleton/og/components/main.rb +16 -0
- data/lib/wee/skeleton/og/conf/db.rb +8 -0
- data/lib/wee/skeleton/og/models/recipe.rb +5 -0
- data/lib/wee/skeleton/og/run.rb +23 -0
- data/lib/wee/skeleton/simple/README +32 -0
- data/lib/wee/skeleton/simple/components/main.rb +25 -0
- data/lib/wee/skeleton/simple/run.rb +12 -0
- data/lib/wee/template.rb +28 -0
- data/lib/wee/utils/autoreload.rb +29 -0
- data/lib/wee/utils/helper.rb +9 -5
- data/test/test_request.rb +4 -3
- data/wee.gemspec +3 -1
- metadata +91 -22
data/lib/wee/response.rb
CHANGED
@@ -6,6 +6,14 @@ class Wee::Response
|
|
6
6
|
attr_accessor :status, :content
|
7
7
|
attr_reader :header
|
8
8
|
|
9
|
+
def cookies?
|
10
|
+
@cookies
|
11
|
+
end
|
12
|
+
|
13
|
+
def cookies
|
14
|
+
@cookies ||= []
|
15
|
+
end
|
16
|
+
|
9
17
|
def initialize(mime_type = 'text/html', content='')
|
10
18
|
@status = 200
|
11
19
|
@header = DEFAULT_HEADER.dup
|
@@ -23,7 +31,6 @@ class Wee::Response
|
|
23
31
|
def <<(str)
|
24
32
|
@content << str
|
25
33
|
end
|
26
|
-
|
27
34
|
end
|
28
35
|
|
29
36
|
class Wee::GenericResponse < Wee::Response
|
data/lib/wee/session.rb
CHANGED
@@ -47,7 +47,7 @@ class Wee::Session < Wee::RequestHandler
|
|
47
47
|
process_request
|
48
48
|
sleep
|
49
49
|
rescue Exception => exn
|
50
|
-
context
|
50
|
+
set_response(context, Wee::ErrorResponse.new(exn))
|
51
51
|
ensure
|
52
52
|
Thread.current[:wee_session] = nil
|
53
53
|
@context = nil
|
@@ -83,7 +83,7 @@ class Wee::Session < Wee::RequestHandler
|
|
83
83
|
|
84
84
|
# A valid page_id was specified and the corresponding page exists.
|
85
85
|
|
86
|
-
@page.snapshot.restore
|
86
|
+
@page.snapshot.restore if @context.request.page_id != @snapshot_page_id
|
87
87
|
|
88
88
|
p @context.request.fields if $DEBUG
|
89
89
|
|
@@ -124,7 +124,8 @@ class Wee::Session < Wee::RequestHandler
|
|
124
124
|
# replace existing page with new snapshot
|
125
125
|
@page.snapshot = self.snapshot
|
126
126
|
@page_store[@context.request.page_id] = @page
|
127
|
-
@
|
127
|
+
@snapshot_page_id = @context.request.page_id
|
128
|
+
set_response(@context, live_update_response)
|
128
129
|
else
|
129
130
|
handle_new_page_view(@context)
|
130
131
|
end
|
@@ -149,8 +150,8 @@ class Wee::Session < Wee::RequestHandler
|
|
149
150
|
@context
|
150
151
|
end
|
151
152
|
|
152
|
-
def
|
153
|
-
@page
|
153
|
+
def current_callbacks
|
154
|
+
@page.callbacks
|
154
155
|
end
|
155
156
|
|
156
157
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
@@ -175,12 +176,17 @@ class Wee::Session < Wee::RequestHandler
|
|
175
176
|
new_page_id = @idgen.next.to_s
|
176
177
|
new_page = create_page(snapshot || self.snapshot())
|
177
178
|
@page_store[new_page_id] = new_page
|
179
|
+
@snapshot_page_id = new_page_id
|
178
180
|
redirect_url = context.request.build_url(context.request.request_handler_id, new_page_id)
|
179
|
-
context
|
181
|
+
set_response(context, Wee::RedirectResponse.new(redirect_url))
|
182
|
+
end
|
183
|
+
|
184
|
+
def set_response(context, response)
|
185
|
+
context.response = response
|
180
186
|
end
|
181
187
|
|
182
188
|
def respond(context, callbacks)
|
183
|
-
context
|
189
|
+
set_response(context, Wee::GenericResponse.new('text/html', ''))
|
184
190
|
|
185
191
|
rctx = Wee::RenderingContext.new(context.request, context.response, callbacks, Wee::HtmlWriter.new(context.response.content))
|
186
192
|
@root_component.do_render_chain(rctx)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
NOTE THAT THIS WILL MODIFY THE SELECTED DATABASE!
|
2
|
+
|
3
|
+
= Configuration
|
4
|
+
|
5
|
+
You probably want to edit your database settings (conf/db.rb).
|
6
|
+
|
7
|
+
= How to start this application
|
8
|
+
|
9
|
+
If you have installed Wee and Og via Rubygems, then:
|
10
|
+
|
11
|
+
ruby -rubygems run.rb
|
12
|
+
|
13
|
+
Otherwise you can omit the -rubygems option:
|
14
|
+
|
15
|
+
ruby run.rb
|
16
|
+
|
17
|
+
Now point your browser to http://127.0.0.1:2000/app
|
18
|
+
|
19
|
+
= Where do I get more information?
|
20
|
+
|
21
|
+
* Read the documentation here:
|
22
|
+
|
23
|
+
http://ntecs.de/viewcvs/viewcvs/*checkout*/Wee/trunk/doc/rdoc/index.html
|
24
|
+
|
25
|
+
* Have a look at the examples in the examples/ directory. If you've installed
|
26
|
+
Wee via Rubygems, then you'll find the examples this way:
|
27
|
+
|
28
|
+
cd `gem environment gemdir`
|
29
|
+
cd gems/wee-VERSION
|
30
|
+
cd examples
|
31
|
+
|
32
|
+
* Post your questions on ruby-talk
|
33
|
+
|
34
|
+
* Post your questions to wee-talk:
|
35
|
+
|
36
|
+
http://rubyforge.org/mailman/listinfo/wee-talk
|
37
|
+
|
38
|
+
* Ask me personally (mneumann@ntecs.de).
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Main < Wee::Component
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
super()
|
5
|
+
@scaffolder = add_child OgScaffolder.new(Recipe)
|
6
|
+
end
|
7
|
+
|
8
|
+
# --------------------------------------------
|
9
|
+
# Rendering
|
10
|
+
# --------------------------------------------
|
11
|
+
|
12
|
+
def render
|
13
|
+
r.render @scaffolder
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'wee'
|
2
|
+
require 'wee/utils'
|
3
|
+
require 'wee/adaptors/webrick'
|
4
|
+
require 'og'
|
5
|
+
require 'wee/databases/og'
|
6
|
+
|
7
|
+
# Database configuration
|
8
|
+
require 'conf/db.rb'
|
9
|
+
|
10
|
+
# Your components
|
11
|
+
require 'components/main'
|
12
|
+
|
13
|
+
# Your models
|
14
|
+
require 'models/recipe'
|
15
|
+
|
16
|
+
|
17
|
+
app = Wee::Utils.app_for(nil, :application => OgApplication,
|
18
|
+
:session => OgSession) {
|
19
|
+
Main.new.add_decoration(Wee::PageDecoration.new('Wee+Og'))
|
20
|
+
}
|
21
|
+
app.db = Og::Database.new(DB_CONFIG)
|
22
|
+
Wee::Utils::autoreload_glob('components/**/*.rb')
|
23
|
+
Wee::WEBrickAdaptor.register('/app' => app).start
|
@@ -0,0 +1,32 @@
|
|
1
|
+
= How to start this application
|
2
|
+
|
3
|
+
If you have installed Wee via Rubygems, then:
|
4
|
+
|
5
|
+
ruby -rubygems run.rb
|
6
|
+
|
7
|
+
Otherwise you can omit the -rubygems option:
|
8
|
+
|
9
|
+
ruby run.rb
|
10
|
+
|
11
|
+
Now point your browser to http://127.0.0.1:2000/app
|
12
|
+
|
13
|
+
= Where do I get more information?
|
14
|
+
|
15
|
+
* Read the documentation here:
|
16
|
+
|
17
|
+
http://ntecs.de/viewcvs/viewcvs/*checkout*/Wee/trunk/doc/rdoc/index.html
|
18
|
+
|
19
|
+
* Have a look at the examples in the examples/ directory. If you've installed
|
20
|
+
Wee via Rubygems, then you'll find the examples this way:
|
21
|
+
|
22
|
+
cd `gem environment gemdir`
|
23
|
+
cd gems/wee-VERSION
|
24
|
+
cd examples
|
25
|
+
|
26
|
+
* Post your questions on ruby-talk
|
27
|
+
|
28
|
+
* Post your questions to wee-talk:
|
29
|
+
|
30
|
+
http://rubyforge.org/mailman/listinfo/wee-talk
|
31
|
+
|
32
|
+
* Ask me personally (mneumann@ntecs.de).
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Main < Wee::Component
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
super()
|
5
|
+
# Put your own initialization code below...
|
6
|
+
end
|
7
|
+
|
8
|
+
# --------------------------------------------
|
9
|
+
# Rendering
|
10
|
+
# --------------------------------------------
|
11
|
+
|
12
|
+
def render
|
13
|
+
r.anchor.callback(:click).with { r.h1("Welcome to Wee!") }
|
14
|
+
r.text "#{ @clicks || 'No' } clicks"
|
15
|
+
end
|
16
|
+
|
17
|
+
# --------------------------------------------
|
18
|
+
# Actions
|
19
|
+
# --------------------------------------------
|
20
|
+
|
21
|
+
def click
|
22
|
+
@clicks = (@clicks || 0) + 1
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'wee'
|
2
|
+
require 'wee/utils'
|
3
|
+
require 'wee/adaptors/webrick'
|
4
|
+
|
5
|
+
# Your components
|
6
|
+
require 'components/main'
|
7
|
+
|
8
|
+
app = Wee::Utils.app_for {
|
9
|
+
Main.new.add_decoration(Wee::PageDecoration.new('Wee'))
|
10
|
+
}
|
11
|
+
Wee::Utils::autoreload_glob('components/**/*.rb')
|
12
|
+
Wee::WEBrickAdaptor.register('/app' => app).start
|
data/lib/wee/template.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
class Wee::Presenter
|
2
|
+
def self.template(method, hash={})
|
3
|
+
method = method.to_s
|
4
|
+
|
5
|
+
file_code =
|
6
|
+
if hash.has_key?(:property)
|
7
|
+
"lookup_property(#{ hash[:property].inspect })"
|
8
|
+
elsif hash.has_key?(:file)
|
9
|
+
hash[:file].inspect
|
10
|
+
else
|
11
|
+
caller_path = caller.first.sub(/:\d+$/, "")
|
12
|
+
basename = caller_path[0, caller_path.rindex(".rb")]
|
13
|
+
ext = '.tpl'
|
14
|
+
|
15
|
+
if method =~ /^render(.*)$/
|
16
|
+
basename + ext + $1.tr('_', '-')
|
17
|
+
else
|
18
|
+
raise ArgumentError
|
19
|
+
end.inspect
|
20
|
+
end
|
21
|
+
|
22
|
+
class_eval %{
|
23
|
+
def #{ method }
|
24
|
+
r.template(#{ file_code })
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
data/lib/wee/utils/autoreload.rb
CHANGED
@@ -24,4 +24,33 @@ module Wee::Utils
|
|
24
24
|
end
|
25
25
|
}
|
26
26
|
end
|
27
|
+
|
28
|
+
# Note that this method will load any file that matches the glob and in
|
29
|
+
# modified since the method call, regardless whether it's loaded by the
|
30
|
+
# current application or not. The glob is expanded only once at the initial
|
31
|
+
# method call.
|
32
|
+
|
33
|
+
def autoreload_glob(glob, check_interval=1)
|
34
|
+
files = Dir.glob(glob)
|
35
|
+
file_mtime = {}
|
36
|
+
start_time = Time.now
|
37
|
+
Thread.new {
|
38
|
+
loop do
|
39
|
+
sleep check_interval
|
40
|
+
files.each do |file|
|
41
|
+
if (File.exists?(file) and
|
42
|
+
File.stat(file).mtime > (file_mtime[file] || start_time))
|
43
|
+
file_mtime[file] = File.stat(file).mtime
|
44
|
+
STDERR.puts "reload #{ file }"
|
45
|
+
begin
|
46
|
+
load(file)
|
47
|
+
rescue Exception => e
|
48
|
+
STDERR.puts e.inspect
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
27
56
|
end
|
data/lib/wee/utils/helper.rb
CHANGED
@@ -16,8 +16,8 @@ module Wee::Utils
|
|
16
16
|
# [:page_cache_capacity]
|
17
17
|
# The size of the sessions page_store (default: 10)
|
18
18
|
#
|
19
|
-
# [:
|
20
|
-
#
|
19
|
+
# [:id_gen]
|
20
|
+
# The id generator to use for session-ids (default: Md5IdGenerator.new)
|
21
21
|
#
|
22
22
|
def self.app_for(component=nil, options={}, &block)
|
23
23
|
raise "either component or block must be given" if component.nil? and block.nil?
|
@@ -26,7 +26,7 @@ module Wee::Utils
|
|
26
26
|
:application => Wee::Application,
|
27
27
|
:session => Wee::Session,
|
28
28
|
:page_cache_capacity => 10,
|
29
|
-
:
|
29
|
+
:id_gen => Wee::Md5IdGenerator.new
|
30
30
|
}
|
31
31
|
options = defaults.update(options)
|
32
32
|
|
@@ -38,10 +38,14 @@ module Wee::Utils
|
|
38
38
|
else
|
39
39
|
sess.root_component = block.call
|
40
40
|
end
|
41
|
-
sess.page_store
|
41
|
+
if sess.respond_to?(:page_store=)
|
42
|
+
# This is so that you can use a Pageless session, which does not have
|
43
|
+
# a page_store.
|
44
|
+
sess.page_store = Wee::Utils::LRUCache.new(options[:page_cache_capacity])
|
45
|
+
end
|
42
46
|
}
|
43
47
|
}
|
44
|
-
app.id_generator =
|
48
|
+
app.id_generator = options[:id_gen]
|
45
49
|
}
|
46
50
|
end
|
47
51
|
end
|
data/test/test_request.rb
CHANGED
@@ -4,10 +4,11 @@ require 'wee/request'
|
|
4
4
|
|
5
5
|
class Test_Request < Test::Unit::TestCase
|
6
6
|
def test_parse
|
7
|
-
|
7
|
+
d = Wee::Request::DELIM
|
8
|
+
req = Wee::Request.new('/app', "/app/...#{d}req_handler_id/page_id", nil, nil, nil)
|
8
9
|
assert_equal 'req_handler_id', req.request_handler_id
|
9
10
|
assert_equal 'page_id', req.page_id
|
10
|
-
assert_equal
|
11
|
-
assert_equal
|
11
|
+
assert_equal "/app/#{d}a/b?c", req.build_url('a', 'b', 'c')
|
12
|
+
assert_equal "/app/#{d}req_handler_id/b", req.build_url('req_handler_id', 'b')
|
12
13
|
end
|
13
14
|
end
|
data/wee.gemspec
CHANGED
@@ -14,9 +14,11 @@ spec = Gem::Specification.new do |s|
|
|
14
14
|
s.files = Dir['**/*'].delete_if {|item| item.include?(".svn") }
|
15
15
|
|
16
16
|
s.require_path = 'lib'
|
17
|
+
s.bindir = 'bin'
|
18
|
+
s.executables = ['wee']
|
17
19
|
|
18
20
|
s.author = "Michael Neumann"
|
19
21
|
s.email = "mneumann@ntecs.de"
|
20
|
-
s.homepage = "
|
22
|
+
s.homepage = "http://rubyforge.org/projects/wee"
|
21
23
|
s.rubyforge_project = "wee"
|
22
24
|
end
|
metadata
CHANGED
@@ -3,13 +3,13 @@ rubygems_version: 0.8.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: wee
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-01-
|
6
|
+
version: 0.6.0
|
7
|
+
date: 2005-01-31
|
8
8
|
summary: Wee is a framework for building highly dynamic web applications.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: mneumann@ntecs.de
|
12
|
-
homepage:
|
12
|
+
homepage: http://rubyforge.org/projects/wee
|
13
13
|
rubyforge_project: wee
|
14
14
|
description:
|
15
15
|
autorequire:
|
@@ -30,20 +30,22 @@ files:
|
|
30
30
|
- test
|
31
31
|
- doc
|
32
32
|
- lib
|
33
|
+
- bin
|
33
34
|
- benchmark
|
34
35
|
- examples
|
35
|
-
- wee.gemspec
|
36
36
|
- Rakefile
|
37
|
+
- wee.gemspec
|
37
38
|
- TODO
|
38
39
|
- INSTALL
|
39
40
|
- ChangeLog
|
41
|
+
- install.rb
|
40
42
|
- README
|
41
43
|
- test/utils
|
42
44
|
- test/components
|
43
45
|
- test/stressed_application.rb
|
44
46
|
- test/test_html_canvas.rb
|
45
|
-
- test/stress_and_measure.rb
|
46
47
|
- test/test_html_writer.rb
|
48
|
+
- test/stress_and_measure.rb
|
47
49
|
- test/test_component.rb
|
48
50
|
- test/stress.rb
|
49
51
|
- test/test_request.rb
|
@@ -75,10 +77,13 @@ files:
|
|
75
77
|
- doc/rdoc/files/lib/wee_rb.html
|
76
78
|
- doc/rdoc/files/lib/wee/components
|
77
79
|
- doc/rdoc/files/lib/wee/core
|
80
|
+
- doc/rdoc/files/lib/wee/pageless
|
78
81
|
- doc/rdoc/files/lib/wee/renderer
|
79
82
|
- doc/rdoc/files/lib/wee/continuation
|
80
83
|
- doc/rdoc/files/lib/wee/adaptors
|
81
84
|
- doc/rdoc/files/lib/wee/rendering
|
85
|
+
- doc/rdoc/files/lib/wee/skeleton
|
86
|
+
- doc/rdoc/files/lib/wee/idgen
|
82
87
|
- doc/rdoc/files/lib/wee/databases
|
83
88
|
- doc/rdoc/files/lib/wee/utils
|
84
89
|
- doc/rdoc/files/lib/wee/snapshot_ext_rb.html
|
@@ -86,6 +91,7 @@ files:
|
|
86
91
|
- doc/rdoc/files/lib/wee/snapshot_rb.html
|
87
92
|
- doc/rdoc/files/lib/wee/utils_rb.html
|
88
93
|
- doc/rdoc/files/lib/wee/component_rb.html
|
94
|
+
- doc/rdoc/files/lib/wee/template_rb.html
|
89
95
|
- doc/rdoc/files/lib/wee/page_rb.html
|
90
96
|
- doc/rdoc/files/lib/wee/component_ext_rb.html
|
91
97
|
- doc/rdoc/files/lib/wee/components_rb.html
|
@@ -94,17 +100,18 @@ files:
|
|
94
100
|
- doc/rdoc/files/lib/wee/html_canvas_rb.html
|
95
101
|
- doc/rdoc/files/lib/wee/html_writer_rb.html
|
96
102
|
- doc/rdoc/files/lib/wee/application_rb.html
|
103
|
+
- doc/rdoc/files/lib/wee/pageless_rb.html
|
97
104
|
- doc/rdoc/files/lib/wee/presenter_rb.html
|
98
105
|
- doc/rdoc/files/lib/wee/state_registry_rb.html
|
99
106
|
- doc/rdoc/files/lib/wee/continuation_rb.html
|
100
107
|
- doc/rdoc/files/lib/wee/holder_rb.html
|
101
108
|
- doc/rdoc/files/lib/wee/session_rb.html
|
102
109
|
- doc/rdoc/files/lib/wee/context_rb.html
|
103
|
-
- doc/rdoc/files/lib/wee/requesthandler_rb.html
|
104
|
-
- doc/rdoc/files/lib/wee/idgen_rb.html
|
105
110
|
- doc/rdoc/files/lib/wee/webrick_rb.html
|
106
|
-
- doc/rdoc/files/lib/wee/
|
111
|
+
- doc/rdoc/files/lib/wee/idgen_rb.html
|
112
|
+
- doc/rdoc/files/lib/wee/requesthandler_rb.html
|
107
113
|
- doc/rdoc/files/lib/wee/stuff_rb.html
|
114
|
+
- doc/rdoc/files/lib/wee/decoration_rb.html
|
108
115
|
- doc/rdoc/files/lib/wee/request_rb.html
|
109
116
|
- doc/rdoc/files/lib/wee/components/wrapper_decoration_rb.html
|
110
117
|
- doc/rdoc/files/lib/wee/components/form_decoration_rb.html
|
@@ -116,9 +123,12 @@ files:
|
|
116
123
|
- doc/rdoc/files/lib/wee/core/component_rb.html
|
117
124
|
- doc/rdoc/files/lib/wee/core/presenter_rb.html
|
118
125
|
- doc/rdoc/files/lib/wee/core/decoration_rb.html
|
126
|
+
- doc/rdoc/files/lib/wee/pageless/application_rb.html
|
127
|
+
- doc/rdoc/files/lib/wee/pageless/session_rb.html
|
128
|
+
- doc/rdoc/files/lib/wee/pageless/request_rb.html
|
119
129
|
- doc/rdoc/files/lib/wee/renderer/html
|
120
|
-
- doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html
|
121
130
|
- doc/rdoc/files/lib/wee/renderer/html/brushes_rb.html
|
131
|
+
- doc/rdoc/files/lib/wee/renderer/html/canvas_rb.html
|
122
132
|
- doc/rdoc/files/lib/wee/renderer/html/writer_rb.html
|
123
133
|
- doc/rdoc/files/lib/wee/continuation/core
|
124
134
|
- doc/rdoc/files/lib/wee/continuation/session_rb.html
|
@@ -128,24 +138,46 @@ files:
|
|
128
138
|
- doc/rdoc/files/lib/wee/rendering/html/brushes_rb.html
|
129
139
|
- doc/rdoc/files/lib/wee/rendering/html/canvas_rb.html
|
130
140
|
- doc/rdoc/files/lib/wee/rendering/html/writer_rb.html
|
141
|
+
- doc/rdoc/files/lib/wee/skeleton/og
|
142
|
+
- doc/rdoc/files/lib/wee/skeleton/simple
|
143
|
+
- doc/rdoc/files/lib/wee/skeleton/og/models
|
144
|
+
- doc/rdoc/files/lib/wee/skeleton/og/conf
|
145
|
+
- doc/rdoc/files/lib/wee/skeleton/og/components
|
146
|
+
- doc/rdoc/files/lib/wee/skeleton/og/run_rb.html
|
147
|
+
- doc/rdoc/files/lib/wee/skeleton/og/models/recipe_rb.html
|
148
|
+
- doc/rdoc/files/lib/wee/skeleton/og/conf/db_rb.html
|
149
|
+
- doc/rdoc/files/lib/wee/skeleton/og/components/main_rb.html
|
150
|
+
- doc/rdoc/files/lib/wee/skeleton/simple/components
|
151
|
+
- doc/rdoc/files/lib/wee/skeleton/simple/run_rb.html
|
152
|
+
- doc/rdoc/files/lib/wee/skeleton/simple/components/main_rb.html
|
153
|
+
- doc/rdoc/files/lib/wee/idgen/simple_rb.html
|
154
|
+
- doc/rdoc/files/lib/wee/idgen/md5_rb.html
|
155
|
+
- doc/rdoc/files/lib/wee/databases/og
|
131
156
|
- doc/rdoc/files/lib/wee/databases/og_rb.html
|
157
|
+
- doc/rdoc/files/lib/wee/databases/og/application_rb.html
|
158
|
+
- doc/rdoc/files/lib/wee/databases/og/session_rb.html
|
159
|
+
- doc/rdoc/files/lib/wee/databases/og/old_scaffolder_rb.html
|
160
|
+
- doc/rdoc/files/lib/wee/databases/og/scaffolder_rb.html
|
132
161
|
- doc/rdoc/files/lib/wee/utils/autoreload_rb.html
|
133
162
|
- doc/rdoc/files/lib/wee/utils/helper_rb.html
|
134
163
|
- doc/rdoc/files/lib/wee/utils/cache_rb.html
|
135
164
|
- doc/rdoc/files/lib/cache/cache_rb.html
|
136
165
|
- doc/rdoc/classes/Wee
|
166
|
+
- doc/rdoc/classes/OgScaffolder
|
137
167
|
- doc/rdoc/classes/Cache
|
138
|
-
- doc/rdoc/classes/LiteralMethod.html
|
139
|
-
- doc/rdoc/classes/Array.html
|
140
|
-
- doc/rdoc/classes/OgScaffolder.html
|
141
168
|
- doc/rdoc/classes/Enumerable.html
|
169
|
+
- doc/rdoc/classes/Array.html
|
170
|
+
- doc/rdoc/classes/OgSession.html
|
142
171
|
- doc/rdoc/classes/Wee.html
|
143
|
-
- doc/rdoc/classes/Cache.html
|
144
172
|
- doc/rdoc/classes/Struct.html
|
173
|
+
- doc/rdoc/classes/Main.html
|
174
|
+
- doc/rdoc/classes/Cache.html
|
175
|
+
- doc/rdoc/classes/OgApplication.html
|
176
|
+
- doc/rdoc/classes/LiteralMethod.html
|
177
|
+
- doc/rdoc/classes/OgScaffolder.html
|
145
178
|
- doc/rdoc/classes/String.html
|
146
179
|
- doc/rdoc/classes/Object.html
|
147
|
-
- doc/rdoc/classes/
|
148
|
-
- doc/rdoc/classes/OgApplication.html
|
180
|
+
- doc/rdoc/classes/Recipe.html
|
149
181
|
- doc/rdoc/classes/Wee/Utils
|
150
182
|
- doc/rdoc/classes/Wee/Component
|
151
183
|
- doc/rdoc/classes/Wee/StateRegistry
|
@@ -165,20 +197,22 @@ files:
|
|
165
197
|
- doc/rdoc/classes/Wee/Snapshot.html
|
166
198
|
- doc/rdoc/classes/Wee/HtmlWriter.html
|
167
199
|
- doc/rdoc/classes/Wee/WEBrickAdaptor.html
|
168
|
-
- doc/rdoc/classes/Wee/
|
200
|
+
- doc/rdoc/classes/Wee/PagelessRequest.html
|
169
201
|
- doc/rdoc/classes/Wee/CallbackStream.html
|
170
202
|
- doc/rdoc/classes/Wee/StateRegistry.html
|
171
203
|
- doc/rdoc/classes/Wee/Delegate.html
|
172
204
|
- doc/rdoc/classes/Wee/ValueHolder.html
|
173
205
|
- doc/rdoc/classes/Wee/FormDecoration.html
|
174
206
|
- doc/rdoc/classes/Wee/Canvas.html
|
207
|
+
- doc/rdoc/classes/Wee/RedirectResponse.html
|
175
208
|
- doc/rdoc/classes/Wee/StateHolder.html
|
176
|
-
- doc/rdoc/classes/Wee/
|
209
|
+
- doc/rdoc/classes/Wee/PagelessApplication.html
|
177
210
|
- doc/rdoc/classes/Wee/RenderingContext.html
|
178
211
|
- doc/rdoc/classes/Wee/Brush.html
|
179
212
|
- doc/rdoc/classes/Wee/Context.html
|
180
213
|
- doc/rdoc/classes/Wee/CallbackRegistry.html
|
181
214
|
- doc/rdoc/classes/Wee/ErrorPage.html
|
215
|
+
- doc/rdoc/classes/Wee/LiteralMethodCallback.html
|
182
216
|
- doc/rdoc/classes/Wee/WrapperDecoration.html
|
183
217
|
- doc/rdoc/classes/Wee/Request.html
|
184
218
|
- doc/rdoc/classes/Wee/Callback.html
|
@@ -188,11 +222,14 @@ files:
|
|
188
222
|
- doc/rdoc/classes/Wee/Component.html
|
189
223
|
- doc/rdoc/classes/Wee/Application.html
|
190
224
|
- doc/rdoc/classes/Wee/Presenter.html
|
225
|
+
- doc/rdoc/classes/Wee/PagelessSession.html
|
191
226
|
- doc/rdoc/classes/Wee/ErrorResponse.html
|
227
|
+
- doc/rdoc/classes/Wee/Md5IdGenerator.html
|
192
228
|
- doc/rdoc/classes/Wee/Utils/LRUCache.html
|
193
229
|
- doc/rdoc/classes/Wee/Component/OnAnswer.html
|
194
230
|
- doc/rdoc/classes/Wee/StateRegistry/Snapshot.html
|
195
231
|
- doc/rdoc/classes/Wee/StateRegistry/WithObject.html
|
232
|
+
- doc/rdoc/classes/Wee/Brush/SelectListTag
|
196
233
|
- doc/rdoc/classes/Wee/Brush/GenericSingleTagBrush.html
|
197
234
|
- doc/rdoc/classes/Wee/Brush/GenericTagBrush.html
|
198
235
|
- doc/rdoc/classes/Wee/Brush/Page.html
|
@@ -221,6 +258,8 @@ files:
|
|
221
258
|
- doc/rdoc/classes/Wee/Brush/TextAreaTag.html
|
222
259
|
- doc/rdoc/classes/Wee/Brush/ImageButtonTag.html
|
223
260
|
- doc/rdoc/classes/Wee/Brush/TableRowTag.html
|
261
|
+
- doc/rdoc/classes/Wee/Brush/SelectListTag/SelectListCallback.html
|
262
|
+
- doc/rdoc/classes/OgScaffolder/Editor.html
|
224
263
|
- doc/rdoc/classes/Cache/Strategy
|
225
264
|
- doc/rdoc/classes/Cache/StorageCache.html
|
226
265
|
- doc/rdoc/classes/Cache/Strategy.html
|
@@ -237,10 +276,13 @@ files:
|
|
237
276
|
- lib/wee
|
238
277
|
- lib/cache
|
239
278
|
- lib/wee.rb
|
279
|
+
- lib/wee/skeleton
|
240
280
|
- lib/wee/components
|
281
|
+
- lib/wee/idgen
|
241
282
|
- lib/wee/databases
|
242
283
|
- lib/wee/core
|
243
284
|
- lib/wee/utils
|
285
|
+
- lib/wee/pageless
|
244
286
|
- lib/wee/renderer
|
245
287
|
- lib/wee/continuation
|
246
288
|
- lib/wee/adaptors
|
@@ -249,19 +291,41 @@ files:
|
|
249
291
|
- lib/wee/session.rb
|
250
292
|
- lib/wee/context.rb
|
251
293
|
- lib/wee/components.rb
|
252
|
-
- lib/wee/idgen.rb
|
253
294
|
- lib/wee/request.rb
|
254
295
|
- lib/wee/core.rb
|
255
296
|
- lib/wee/application.rb
|
256
297
|
- lib/wee/response.rb
|
257
298
|
- lib/wee/utils.rb
|
299
|
+
- lib/wee/pageless.rb
|
300
|
+
- lib/wee/template.rb
|
258
301
|
- lib/wee/continuation.rb
|
259
302
|
- lib/wee/page.rb
|
303
|
+
- lib/wee/skeleton/og
|
304
|
+
- lib/wee/skeleton/simple
|
305
|
+
- lib/wee/skeleton/og/models
|
306
|
+
- lib/wee/skeleton/og/components
|
307
|
+
- lib/wee/skeleton/og/conf
|
308
|
+
- lib/wee/skeleton/og/run.rb
|
309
|
+
- lib/wee/skeleton/og/README
|
310
|
+
- lib/wee/skeleton/og/models/recipe.rb
|
311
|
+
- lib/wee/skeleton/og/components/main.rb
|
312
|
+
- lib/wee/skeleton/og/conf/db.rb
|
313
|
+
- lib/wee/skeleton/simple/components
|
314
|
+
- lib/wee/skeleton/simple/run.rb
|
315
|
+
- lib/wee/skeleton/simple/README
|
316
|
+
- lib/wee/skeleton/simple/components/main.rb
|
260
317
|
- lib/wee/components/page_decoration.rb
|
261
318
|
- lib/wee/components/messagebox.rb
|
262
319
|
- lib/wee/components/wrapper_decoration.rb
|
263
320
|
- lib/wee/components/form_decoration.rb
|
321
|
+
- lib/wee/idgen/simple.rb
|
322
|
+
- lib/wee/idgen/md5.rb
|
323
|
+
- lib/wee/databases/og
|
264
324
|
- lib/wee/databases/og.rb
|
325
|
+
- lib/wee/databases/og/old_scaffolder.rb
|
326
|
+
- lib/wee/databases/og/application.rb
|
327
|
+
- lib/wee/databases/og/session.rb
|
328
|
+
- lib/wee/databases/og/scaffolder.rb
|
265
329
|
- lib/wee/core/component.rb
|
266
330
|
- lib/wee/core/snapshot.rb
|
267
331
|
- lib/wee/core/presenter.rb
|
@@ -271,15 +335,19 @@ files:
|
|
271
335
|
- lib/wee/utils/autoreload.rb
|
272
336
|
- lib/wee/utils/helper.rb
|
273
337
|
- lib/wee/utils/cache.rb
|
338
|
+
- lib/wee/pageless/application.rb
|
339
|
+
- lib/wee/pageless/session.rb
|
340
|
+
- lib/wee/pageless/request.rb
|
274
341
|
- lib/wee/renderer/html
|
275
|
-
- lib/wee/renderer/html/canvas.rb
|
276
342
|
- lib/wee/renderer/html/brushes.rb
|
343
|
+
- lib/wee/renderer/html/canvas.rb
|
277
344
|
- lib/wee/renderer/html/writer.rb
|
278
345
|
- lib/wee/continuation/core
|
279
346
|
- lib/wee/continuation/session.rb
|
280
347
|
- lib/wee/continuation/core/component.rb
|
281
348
|
- lib/wee/adaptors/webrick.rb
|
282
349
|
- lib/cache/cache.rb
|
350
|
+
- bin/wee
|
283
351
|
- benchmark/Centrino1300
|
284
352
|
- benchmark/Centrino600
|
285
353
|
- benchmark/filehandler.rb
|
@@ -297,16 +365,17 @@ files:
|
|
297
365
|
- examples/hw.rb
|
298
366
|
- examples/test.rb
|
299
367
|
- examples/live-update.rb
|
300
|
-
- examples/window.rb
|
301
368
|
- examples/cc.rb
|
369
|
+
- examples/window.rb
|
302
370
|
- examples/ObjectSpaceBrowser.rb
|
303
|
-
- examples/calculator.rb
|
304
371
|
- examples/calendar.rb
|
372
|
+
- examples/calculator.rb
|
305
373
|
- examples/example.rb
|
306
374
|
test_files: []
|
307
375
|
rdoc_options: []
|
308
376
|
extra_rdoc_files: []
|
309
|
-
executables:
|
377
|
+
executables:
|
378
|
+
- wee
|
310
379
|
extensions: []
|
311
380
|
requirements: []
|
312
381
|
dependencies: []
|