nitro 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +3 -0
- data/ChangeLog +83 -0
- data/LICENCE +8 -8
- data/README +5 -1
- data/RELEASES +9 -0
- data/Rakefile +43 -23
- data/bin/cluster.rb +15 -12
- data/examples/ndb/README +5 -0
- data/examples/ndb/run.rb +271 -0
- data/examples/simple/README +27 -0
- data/examples/simple/app.rb +2 -2
- data/examples/simple/conf/config.rb +3 -8
- data/examples/simple/conf/debug-config.rb +6 -7
- data/examples/simple/conf/live-config.rb +2 -4
- data/examples/simple/conf/requires.rb +2 -10
- data/examples/simple/ctl +1 -1
- data/examples/simple/env.rb +2 -2
- data/examples/simple/root/article-form.ss +1 -1
- data/examples/simple/root/comments-form.ss +1 -1
- data/examples/tiny/README +15 -0
- data/examples/tiny/app.rb +2 -2
- data/examples/tiny/conf/config.rb +8 -13
- data/examples/tiny/conf/requires.rb +2 -8
- data/examples/tiny/ctl +2 -17
- data/examples/tiny/root/index.sx +1 -1
- data/lib/n/app/cluster.rb +15 -12
- data/lib/n/app/cookie.rb +10 -9
- data/lib/n/app/filters/autologin.rb +5 -4
- data/lib/n/app/fragment.rb +13 -10
- data/lib/n/app/handlers.rb +29 -22
- data/lib/n/app/handlers/code-handler.rb +2 -4
- data/lib/n/app/handlers/page-handler.rb +3 -5
- data/lib/n/app/request-part.rb +2 -7
- data/lib/n/app/request.rb +27 -22
- data/lib/n/app/script.rb +4 -15
- data/lib/n/app/server.rb +11 -7
- data/lib/n/app/session.rb +7 -11
- data/lib/n/app/user.rb +10 -11
- data/lib/n/app/webrick-servlet.rb +23 -10
- data/lib/n/app/webrick.rb +13 -10
- data/lib/n/application.rb +13 -6
- data/lib/n/config.rb +18 -7
- data/lib/n/db.rb +56 -40
- data/lib/n/db/connection.rb +18 -22
- data/lib/n/db/managed.rb +6 -8
- data/lib/n/db/mixins.rb +4 -7
- data/lib/n/db/mysql.rb +6 -3
- data/lib/n/db/psql.rb +15 -10
- data/lib/n/db/tools.rb +5 -9
- data/lib/n/db/utils.rb +11 -8
- data/lib/n/events.rb +14 -10
- data/lib/n/logger.rb +8 -2
- data/lib/n/macros.rb +5 -2
- data/lib/n/parts.rb +13 -10
- data/lib/n/properties.rb +17 -12
- data/lib/n/server.rb +3 -2
- data/lib/n/server/filter.rb +2 -4
- data/lib/n/shaders.rb +11 -13
- data/lib/n/sitemap.rb +23 -20
- data/lib/n/std.rb +15 -4
- data/lib/n/sync/clc.rb +4 -2
- data/lib/n/sync/handler.rb +20 -12
- data/lib/n/sync/server.rb +24 -18
- data/lib/n/ui/date-select.rb +2 -4
- data/lib/n/ui/pager.rb +10 -8
- data/lib/n/ui/popup.rb +5 -4
- data/lib/n/ui/select.rb +3 -4
- data/lib/n/ui/tabs.rb +3 -4
- data/lib/n/utils/array.rb +6 -14
- data/lib/n/utils/cache.rb +3 -7
- data/lib/n/utils/gfx.rb +5 -6
- data/lib/n/utils/hash.rb +7 -12
- data/lib/n/utils/html.rb +8 -4
- data/lib/n/utils/http.rb +10 -6
- data/lib/n/utils/mail.rb +6 -6
- data/lib/n/utils/number.rb +3 -4
- data/lib/n/utils/pool.rb +5 -8
- data/lib/n/utils/string.rb +12 -10
- data/lib/n/utils/template.rb +3 -5
- data/lib/n/utils/time.rb +7 -5
- data/lib/n/utils/uri.rb +5 -4
- data/lib/p/README +1 -0
- data/lib/xsl/xforms.xsl +2 -0
- data/test/n/app/tc_cookie.rb +34 -0
- data/test/n/app/tc_request.rb +70 -0
- data/test/n/app/tc_requestpart.rb +28 -0
- data/test/n/app/tc_session.rb +34 -0
- data/test/n/tc_db.rb +223 -0
- data/test/n/tc_db_mysql.rb +241 -0
- data/test/n/tc_events.rb +44 -0
- data/test/n/tc_properties.rb +68 -0
- data/test/n/tc_sitemap.rb +37 -0
- data/test/n/ui/tc_pager.rb +52 -0
- data/test/n/utils/tc_cache.rb +47 -0
- data/test/n/utils/tc_hash.rb +39 -0
- data/test/n/utils/tc_html.rb +79 -0
- data/test/n/utils/tc_http.rb +18 -0
- data/test/n/utils/tc_number.rb +21 -0
- data/test/n/utils/tc_strings.rb +149 -0
- data/test/n/utils/tc_uri.rb +100 -0
- metadata +49 -22
- data/doc/css.txt +0 -20
- data/doc/ideas.txt +0 -120
- data/doc/pg.txt +0 -47
- data/doc/svn.txt +0 -82
- data/doc/todo.txt +0 -30
- data/examples/simple/conf/overrides.rb +0 -9
- data/examples/simple/logs/access_log +0 -2
- data/examples/simple/logs/apache.log +0 -3
- data/examples/simple/logs/app.log +0 -1
- data/examples/simple/logs/events.log +0 -1
- data/examples/tiny/conf/apache.conf +0 -100
- data/examples/tiny/logs/access_log +0 -9
- data/examples/tiny/logs/apache.log +0 -9
- data/lib/n/db/make-release.sh +0 -26
- data/lib/n/tools/README +0 -11
- data/lib/xsl/ce.xsl +0 -30
- data/lib/xsl/localization.xsl +0 -23
- data/test/run.rb +0 -95
@@ -0,0 +1,39 @@
|
|
1
|
+
# :nodoc: all
|
2
|
+
|
3
|
+
require "test/unit"
|
4
|
+
require "n/utils/cache"
|
5
|
+
|
6
|
+
class TC_N2_Utils_Cache < Test::Unit::TestCase
|
7
|
+
# :nodoc: all
|
8
|
+
include N
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@safe_cache = SafeHash.new(Hash.new)
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
@safe_cache = nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_safe_cache
|
19
|
+
assert_equal(nil, @safe_cache["no_item"])
|
20
|
+
item1 = "item1"
|
21
|
+
@safe_cache["key1"] = item1
|
22
|
+
assert_equal(item1, @safe_cache["key1"])
|
23
|
+
|
24
|
+
@safe_cache["rem1"] = item1
|
25
|
+
@safe_cache.delete("rem1")
|
26
|
+
assert_equal(nil, @safe_cache["rem1"])
|
27
|
+
|
28
|
+
@safe_cache.clear()
|
29
|
+
assert_equal(0, @safe_cache.size)
|
30
|
+
|
31
|
+
@safe_cache["i1"] = "i1"
|
32
|
+
@safe_cache["i2"] = "i1"
|
33
|
+
@safe_cache["i3"] = "i1"
|
34
|
+
assert_equal(3, @safe_cache.size)
|
35
|
+
|
36
|
+
assert_equal(3, @safe_cache.values.size)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
|
2
|
+
require "test/unit"
|
3
|
+
require "n/utils/html"
|
4
|
+
|
5
|
+
include N
|
6
|
+
|
7
|
+
class TC_HtmlUtils < Test::Unit::TestCase
|
8
|
+
# :nodoc: all
|
9
|
+
|
10
|
+
def test_escape
|
11
|
+
assert_equal("<b>test</b>", HtmlUtils::escape("<b>test</b>"))
|
12
|
+
assert_equal("<p>test", HtmlUtils::escape("<p>test"))
|
13
|
+
assert_equal("", HtmlUtils::escape(""))
|
14
|
+
assert_equal(nil, HtmlUtils::escape(nil))
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_expand_urls
|
18
|
+
s = "visit http://www.navel.gr"
|
19
|
+
r = "visit <a href='http://www.navel.gr'>http://www.navel.gr</a>"
|
20
|
+
assert_equal(r, HtmlUtils::expand_urls(s))
|
21
|
+
|
22
|
+
s = "visit www.navel.gr"
|
23
|
+
r = "visit <a href='http://www.navel.gr'>http://www.navel.gr</a>"
|
24
|
+
assert_equal(r, HtmlUtils::expand_urls(s))
|
25
|
+
|
26
|
+
assert_equal(nil, HtmlUtils::expand_urls(nil))
|
27
|
+
|
28
|
+
s = "visit: www.navel.gr"
|
29
|
+
r = "visit: <a href='http://www.navel.gr'>http://www.navel.gr</a>"
|
30
|
+
assert_equal(r, HtmlUtils::expand_urls(s))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_only_safe_tags
|
34
|
+
s = "<table>lala</table>"
|
35
|
+
r = "<table>lala</table>"
|
36
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
37
|
+
|
38
|
+
# bug: img is NOT A SAFE tag, fucks up layout
|
39
|
+
s = "<a href='lala'<img src='koko'><table>"
|
40
|
+
# lala is quoted because it belongs in an open tag!
|
41
|
+
r = "<a href='lala'><img src='koko'><table>"
|
42
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
43
|
+
|
44
|
+
s = "<a href='lala'><img src='koko'><table>"
|
45
|
+
# lala is not quoted because it belongs in a valid tag!
|
46
|
+
r = "<a href='lala'><img src='koko'><table>"
|
47
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
48
|
+
|
49
|
+
s = "<a href='lala'<table<bar<koko"
|
50
|
+
# lala is quoted because it belongs in an open tag!
|
51
|
+
r = "<a href='lala'><table><bar><koko"
|
52
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
53
|
+
|
54
|
+
s = "<a href='lala'<foo>text<bar<koko"
|
55
|
+
# lala is quoted because it belongs in an open tag!
|
56
|
+
r = "<a href='lala'><foo>text<bar><koko"
|
57
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
58
|
+
|
59
|
+
# bug: open ' quotes fuckup the html
|
60
|
+
s = "<tr><td><a href='koko</td></tr>"
|
61
|
+
r = "<tr><td><a href='koko></td></tr>"
|
62
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
63
|
+
|
64
|
+
# open quotes on valid tag
|
65
|
+
s = "<a href='koko>kokok</a>"
|
66
|
+
r = "<a href='koko>kokok</a>"
|
67
|
+
assert_equal(r, HtmlUtils::only_safe_tags(s))
|
68
|
+
|
69
|
+
assert_equal(nil, HtmlUtils::only_safe_tags(nil))
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_convert_newlines
|
73
|
+
# bug:
|
74
|
+
|
75
|
+
assert_equal(nil, HtmlUtils::convert_newlines(nil))
|
76
|
+
assert_equal(nil, HtmlUtils::convert_newlines(""))
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "n/utils/http"
|
3
|
+
|
4
|
+
class TC_HttpUtils < Test::Unit::TestCase
|
5
|
+
# :nodoc: all
|
6
|
+
|
7
|
+
def setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_time_to_string
|
14
|
+
r = N::HttpUtils.time_to_string(Time.now)
|
15
|
+
assert_match(/GMT/, r)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# :nodoc: all
|
2
|
+
|
3
|
+
require "test/unit"
|
4
|
+
require "n/utils/number"
|
5
|
+
|
6
|
+
class TC_N_NumberUtils < Test::Unit::TestCase
|
7
|
+
# :nodoc: all
|
8
|
+
include N
|
9
|
+
|
10
|
+
def setup
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_ceil_multiple
|
17
|
+
assert_equal(20, NumberUtils.ceil_multiple(15, 10))
|
18
|
+
assert_equal(10, NumberUtils.ceil_multiple(1, 10))
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# :nodoc: all
|
2
|
+
|
3
|
+
require "test/unit"
|
4
|
+
require "n/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_extension_from_path
|
82
|
+
assert_equal(nil, StringUtils.extension_from_path(nil))
|
83
|
+
assert_equal(nil, StringUtils.extension_from_path("this is a dymy text!"))
|
84
|
+
assert_equal("gif", StringUtils.extension_from_path("gmosx.gif"))
|
85
|
+
assert_equal("gif", StringUtils.extension_from_path("/n/images/gmosx.gif"))
|
86
|
+
assert_equal(nil, StringUtils.extension_from_path("/n/images/gmosx."))
|
87
|
+
assert_equal("rx", StringUtils.extension_from_path("/n/images/gmosx.gif.rx"))
|
88
|
+
assert_equal("rx", StringUtils.extension_from_path("*parts/polls/poll-box.rx"))
|
89
|
+
assert_equal("rx", StringUtils.extension_from_path("../n1/web/parts/polls/poll-box.rx"))
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_filename_from_path
|
93
|
+
assert_equal("gmosx", StringUtils.filename_from_path("gmosx.gif"))
|
94
|
+
filename = StringUtils.filename_from_path("/n/images/gmosx.gif")
|
95
|
+
assert_equal("/n/images/gmosx", filename)
|
96
|
+
filename = StringUtils.filename_from_path(nil)
|
97
|
+
assert_equal("", filename)
|
98
|
+
filename = StringUtils.filename_from_path("/n/images/gmosx")
|
99
|
+
assert_equal("/n/images/gmosx", filename)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_file_from_path
|
103
|
+
file = StringUtils.file_from_path("/n/images/gmosx.gif")
|
104
|
+
assert_equal("gmosx.gif", file)
|
105
|
+
file = StringUtils.file_from_path(nil)
|
106
|
+
assert_equal("", file)
|
107
|
+
file = StringUtils.file_from_path("/n/images/gmosx")
|
108
|
+
assert_equal("gmosx", file)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_directory_from_path
|
112
|
+
directory = StringUtils.directory_from_path("/n/images/gmosx.gif")
|
113
|
+
assert_equal("/n/images", directory)
|
114
|
+
directory = StringUtils.directory_from_path(nil)
|
115
|
+
assert_equal("", directory)
|
116
|
+
directory = StringUtils.directory_from_path("/n/images/gmosx")
|
117
|
+
assert_equal("/n/images", directory)
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_rationalize_filename
|
121
|
+
filename = StringUtils.rationalize_filename("hello my friend!.gif")
|
122
|
+
assert_equal("hello-my-friend.gif", filename)
|
123
|
+
filename = StringUtils.rationalize_filename("���� ����.gif")
|
124
|
+
assert_equal("pame-pali.gif", filename)
|
125
|
+
filename = StringUtils.rationalize_filename("�� ���.gif")
|
126
|
+
assert_equal("ti-les.gif", filename)
|
127
|
+
|
128
|
+
# bug:
|
129
|
+
filename = StringUtils.rationalize_filename("image-(10).gif")
|
130
|
+
assert_equal("image-10.gif", filename)
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_random_string
|
134
|
+
s1 = StringUtils.random()
|
135
|
+
s2 = StringUtils.random()
|
136
|
+
assert_not_equal(s1, s2)
|
137
|
+
assert(s1.size == s2.size)
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_unicode_to_iso88597
|
141
|
+
# check that dup works.
|
142
|
+
s = "Original"
|
143
|
+
assert_equal("Original", StringUtils.unicode_to_iso88597(s))
|
144
|
+
end
|
145
|
+
|
146
|
+
def teardown
|
147
|
+
@s = nil
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "n/utils/uri"
|
3
|
+
|
4
|
+
include N
|
5
|
+
|
6
|
+
class Dummy
|
7
|
+
# :nodoc: all
|
8
|
+
attr_accessor :test1, :test2
|
9
|
+
end
|
10
|
+
|
11
|
+
class TC_Uri < Test::Unit::TestCase
|
12
|
+
# :nodoc: all
|
13
|
+
|
14
|
+
def test_query_string_to_hash
|
15
|
+
# bad query string
|
16
|
+
|
17
|
+
assert_equal(0, UriUtils.query_string_to_hash("").length)
|
18
|
+
assert_equal(0, UriUtils.query_string_to_hash(nil).length)
|
19
|
+
|
20
|
+
# single valued
|
21
|
+
|
22
|
+
parameters = UriUtils.query_string_to_hash("koko=2&lala=3")
|
23
|
+
assert_equal("2", parameters["koko"])
|
24
|
+
assert_equal("3", parameters["lala"])
|
25
|
+
|
26
|
+
parameters = UriUtils.query_string_to_hash("koko=2;lala=3")
|
27
|
+
assert_equal("2", parameters["koko"])
|
28
|
+
assert_equal("3", parameters["lala"])
|
29
|
+
|
30
|
+
# multivalued
|
31
|
+
|
32
|
+
parameters = UriUtils.query_string_to_hash("koko=2;lala=3&koko=5")
|
33
|
+
assert_equal(2, parameters["koko"].length)
|
34
|
+
assert_equal("2", parameters["koko"][0])
|
35
|
+
assert_equal("3", parameters["lala"])
|
36
|
+
assert_equal("5", parameters["koko"][1])
|
37
|
+
|
38
|
+
# non existing value
|
39
|
+
assert_equal(nil, parameters["non-existing-value"])
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_hash_to_query_string
|
43
|
+
hash = { "koko" => 1, "lala" => 2}
|
44
|
+
qs = "koko=1;lala=2"
|
45
|
+
assert_equal(qs, UriUtils.hash_to_query_string(hash))
|
46
|
+
|
47
|
+
assert_equal(nil, UriUtils.hash_to_query_string(nil))
|
48
|
+
|
49
|
+
# bug: dont encode complex objects
|
50
|
+
hash = { "a" => 2, "b" => 3, "c" => Dummy.new }
|
51
|
+
qs = "a=2;b=3"
|
52
|
+
assert_equal(qs, UriUtils.hash_to_query_string(hash))
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_get_query_string
|
56
|
+
uri = "people/gmosx.sx?koko=1;lala=2"
|
57
|
+
assert_equal("koko=1;lala=2", UriUtils.get_query_string(uri))
|
58
|
+
|
59
|
+
uri = "http://www.navel.gr/people/gmosx.sx?koko=1&lala=2"
|
60
|
+
assert_equal("koko=1&lala=2", UriUtils.get_query_string(uri))
|
61
|
+
|
62
|
+
uri = "http://www.navel.gr:8080/people/gmosx.sx?koko=1;lala=2"
|
63
|
+
assert_equal("koko=1;lala=2", UriUtils.get_query_string(uri))
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_chomp_query_string
|
67
|
+
uri = "people/gmosx.sx"
|
68
|
+
assert_equal("people/gmosx.sx", UriUtils.chomp_query_string(uri))
|
69
|
+
|
70
|
+
uri = "people/gmosx.sx?koko=1;lala=2"
|
71
|
+
assert_equal("people/gmosx.sx", UriUtils.chomp_query_string(uri))
|
72
|
+
|
73
|
+
uri = "http://www.navel.gr/people/gmosx.sx?koko=1&lala=2"
|
74
|
+
assert_equal("http://www.navel.gr/people/gmosx.sx", UriUtils.chomp_query_string(uri))
|
75
|
+
|
76
|
+
uri = "http://www.navel.gr:8080/people/gmosx.sx?koko=1;lala=2"
|
77
|
+
assert_equal("http://www.navel.gr:8080/people/gmosx.sx", UriUtils.chomp_query_string(uri))
|
78
|
+
|
79
|
+
assert_equal(nil, UriUtils.chomp_query_string(nil))
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_update_query_string
|
83
|
+
uri = "ko/index.sx?koko=1"
|
84
|
+
hash = {"lala" => 2, "kaka" => 3}
|
85
|
+
assert_equal("ko/index.sx?koko=1;lala=2;kaka=3", UriUtils.update_query_string(uri, hash))
|
86
|
+
|
87
|
+
uri = "http://www.navel.gr:8080/ko/index.sx?koko=1"
|
88
|
+
hash = {"lala" => 2, "kaka" => 3}
|
89
|
+
assert_equal("http://www.navel.gr:8080/ko/index.sx?koko=1;lala=2;kaka=3", UriUtils.update_query_string(uri, hash))
|
90
|
+
|
91
|
+
uri = "http://www.navel.gr"
|
92
|
+
hash = {"lala" => 2, "kaka" => 3}
|
93
|
+
assert_equal("http://www.navel.gr?lala=2;kaka=3", UriUtils.update_query_string(uri, hash))
|
94
|
+
|
95
|
+
# bug: no ? when passed an empty hash
|
96
|
+
uri = "http://www.navel.gr"
|
97
|
+
assert_equal("http://www.navel.gr", UriUtils.update_query_string(uri, {}))
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: nitro
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2004-10-
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2004-10-25
|
8
8
|
summary: Web Engine
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -36,16 +36,15 @@ files:
|
|
36
36
|
- etc/new-project.rb
|
37
37
|
- examples/tiny
|
38
38
|
- examples/simple
|
39
|
+
- examples/ndb
|
39
40
|
- examples/tiny/conf
|
40
41
|
- examples/tiny/app.rb
|
41
42
|
- examples/tiny/logs
|
42
43
|
- examples/tiny/root
|
44
|
+
- examples/tiny/README
|
43
45
|
- examples/tiny/ctl
|
44
46
|
- examples/tiny/conf/requires.rb
|
45
|
-
- examples/tiny/conf/apache.conf
|
46
47
|
- examples/tiny/conf/config.rb
|
47
|
-
- examples/tiny/logs/apache.log
|
48
|
-
- examples/tiny/logs/access_log
|
49
48
|
- examples/tiny/root/index.sx
|
50
49
|
- examples/simple/conf
|
51
50
|
- examples/simple/app.rb
|
@@ -56,16 +55,11 @@ files:
|
|
56
55
|
- examples/simple/README
|
57
56
|
- examples/simple/ctl
|
58
57
|
- examples/simple/lib
|
59
|
-
- examples/simple/conf/overrides.rb
|
60
58
|
- examples/simple/conf/requires.rb
|
61
59
|
- examples/simple/conf/apache.conf
|
62
60
|
- examples/simple/conf/live-config.rb
|
63
61
|
- examples/simple/conf/config.rb
|
64
62
|
- examples/simple/conf/debug-config.rb
|
65
|
-
- examples/simple/logs/events.log
|
66
|
-
- examples/simple/logs/apache.log
|
67
|
-
- examples/simple/logs/access_log
|
68
|
-
- examples/simple/logs/app.log
|
69
63
|
- examples/simple/root/comments-form.ss
|
70
64
|
- examples/simple/root/view-article.sx
|
71
65
|
- examples/simple/root/comments.si
|
@@ -81,12 +75,9 @@ files:
|
|
81
75
|
- examples/simple/lib/articles/part.rb
|
82
76
|
- examples/simple/lib/articles/entities.rb
|
83
77
|
- examples/simple/lib/articles/methods.rb
|
84
|
-
-
|
78
|
+
- examples/ndb/run.rb
|
79
|
+
- examples/ndb/README
|
85
80
|
- doc/bugs.txt
|
86
|
-
- doc/css.txt
|
87
|
-
- doc/ideas.txt
|
88
|
-
- doc/pg.txt
|
89
|
-
- doc/svn.txt
|
90
81
|
- doc/architecture.txt
|
91
82
|
- lib/n
|
92
83
|
- lib/xsl
|
@@ -105,7 +96,6 @@ files:
|
|
105
96
|
- lib/n/events.rb
|
106
97
|
- lib/n/mixins.rb
|
107
98
|
- lib/n/l10n.rb
|
108
|
-
- lib/n/tools
|
109
99
|
- lib/n/ui
|
110
100
|
- lib/n/application.rb
|
111
101
|
- lib/n/config.rb
|
@@ -142,7 +132,6 @@ files:
|
|
142
132
|
- lib/n/utils/string.rb
|
143
133
|
- lib/n/utils/http.rb
|
144
134
|
- lib/n/utils/hash.rb
|
145
|
-
- lib/n/db/make-release.sh
|
146
135
|
- lib/n/db/tools.rb
|
147
136
|
- lib/n/db/connection.rb
|
148
137
|
- lib/n/db/psql.rb
|
@@ -157,17 +146,35 @@ files:
|
|
157
146
|
- lib/n/server/RESEARCH.txt
|
158
147
|
- lib/n/server/PLAYBACK.txt
|
159
148
|
- lib/n/server/filter.rb
|
160
|
-
- lib/n/tools/README
|
161
149
|
- lib/n/ui/popup.rb
|
162
150
|
- lib/n/ui/select.rb
|
163
151
|
- lib/n/ui/date-select.rb
|
164
152
|
- lib/n/ui/tabs.rb
|
165
153
|
- lib/n/ui/pager.rb
|
166
|
-
- lib/xsl/localization.xsl
|
167
|
-
- lib/xsl/ce.xsl
|
168
154
|
- lib/xsl/xforms.xsl
|
169
155
|
- lib/xsl/base.xsl
|
170
|
-
-
|
156
|
+
- lib/p/README
|
157
|
+
- test/n
|
158
|
+
- test/n/app
|
159
|
+
- test/n/tc_db.rb
|
160
|
+
- test/n/utils
|
161
|
+
- test/n/tc_sitemap.rb
|
162
|
+
- test/n/tc_events.rb
|
163
|
+
- test/n/ui
|
164
|
+
- test/n/tc_db_mysql.rb
|
165
|
+
- test/n/tc_properties.rb
|
166
|
+
- test/n/app/tc_requestpart.rb
|
167
|
+
- test/n/app/tc_cookie.rb
|
168
|
+
- test/n/app/tc_session.rb
|
169
|
+
- test/n/app/tc_request.rb
|
170
|
+
- test/n/utils/tc_cache.rb
|
171
|
+
- test/n/utils/tc_hash.rb
|
172
|
+
- test/n/utils/tc_http.rb
|
173
|
+
- test/n/utils/tc_strings.rb
|
174
|
+
- test/n/utils/tc_html.rb
|
175
|
+
- test/n/utils/tc_uri.rb
|
176
|
+
- test/n/utils/tc_number.rb
|
177
|
+
- test/n/ui/tc_pager.rb
|
171
178
|
test_files: []
|
172
179
|
rdoc_options:
|
173
180
|
- "--main"
|
@@ -184,4 +191,24 @@ extra_rdoc_files:
|
|
184
191
|
executables: []
|
185
192
|
extensions: []
|
186
193
|
requirements: []
|
187
|
-
dependencies:
|
194
|
+
dependencies:
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: postgres
|
197
|
+
version_requirement:
|
198
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
199
|
+
requirements:
|
200
|
+
-
|
201
|
+
- ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: 0.7.1
|
204
|
+
version:
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
name: extensions
|
207
|
+
version_requirement:
|
208
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
209
|
+
requirements:
|
210
|
+
-
|
211
|
+
- ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: "0.5"
|
214
|
+
version:
|