nitro 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +9 -1
- data/ChangeLog +107 -1
- data/README +1 -1
- data/RELEASES +14 -0
- data/Rakefile +73 -28
- data/bin/cluster.rb +2 -2
- data/examples/blog/app.rb +2 -2
- data/examples/blog/config.rb +14 -15
- data/examples/blog/lib/blog.rb +13 -20
- data/examples/blog/root/entry_form.xhtml +0 -1
- data/examples/blog/root/m/rss.gif +0 -0
- data/examples/blog/root/style.css +17 -0
- data/examples/blog/root/style.xsl +17 -5
- data/examples/blog/root/view_entry.xml +12 -0
- data/examples/og/run.rb +2 -3
- data/examples/tiny/config.rb +7 -8
- data/lib/glue.rb +52 -0
- data/lib/{nitro/utils → glue}/array.rb +2 -2
- data/lib/{nitro/utils → glue}/cache.rb +2 -2
- data/lib/{nitro/utils → glue}/hash.rb +2 -2
- data/lib/glue/inflector.rb +91 -0
- data/lib/{nitro → glue}/logger.rb +1 -1
- data/lib/{nitro/macros.rb → glue/macro.rb} +1 -1
- data/lib/{nitro → glue}/mixins.rb +3 -4
- data/lib/{nitro/utils → glue}/number.rb +3 -3
- data/lib/{nitro/utils → glue}/pool.rb +2 -2
- data/lib/{nitro/properties.rb → glue/property.rb} +8 -8
- data/lib/{nitro/utils → glue}/string.rb +3 -2
- data/lib/{nitro/utils → glue}/time.rb +3 -3
- data/lib/nitro.rb +2 -43
- data/lib/nitro/application.rb +2 -2
- data/lib/nitro/builders/rss.rb +43 -0
- data/lib/nitro/config.rb +13 -4
- data/lib/nitro/{utils/html.rb → html.rb} +2 -2
- data/lib/nitro/{utils/http.rb → http.rb} +1 -1
- data/lib/nitro/{utils/mail.rb → mail.rb} +1 -1
- data/lib/nitro/scaffold.rb +80 -0
- data/lib/nitro/server/appserver.rb +2 -2
- data/lib/nitro/server/cluster.rb +2 -2
- data/lib/nitro/server/dispatcher.rb +2 -5
- data/lib/nitro/server/filters/autologin.rb +2 -2
- data/lib/nitro/server/fragment.rb +5 -5
- data/lib/nitro/server/handlers.rb +3 -3
- data/lib/nitro/server/render.rb +145 -22
- data/lib/nitro/server/request.rb +7 -7
- data/lib/nitro/server/requestpart.rb +4 -4
- data/lib/nitro/server/script.rb +4 -4
- data/lib/nitro/server/server.rb +2 -2
- data/lib/nitro/server/session.rb +4 -4
- data/lib/nitro/server/webrick.rb +2 -2
- data/lib/nitro/service.rb +2 -1
- data/lib/nitro/sitemap.rb +3 -3
- data/lib/nitro/{utils/uri.rb → uri.rb} +3 -3
- data/lib/nitro/version.rb +2 -2
- data/lib/og.rb +8 -8
- data/lib/og/backends/mysql.rb +16 -12
- data/lib/og/backends/psql.rb +6 -2
- data/lib/og/connection.rb +4 -4
- data/lib/og/meta.rb +7 -1
- data/lib/og/version.rb +8 -0
- data/lib/xsl/base.xsl +10 -0
- data/test/{n/utils → glue}/tc_cache.rb +3 -3
- data/test/{n/utils → glue}/tc_hash.rb +2 -3
- data/test/{n/utils/tc_number.rb → glue/tc_numbers.rb} +3 -4
- data/test/{n → glue}/tc_properties.rb +2 -2
- data/test/glue/tc_strings.rb +103 -0
- data/test/{n → nitro}/server/tc_cookie.rb +0 -0
- data/test/{n → nitro}/server/tc_filters.rb +0 -0
- data/test/{n → nitro}/server/tc_request.rb +1 -1
- data/test/{n → nitro}/server/tc_requestpart.rb +0 -0
- data/test/{n → nitro}/server/tc_session.rb +0 -0
- data/test/{n → nitro}/tc_events.rb +0 -0
- data/test/{n/utils → nitro}/tc_html.rb +1 -1
- data/test/{n/utils → nitro}/tc_http.rb +1 -1
- data/test/{n → nitro}/tc_sitemap.rb +1 -1
- data/test/{n/utils → nitro}/tc_uri.rb +1 -1
- data/test/{n → nitro}/ui/tc_pager.rb +1 -1
- data/test/{n/tc_og.rb → tc_og.rb} +5 -2
- metadata +48 -44
- data/examples/blog/log/app.log +0 -117
- data/examples/tiny/log/app.log +0 -23
- data/lib/nitro/utils/gfx.rb +0 -107
- data/lib/nitro/utils/template.rb +0 -36
- data/test/n/utils/tc_strings.rb +0 -104
data/examples/tiny/log/app.log
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Logfile created on Sat Nov 13 20:02:50 EET 2004 by logger.rb/1.5.2.4
|
|
2
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
3
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
4
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
5
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
6
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
7
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
8
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
9
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
10
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
11
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
12
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
13
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
14
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
15
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
16
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
17
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
18
|
-
I: Web Server listening at http://127.0.0.1:8080
|
|
19
|
-
I: App Server listening at http://127.0.0.1:9090
|
|
20
|
-
INFO: Web Server listening at http://127.0.0.1:8080
|
|
21
|
-
INFO: App Server listening at http://127.0.0.1:9090
|
|
22
|
-
INFO: Web Server listening at http://127.0.0.1:8080
|
|
23
|
-
INFO: App Server listening at http://127.0.0.1:9090
|
data/lib/nitro/utils/gfx.rb
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# code:
|
|
2
|
-
# * George Moschovitis <gm@navel.gr>
|
|
3
|
-
# * Elias Athanasopoulos <elathan@navel.gr>
|
|
4
|
-
#
|
|
5
|
-
# (c) 2004 Navel, all rights reserved.
|
|
6
|
-
# $Id: gfx.rb 152 2004-11-13 20:02:35Z gmosx $
|
|
7
|
-
|
|
8
|
-
module N
|
|
9
|
-
|
|
10
|
-
# = GfxUtils
|
|
11
|
-
#
|
|
12
|
-
# General graphics utilities collection.
|
|
13
|
-
#
|
|
14
|
-
# === Design:
|
|
15
|
-
#
|
|
16
|
-
# A simple wrapper around ImageMagick.
|
|
17
|
-
#
|
|
18
|
-
# Implement as a module to avoid class polution. You can
|
|
19
|
-
# still Ruby's advanced features to include the module in your
|
|
20
|
-
# class. Passing the object to act upon allows to check for nil,
|
|
21
|
-
# which isn't possible if you use self.
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
module GfxUtils
|
|
25
|
-
|
|
26
|
-
# === Input:
|
|
27
|
-
# width, height = dimensions for the scaled image.
|
|
28
|
-
#
|
|
29
|
-
def self.create_thumbnail(src, dest, width, height)
|
|
30
|
-
# gmosx: [0] selects the 1st frame in case of animated gifs.
|
|
31
|
-
# gmosx: SOS!!! the +profile "*" is need to strip metadata that
|
|
32
|
-
# fuckup the internet explorer!
|
|
33
|
-
if (dest =~ /jpg$/i) or (File.stat(src).size > 60000)
|
|
34
|
-
# keep only the first frame
|
|
35
|
-
system %|convert +profile "*" +compress -scale '#{width}x#{height}>' -antialias #{src}[0] #{dest}|
|
|
36
|
-
else
|
|
37
|
-
system %|convert +profile "*" +compress -scale '#{width}x#{height}>' -antialias #{src} #{dest}|
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# Use ImageMagick to grab the EXIF data
|
|
42
|
-
# contained in a jpeg file and store it to a
|
|
43
|
-
# hash: EXIF field => EXIF value.
|
|
44
|
-
#
|
|
45
|
-
# A sample EXIF table:
|
|
46
|
-
#
|
|
47
|
-
# Make=Canon
|
|
48
|
-
# Model=Canon PowerShot S110
|
|
49
|
-
# Orientation=1
|
|
50
|
-
# X Resolution=180/1
|
|
51
|
-
# YResolution=180/1
|
|
52
|
-
# ResolutionUnit=2
|
|
53
|
-
# DateTime=2002:05:16 21:02:36
|
|
54
|
-
# YCbCrPositioning=1
|
|
55
|
-
# ExifOffset=196
|
|
56
|
-
# ExposureTime=1/80
|
|
57
|
-
# FNumber=28/10
|
|
58
|
-
# ExifVersion=0210
|
|
59
|
-
# DateTimeOriginal=2002:05:16 21:02:36
|
|
60
|
-
# DateTimeDigitized=2002:05:16 21:02:36
|
|
61
|
-
# ComponentsConfiguration=...
|
|
62
|
-
# CompressedBitsPerPixel=3/1
|
|
63
|
-
# ShutterSpeedValue=202/32
|
|
64
|
-
# ApertureValue=95/32
|
|
65
|
-
# ExposureBiasValue=0/3
|
|
66
|
-
# MaxApertureValue=194698/65536
|
|
67
|
-
# SubjectDistance=772/1000
|
|
68
|
-
# MeteringMode=5
|
|
69
|
-
# Flash=1
|
|
70
|
-
# FocalLength=173/32
|
|
71
|
-
# MakerNote=.
|
|
72
|
-
# UserComment=
|
|
73
|
-
# FlashPixVersion=0100
|
|
74
|
-
# ColorSpace=1
|
|
75
|
-
# ExifImageWidth=1600
|
|
76
|
-
# ExifImageLength=1200
|
|
77
|
-
# InteroperabilityOffset=1328
|
|
78
|
-
# unknown=R98
|
|
79
|
-
# unknown=0100
|
|
80
|
-
# unknown=1600
|
|
81
|
-
# unknown=1200
|
|
82
|
-
# FocalPlaneXResolution=1600000/206
|
|
83
|
-
# FocalPlaneYResolution=1200000/155
|
|
84
|
-
# FocalPlaneResolutionUnit=2
|
|
85
|
-
# SensingMethod=2
|
|
86
|
-
# FileSource=.
|
|
87
|
-
#
|
|
88
|
-
def self.grab_exif(path)
|
|
89
|
-
info = %x|identify -format "%[EXIF:*]" #{path}|.split("\n")
|
|
90
|
-
|
|
91
|
-
exif = {}
|
|
92
|
-
info.each { |l|
|
|
93
|
-
tag, value = l.split("=")
|
|
94
|
-
exif[tag] = value
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
unless exif.empty?
|
|
98
|
-
return exif
|
|
99
|
-
else
|
|
100
|
-
return nil
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
end # module
|
|
107
|
-
|
data/lib/nitro/utils/template.rb
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# code:
|
|
2
|
-
# * George Moschovitis <gm@navel.gr>
|
|
3
|
-
#
|
|
4
|
-
# (c) 2004 Navel, all rights reserved.
|
|
5
|
-
# $Id$
|
|
6
|
-
|
|
7
|
-
module N;
|
|
8
|
-
|
|
9
|
-
# = Template
|
|
10
|
-
#
|
|
11
|
-
# A simple templating mechanism.
|
|
12
|
-
#
|
|
13
|
-
class Template
|
|
14
|
-
attr_accessor :body
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
def initialize(filename)
|
|
19
|
-
@body = File.read(filename)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
# Apply the substitutions to the template.
|
|
23
|
-
#
|
|
24
|
-
def gsub(hash)
|
|
25
|
-
res = body.dup()
|
|
26
|
-
|
|
27
|
-
hash.each {|k, v|
|
|
28
|
-
res.gsub!(k, v)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return res
|
|
32
|
-
end
|
|
33
|
-
alias_method :render, :gsub
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
end # module
|
data/test/n/utils/tc_strings.rb
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# :nodoc: all
|
|
2
|
-
|
|
3
|
-
require "test/unit"
|
|
4
|
-
require "nitro/utils/string"
|
|
5
|
-
|
|
6
|
-
class TC_StringUtilsUtils < Test::Unit::TestCase
|
|
7
|
-
# :nodoc: all
|
|
8
|
-
include N
|
|
9
|
-
|
|
10
|
-
def setup
|
|
11
|
-
@s = "this is any cool test"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def test_valid?
|
|
15
|
-
assert_equal(true, StringUtils.valid?("test"))
|
|
16
|
-
assert_equal(false, StringUtils.valid?(""))
|
|
17
|
-
assert_equal(false, StringUtils.valid?(nil))
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def test_head
|
|
21
|
-
assert_equal(nil, StringUtils.head(nil))
|
|
22
|
-
assert_equal("this...", StringUtils.head(@s, 3))
|
|
23
|
-
assert_equal("this+++", StringUtils.head(@s, 3, false, "+++"))
|
|
24
|
-
assert_equal("thi...", StringUtils.head(@s, 3, true))
|
|
25
|
-
assert_equal("this is...", StringUtils.head(@s, 8))
|
|
26
|
-
assert_equal(nil, StringUtils.head(@s, 0))
|
|
27
|
-
assert_equal(nil, StringUtils.head(@s, 0, true))
|
|
28
|
-
assert_equal("this is...", StringUtils.head(@s, 8, true))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_rewrite
|
|
32
|
-
rules = [
|
|
33
|
-
[/\/\$/, "../n1"],
|
|
34
|
-
[/\$/, "../n1"],
|
|
35
|
-
[/^games/, "../../games"],
|
|
36
|
-
[/^tmp/, "/n/theseas/var/tmp"],
|
|
37
|
-
]
|
|
38
|
-
string = StringUtils.rewrite("games/arkanoid.html", rules)
|
|
39
|
-
assert_equal("../../games/arkanoid.html", string)
|
|
40
|
-
string = StringUtils.rewrite("tmp/garbage.html", rules)
|
|
41
|
-
assert_equal("/n/theseas/var/tmp/garbage.html", string)
|
|
42
|
-
string = StringUtils.rewrite("root/index.html", rules)
|
|
43
|
-
assert_equal("root/index.html", string)
|
|
44
|
-
assert_equal(nil, StringUtils.rewrite(nil, rules))
|
|
45
|
-
assert_equal("", StringUtils.rewrite("", rules))
|
|
46
|
-
|
|
47
|
-
assert_raises(ArgumentError) {
|
|
48
|
-
assert_equal("koko", StringUtils.rewrite("koko", nil))
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
# bug: should keep order
|
|
52
|
-
s = StringUtils.rewrite("/$/koko.html", rules)
|
|
53
|
-
assert_equal("../n1/koko.html", s)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def test_wrap
|
|
57
|
-
s = "1234567890abcdefghijklmnopqrstu"
|
|
58
|
-
r = "1234 5678 90ab cdef ghij klmn opqr stu"
|
|
59
|
-
assert_equal(r, StringUtils::wrap(s, 4, " "))
|
|
60
|
-
|
|
61
|
-
s = "111111111111111111111111111111111111111111111111"
|
|
62
|
-
r = "1111111111 1111111111 1111111111 1111111111 11111111"
|
|
63
|
-
assert_equal(r, StringUtils::wrap(s, 10, " "))
|
|
64
|
-
|
|
65
|
-
s = "jackdaws love my big sphinx of quartz"
|
|
66
|
-
r = "jackdaws love my big sphinx of quartz"
|
|
67
|
-
assert_equal(r, StringUtils::wrap(s, 10, " "))
|
|
68
|
-
|
|
69
|
-
s = "jackdaws love my big sphinx of quartz"
|
|
70
|
-
r = "jack daws love my big sphi nx of quar tz"
|
|
71
|
-
assert_equal(r, StringUtils::wrap(s, 4, " "))
|
|
72
|
-
|
|
73
|
-
s = "jack.daws love my big sphinx of quartz"
|
|
74
|
-
r = "jack .daw s love my big sphi nx of quar tz"
|
|
75
|
-
assert_equal(r, StringUtils::wrap(s, 4, " "))
|
|
76
|
-
|
|
77
|
-
assert_equal("", StringUtils::wrap("", 4, " "))
|
|
78
|
-
assert_equal(nil, StringUtils::wrap(nil, 4, " "))
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def test_rationalize_filename
|
|
82
|
-
filename = StringUtils.rationalize_filename("hello my friend!.gif")
|
|
83
|
-
assert_equal("hello-my-friend.gif", filename)
|
|
84
|
-
filename = StringUtils.rationalize_filename("���� ����.gif")
|
|
85
|
-
assert_equal("pame-pali.gif", filename)
|
|
86
|
-
filename = StringUtils.rationalize_filename("�� ���.gif")
|
|
87
|
-
assert_equal("ti-les.gif", filename)
|
|
88
|
-
|
|
89
|
-
# bug:
|
|
90
|
-
filename = StringUtils.rationalize_filename("image-(10).gif")
|
|
91
|
-
assert_equal("image-10.gif", filename)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def test_random_string
|
|
95
|
-
s1 = StringUtils.random()
|
|
96
|
-
s2 = StringUtils.random()
|
|
97
|
-
assert_not_equal(s1, s2)
|
|
98
|
-
assert(s1.size == s2.size)
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def teardown
|
|
102
|
-
@s = nil
|
|
103
|
-
end
|
|
104
|
-
end
|