nitro 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +124 -0
- data/README +2 -2
- data/Rakefile +4 -12
- data/bin/nitro +1 -1
- data/bin/nitrogen +47 -31
- data/doc/AUTHORS +3 -3
- data/doc/RELEASES +50 -1
- data/examples/README +7 -0
- data/lib/nitro.rb +5 -4
- data/lib/nitro/{adapters → adapter}/cgi.rb +2 -4
- data/lib/nitro/{adapters → adapter}/fastcgi.rb +1 -1
- data/lib/nitro/{adapters → adapter}/webrick.rb +5 -10
- data/lib/nitro/buffering.rb +6 -0
- data/lib/nitro/{builders → builder}/atom.rb +1 -5
- data/lib/nitro/{builders → builder}/form.rb +1 -5
- data/lib/nitro/{builders → builder}/rss.rb +3 -1
- data/lib/nitro/{builders → builder}/table.rb +2 -4
- data/lib/nitro/{builders → builder}/xhtml.rb +3 -5
- data/lib/nitro/{builders → builder}/xml.rb +2 -4
- data/lib/nitro/caching.rb +6 -4
- data/lib/nitro/caching/output.rb +18 -11
- data/lib/nitro/context.rb +3 -1
- data/lib/nitro/controller.rb +29 -18
- data/lib/nitro/dispatcher.rb +2 -4
- data/lib/nitro/element.rb +2 -0
- data/lib/nitro/environment.rb +2 -4
- data/lib/nitro/errors.rb +69 -0
- data/lib/nitro/mail.rb +2 -4
- data/lib/nitro/markup.rb +20 -3
- data/lib/nitro/output.rb +5 -9
- data/lib/nitro/part.rb +2 -3
- data/lib/nitro/render.rb +49 -30
- data/lib/nitro/request.rb +2 -1
- data/lib/nitro/runner.rb +23 -12
- data/lib/nitro/scaffold.rb +5 -3
- data/lib/nitro/service.rb +22 -0
- data/lib/nitro/service/xmlrpc.rb +42 -0
- data/lib/nitro/session.rb +2 -4
- data/lib/nitro/template.rb +8 -10
- data/lib/nitro/testing.rb +0 -4
- data/proto/public/error.xhtml +27 -2
- data/test/nitro/{adapters → adapter}/raw_post1.bin +0 -0
- data/test/nitro/{adapters → adapter}/tc_cgi.rb +1 -1
- data/test/nitro/{adapters → adapter}/tc_webrick.rb +1 -1
- data/test/nitro/{builders → builder}/tc_atom.rb +1 -1
- data/test/nitro/{builders → builder}/tc_rss.rb +1 -1
- data/test/nitro/{builders → builder}/tc_table.rb +1 -1
- data/test/nitro/{builders → builder}/tc_xhtml.rb +1 -1
- data/test/nitro/{builders → builder}/tc_xml.rb +1 -1
- data/test/nitro/tc_caching.rb +18 -0
- data/test/nitro/tc_controller.rb +1 -1
- data/test/nitro/tc_mail.rb +3 -1
- metadata +33 -168
- data/examples/README.windows +0 -9
- data/examples/ajax/controller.rb +0 -21
- data/examples/ajax/public/index.xhtml +0 -72
- data/examples/ajax/public/js/ajax.js +0 -64
- data/examples/ajax/run.rb +0 -14
- data/examples/blog/README +0 -70
- data/examples/blog/conf/apache.conf +0 -30
- data/examples/blog/conf/apache.conf.new +0 -53
- data/examples/blog/conf/lhttpd.conf +0 -79
- data/examples/blog/conf/locales/de.yml +0 -4
- data/examples/blog/conf/locales/en.yml +0 -4
- data/examples/blog/log/README +0 -3
- data/examples/blog/log/apache.error_log +0 -6647
- data/examples/blog/log/rewrite_log +0 -161
- data/examples/blog/public/base.xsl +0 -153
- data/examples/blog/public/fcgi.rb +0 -5
- data/examples/blog/public/m/bubbles.gif +0 -0
- data/examples/blog/public/m/comments_curve.gif +0 -0
- data/examples/blog/public/m/down.gif +0 -0
- data/examples/blog/public/m/footer_bg.gif +0 -0
- data/examples/blog/public/m/garrow.gif +0 -0
- data/examples/blog/public/m/gbull.gif +0 -0
- data/examples/blog/public/m/grbull.gif +0 -0
- data/examples/blog/public/m/h1_bg.gif +0 -0
- data/examples/blog/public/m/header_bg.gif +0 -0
- data/examples/blog/public/m/nitro.gif +0 -0
- data/examples/blog/public/m/obull.gif +0 -0
- data/examples/blog/public/m/page_bg.gif +0 -0
- data/examples/blog/public/m/rss.gif +0 -0
- data/examples/blog/public/m/side_title_bg.gif +0 -0
- data/examples/blog/public/m/sidebar_bg.gif +0 -0
- data/examples/blog/public/style.css +0 -305
- data/examples/blog/run.rb +0 -43
- data/examples/blog/src/blog.rb +0 -21
- data/examples/blog/src/controller.rb +0 -151
- data/examples/blog/src/mailer.rb +0 -23
- data/examples/blog/src/models/blog.rb +0 -33
- data/examples/blog/src/models/content.rb +0 -18
- data/examples/blog/src/views/blog_entry_email.xhtml +0 -16
- data/examples/blog/src/views/comments.xhtml +0 -36
- data/examples/blog/src/views/entry_form.xhtml +0 -22
- data/examples/blog/src/views/error.xhtml +0 -56
- data/examples/blog/src/views/index.xhtml +0 -49
- data/examples/blog/src/views/login.xhtml +0 -26
- data/examples/blog/src/views/recent_posts.xhtml +0 -14
- data/examples/blog/src/views/view_entry.xhtml +0 -37
- data/examples/blog/src/views/view_entry.xml +0 -12
- data/examples/blog/src/xsl/base.xsl +0 -160
- data/examples/blog/src/xsl/style.xsl +0 -143
- data/examples/blog/test/tc_blog.rb +0 -43
- data/examples/flash/log/README +0 -3
- data/examples/flash/root/index.xhtml +0 -16
- data/examples/flash/root/show_inline_text.xhtml +0 -17
- data/examples/flash/run.rb +0 -7
- data/examples/no_xsl_blog/README +0 -24
- data/examples/no_xsl_blog/conf/apache.conf +0 -30
- data/examples/no_xsl_blog/conf/lhttpd.conf +0 -79
- data/examples/no_xsl_blog/conf/locales/de.yml +0 -4
- data/examples/no_xsl_blog/conf/locales/en.yml +0 -4
- data/examples/no_xsl_blog/lib/blog.rb +0 -16
- data/examples/no_xsl_blog/lib/blog/controller.rb +0 -116
- data/examples/no_xsl_blog/lib/blog/model.rb +0 -35
- data/examples/no_xsl_blog/lib/blog/template.rb +0 -138
- data/examples/no_xsl_blog/lib/content.rb +0 -47
- data/examples/no_xsl_blog/log/README +0 -3
- data/examples/no_xsl_blog/log/apache.error_log +0 -473
- data/examples/no_xsl_blog/public/comments.xhtml +0 -36
- data/examples/no_xsl_blog/public/entry_form.xhtml +0 -22
- data/examples/no_xsl_blog/public/fcgi.rb +0 -5
- data/examples/no_xsl_blog/public/index.xhtml +0 -39
- data/examples/no_xsl_blog/public/login.xhtml +0 -21
- data/examples/no_xsl_blog/public/m/bubbles.gif +0 -0
- data/examples/no_xsl_blog/public/m/comments_curve.gif +0 -0
- data/examples/no_xsl_blog/public/m/down.gif +0 -0
- data/examples/no_xsl_blog/public/m/footer_bg.gif +0 -0
- data/examples/no_xsl_blog/public/m/garrow.gif +0 -0
- data/examples/no_xsl_blog/public/m/gbull.gif +0 -0
- data/examples/no_xsl_blog/public/m/grbull.gif +0 -0
- data/examples/no_xsl_blog/public/m/h1_bg.gif +0 -0
- data/examples/no_xsl_blog/public/m/header_bg.gif +0 -0
- data/examples/no_xsl_blog/public/m/nitro.gif +0 -0
- data/examples/no_xsl_blog/public/m/obull.gif +0 -0
- data/examples/no_xsl_blog/public/m/page_bg.gif +0 -0
- data/examples/no_xsl_blog/public/m/rss.gif +0 -0
- data/examples/no_xsl_blog/public/m/side_title_bg.gif +0 -0
- data/examples/no_xsl_blog/public/m/sidebar_bg.gif +0 -0
- data/examples/no_xsl_blog/public/recent_posts.xhtml +0 -14
- data/examples/no_xsl_blog/public/style.css +0 -299
- data/examples/no_xsl_blog/public/view_entry.xhtml +0 -25
- data/examples/no_xsl_blog/public/view_entry.xml +0 -12
- data/examples/no_xsl_blog/run.rb +0 -35
- data/examples/tiny/README +0 -14
- data/examples/tiny/conf/apache.conf +0 -30
- data/examples/tiny/conf/lhttpd.conf +0 -79
- data/examples/tiny/log/README +0 -3
- data/examples/tiny/log/apache.error_log +0 -154
- data/examples/tiny/public/deep/dir/hello.xhtml +0 -3
- data/examples/tiny/public/fcgi.rb +0 -5
- data/examples/tiny/public/include.xhtml +0 -3
- data/examples/tiny/public/index.xhtml +0 -55
- data/examples/tiny/public/nitro.png +0 -0
- data/examples/tiny/public/upload.xhtml +0 -21
- data/examples/tiny/run.rb +0 -7
- data/examples/wee_style/README +0 -10
- data/examples/wee_style/run.rb +0 -50
- data/examples/why_wiki/README +0 -5
- data/examples/why_wiki/run.rb +0 -59
- data/proto/public/js/ajax.js +0 -63
data/examples/tiny/run.rb
DELETED
data/examples/wee_style/README
DELETED
data/examples/wee_style/run.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# * George Moschovitis <gm@navel.gr>
|
2
|
-
# (c) 2004-2005 Navel, all rights reserved.
|
3
|
-
# $Id: run.rb 18 2005-04-15 09:17:08Z gmosx $
|
4
|
-
|
5
|
-
require 'nitro'
|
6
|
-
require 'nitro/adapters/webrick'
|
7
|
-
|
8
|
-
include Nitro
|
9
|
-
|
10
|
-
class Wee < Controller
|
11
|
-
|
12
|
-
def index
|
13
|
-
counter = session[:counter] || 0
|
14
|
-
|
15
|
-
o.html {
|
16
|
-
o.comment 'This is a comment!'
|
17
|
-
o.h1 'Hello world'
|
18
|
-
o.text 'This is '
|
19
|
-
o.b 'BOLD'
|
20
|
-
o.br.br
|
21
|
-
o.p 'Here comes some text'
|
22
|
-
o.br.br
|
23
|
-
o.p "Here is the counter: #{counter}"
|
24
|
-
o.p {
|
25
|
-
o.a('Increase', :href => :inc_counter).text(' the counter.')
|
26
|
-
}
|
27
|
-
o.p '<a href="reset_counter">Reset</a> the counter.'
|
28
|
-
o.hr
|
29
|
-
o.text 'Powered by Nitro.'
|
30
|
-
}
|
31
|
-
end
|
32
|
-
|
33
|
-
def inc_counter
|
34
|
-
session[:counter] ||= 0
|
35
|
-
session[:counter] += 1
|
36
|
-
end
|
37
|
-
|
38
|
-
def reset_counter
|
39
|
-
session[:counter] = 0
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
conf = {
|
45
|
-
:host => '127.0.0.1',
|
46
|
-
:port => 9999,
|
47
|
-
:dispatcher => Dispatcher.new(Wee)
|
48
|
-
}
|
49
|
-
|
50
|
-
Webrick.start(conf)
|
data/examples/why_wiki/README
DELETED
data/examples/why_wiki/run.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
# * George Moschovitis <gm@navel.gr>
|
2
|
-
# $Id: run.rb 18 2005-04-15 09:17:08Z gmosx $
|
3
|
-
|
4
|
-
require 'cgi'
|
5
|
-
require 'redcloth'
|
6
|
-
require 'yaml/store'
|
7
|
-
|
8
|
-
require 'nitro'
|
9
|
-
require 'nitro/adapters/webrick'
|
10
|
-
|
11
|
-
include Nitro
|
12
|
-
|
13
|
-
# A simple wiki. A straight conversion of the redhanded.hobix.com
|
14
|
-
# example. Original code by why the lucky stiff.
|
15
|
-
# This is just a cool example, not the preffered way to write
|
16
|
-
# Nitro applications.
|
17
|
-
|
18
|
-
WIKI = YAML::Store.new('wiki.yml')
|
19
|
-
|
20
|
-
class Wiki < Controller
|
21
|
-
|
22
|
-
def index
|
23
|
-
@p = 'Home'
|
24
|
-
show
|
25
|
-
end
|
26
|
-
|
27
|
-
def show
|
28
|
-
o.h1(@p)
|
29
|
-
o.a('Home', :href => '/') unless @p == 'Home'
|
30
|
-
WIKI.transaction do
|
31
|
-
if WIKI[@p]
|
32
|
-
o << RedCloth.new(WIKI[@p]).to_html.gsub(/([A-Z]\w+){2}/) { "<a href='/show/#$&'>#$&</a>" }
|
33
|
-
o.a 'Edit', :href => "/edit/#@p"
|
34
|
-
else
|
35
|
-
o.p("No page #{p}. ").a('Create?', :href => "/edit/#@p")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
action :show, :route => /show\/(.*)/, 'p' => String
|
40
|
-
|
41
|
-
def edit
|
42
|
-
if c = request['c']
|
43
|
-
WIKI.transaction { WIKI[@p] = c }
|
44
|
-
redirect "/show/#@p"
|
45
|
-
end
|
46
|
-
WIKI.transaction do
|
47
|
-
o.h1 "Editing #@p"
|
48
|
-
o.a('Show', :href => "/show/#@p").br.br
|
49
|
-
o.form(:method => 'post') {
|
50
|
-
o.input :type => 'hidden', :name => 'p', :value => @p
|
51
|
-
o.textarea WIKI[@p].to_s, :name => 'c', :style => 'width: 90%; height: 200px'
|
52
|
-
o.br.br.submit
|
53
|
-
}
|
54
|
-
end
|
55
|
-
end
|
56
|
-
action :edit, :route => /edit\/(.*)/, 'p' => String
|
57
|
-
end
|
58
|
-
|
59
|
-
Webrick.start(:dispatcher => Dispatcher.new(Wiki))
|
data/proto/public/js/ajax.js
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
|
2
|
-
function ajax_get(url) {
|
3
|
-
req = xml_http_request_object();
|
4
|
-
req.open("GET", url, false);
|
5
|
-
req.send(null);
|
6
|
-
return req.responseText;
|
7
|
-
}
|
8
|
-
|
9
|
-
function ajax_async_get(url, callback) {
|
10
|
-
req = xml_http_request_object();
|
11
|
-
req.open("GET", url, true);
|
12
|
-
|
13
|
-
req.onreadystatechange = function() {
|
14
|
-
if (req.readyState == 4 && req.status == 200) {
|
15
|
-
return callback(req.responseText);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
req.send(null);
|
20
|
-
}
|
21
|
-
|
22
|
-
function ajax_post(url) {
|
23
|
-
req = xml_http_request_object();
|
24
|
-
req.open("POST", url, false);
|
25
|
-
req.send(null);
|
26
|
-
return req.responseText;
|
27
|
-
}
|
28
|
-
|
29
|
-
function ajax_async_post(url, callback) {
|
30
|
-
req = xml_http_request_object();
|
31
|
-
req.open("POST", url, true);
|
32
|
-
|
33
|
-
req.onreadystatechange = function() {
|
34
|
-
if (req.readyState == 4 && req.status == 200) {
|
35
|
-
return callback(req.responseText);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
req.send(null);
|
40
|
-
}
|
41
|
-
|
42
|
-
function xml_http_request_object() {
|
43
|
-
var req = false;
|
44
|
-
try {
|
45
|
-
req = new ActiveXObject("Msxml2.XMLHTTP");
|
46
|
-
} catch (e) {
|
47
|
-
try {
|
48
|
-
req = new ActiveXObject("Microsoft.XMLHTTP");
|
49
|
-
} catch (e) {
|
50
|
-
try {
|
51
|
-
req = ActiveXObject("Msxml2.XMLHTTP.4.0");
|
52
|
-
} catch (e) {
|
53
|
-
req = false;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
if (!req && typeof XMLHttpRequest!='undefined') {
|
59
|
-
req = new XMLHttpRequest();
|
60
|
-
}
|
61
|
-
|
62
|
-
return req;
|
63
|
-
}
|