nitro 0.1.2 → 0.2.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 +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
data/lib/n/sitemap.rb
CHANGED
|
@@ -2,27 +2,11 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Encapsulates the page structure and additional metadata.
|
|
4
4
|
#
|
|
5
|
-
# === TODO:
|
|
6
|
-
#
|
|
7
|
-
# move out of the UI namespace.
|
|
8
|
-
# include url remapping functionality.
|
|
9
|
-
#
|
|
10
|
-
# === Design
|
|
11
|
-
#
|
|
12
|
-
# Unlike the original version, this is presentation agnostic, and
|
|
13
|
-
# greatly simplified.
|
|
14
|
-
#
|
|
15
|
-
# === Todo:
|
|
16
|
-
#
|
|
17
|
-
# - support strings as titles.
|
|
18
|
-
# - add support to read the map from a config file.
|
|
19
|
-
# - rename to appmap ?
|
|
20
|
-
#
|
|
21
5
|
# code:
|
|
22
6
|
# George Moschovitis <gm@navel.gr>
|
|
23
7
|
#
|
|
24
8
|
# (c) 2004 Navel, all rights reserved.
|
|
25
|
-
# $Id: sitemap.rb
|
|
9
|
+
# $Id: sitemap.rb 98 2004-10-22 07:36:20Z gmosx $
|
|
26
10
|
|
|
27
11
|
require "n/utils/hash"
|
|
28
12
|
|
|
@@ -30,11 +14,14 @@ module N
|
|
|
30
14
|
|
|
31
15
|
# = SitePage
|
|
32
16
|
#
|
|
17
|
+
# A single page in the page map.
|
|
18
|
+
#
|
|
33
19
|
class SitePage
|
|
34
20
|
# the uri for this page
|
|
35
21
|
attr_accessor :uri
|
|
36
22
|
# the real uri to this page calculated by the page overloader)
|
|
37
23
|
attr_accessor :real_uri
|
|
24
|
+
# the realm this page belongs to
|
|
38
25
|
attr_accessor :realm
|
|
39
26
|
# the shader for this page, overrided the shader calculated
|
|
40
27
|
# by the engine
|
|
@@ -77,10 +64,26 @@ class SitePage
|
|
|
77
64
|
end
|
|
78
65
|
|
|
79
66
|
# = SiteMap
|
|
80
|
-
#
|
|
67
|
+
#
|
|
68
|
+
# Encapsulates the page structure and additional metadata.
|
|
69
|
+
#
|
|
81
70
|
# === TODO:
|
|
82
|
-
#
|
|
83
|
-
#
|
|
71
|
+
#
|
|
72
|
+
# move out of the UI namespace.
|
|
73
|
+
# include url remapping functionality.
|
|
74
|
+
#
|
|
75
|
+
# === Design
|
|
76
|
+
#
|
|
77
|
+
# Unlike the original version, this is presentation agnostic, and
|
|
78
|
+
# greatly simplified.
|
|
79
|
+
#
|
|
80
|
+
# === Todo:
|
|
81
|
+
#
|
|
82
|
+
# - support strings as titles.
|
|
83
|
+
# - add support to read the map from a config file.
|
|
84
|
+
# - rename to appmap ?
|
|
85
|
+
# - Use a second class in the UI namespace for rendering
|
|
86
|
+
# related stuff?
|
|
84
87
|
#
|
|
85
88
|
class SiteMap < N::SafeHash
|
|
86
89
|
|
data/lib/n/std.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
# =
|
|
1
|
+
# = Nitro standard require
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# General utilities. Typically included in all Nitro applications.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
5
|
+
# code:
|
|
6
|
+
# * George Moschovitis <gm@navel.gr>
|
|
7
|
+
#
|
|
8
|
+
# (c) 2004 Navel, all rights reserved.
|
|
9
|
+
# $Id: std.rb 99 2004-10-22 09:50:28Z gmosx $
|
|
7
10
|
|
|
8
11
|
# we want readable code
|
|
9
12
|
|
|
@@ -59,6 +62,14 @@ end
|
|
|
59
62
|
|
|
60
63
|
EMPTY_STRING = ""
|
|
61
64
|
|
|
65
|
+
# = N
|
|
66
|
+
#
|
|
67
|
+
# This module is used as a namespace that encapsulates
|
|
68
|
+
# engine objects.
|
|
69
|
+
#
|
|
70
|
+
module N
|
|
71
|
+
end # module
|
|
72
|
+
|
|
62
73
|
# This the default 72 chars separator, copy paste to use it
|
|
63
74
|
# in your source file. Btw all lines in your source file should
|
|
64
75
|
# be less than 72 chars. So you can use this as a ruler if your
|
data/lib/n/sync/clc.rb
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# = A Command Line Client (clc) for the Sync Server
|
|
4
4
|
#
|
|
5
|
-
# code:
|
|
5
|
+
# code:
|
|
6
|
+
# * Anastasios Koutoumanos <ak@navel.gr>
|
|
7
|
+
# * George Moschovitis <gm@navel.gr>
|
|
6
8
|
#
|
|
7
9
|
# (c) 2004 Navel, all rights reserved.
|
|
8
|
-
# $Id: clc.rb
|
|
10
|
+
# $Id: clc.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
9
11
|
|
|
10
12
|
require "logger"
|
|
11
13
|
require "socket"
|
data/lib/n/sync/handler.rb
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# A handler can act as a multiplexer to implement multiple services
|
|
6
|
-
# per server.
|
|
7
|
-
#
|
|
8
|
-
# code: tml, drak
|
|
1
|
+
# code:
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
3
|
+
# * Anastasios Koutoumanos <ak@navel.gr>
|
|
9
4
|
#
|
|
10
5
|
# (c) 2004 Navel, all rights reserved.
|
|
11
|
-
# $Id: handler.rb
|
|
6
|
+
# $Id: handler.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
12
7
|
|
|
13
8
|
require "timeout"
|
|
14
9
|
require "n/server"
|
|
@@ -17,9 +12,14 @@ module N; module Sync
|
|
|
17
12
|
|
|
18
13
|
class HandlerExitException < Exception; end
|
|
19
14
|
|
|
20
|
-
# =
|
|
15
|
+
# = Handler
|
|
16
|
+
#
|
|
17
|
+
# Sync Server Handler
|
|
18
|
+
#
|
|
19
|
+
# === Design:
|
|
21
20
|
#
|
|
22
|
-
# Override this to create your
|
|
21
|
+
# Override this to create your handler. A handler can
|
|
22
|
+
# act as a multiplexer to implement multiple services per server.
|
|
23
23
|
#
|
|
24
24
|
class Handler
|
|
25
25
|
SEPARATOR = "\000"
|
|
@@ -45,11 +45,15 @@ class Handler
|
|
|
45
45
|
@server, @socket = server, socket
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# Called when the handler starts.
|
|
49
|
+
#
|
|
48
50
|
def start
|
|
49
51
|
touch!
|
|
50
52
|
@thread = Thread.new(&method("run").to_proc)
|
|
51
53
|
end
|
|
52
54
|
|
|
55
|
+
# Called when the handler stops.
|
|
56
|
+
#
|
|
53
57
|
def stop
|
|
54
58
|
unless STATUS_STOPPED == @status
|
|
55
59
|
@status = STATUS_STOPPED
|
|
@@ -75,6 +79,8 @@ class Handler
|
|
|
75
79
|
@thread.raise HandlerExitException.new()
|
|
76
80
|
end
|
|
77
81
|
|
|
82
|
+
# Perform the handler's action.
|
|
83
|
+
#
|
|
78
84
|
def run
|
|
79
85
|
@status = STATUS_RUNNING
|
|
80
86
|
|
|
@@ -207,7 +213,9 @@ class Handler
|
|
|
207
213
|
|
|
208
214
|
# ------------------------------------------------------------------
|
|
209
215
|
# Commands
|
|
210
|
-
|
|
216
|
+
|
|
217
|
+
# A sample command
|
|
218
|
+
#
|
|
211
219
|
def cmd_ping(args)
|
|
212
220
|
cmd = %{<pong time="#{Time.now}"}
|
|
213
221
|
cmd += %{ challenge="#{args[:challenge]}"} if args
|
data/lib/n/sync/server.rb
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Should support clustered operation: A cluster of servers is spawned.
|
|
6
|
-
# The client connects to one of the servers at random. The client sticks
|
|
7
|
-
# to the server. Each server considers the others as clients and
|
|
8
|
-
# rebroadcasts all the events.
|
|
9
|
-
#
|
|
10
|
-
# We keep one service per server for simplicity, if we need multiple
|
|
11
|
-
# services we can implement a multiplexer service (handler).
|
|
12
|
-
#
|
|
13
|
-
# === TODO:
|
|
14
|
-
#
|
|
15
|
-
# - Investigate if this server can be done with select.
|
|
16
|
-
#
|
|
17
|
-
# code: gmosx, drak
|
|
1
|
+
# code:
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
3
|
+
# * Anastasios Koutoumanos <ak@navel.gr>
|
|
18
4
|
#
|
|
19
5
|
# (c) 2004 Navel, all rights reserved.
|
|
20
|
-
# $Id: server.rb
|
|
6
|
+
# $Id: server.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
21
7
|
|
|
22
8
|
require "thread"
|
|
23
9
|
require "socket"
|
|
@@ -41,6 +27,20 @@ module N; module Sync
|
|
|
41
27
|
# marker. NO: the XML protocol is not really appropriate, better use
|
|
42
28
|
# a space optimized delimited ASCII protocol.
|
|
43
29
|
#
|
|
30
|
+
# === Design:
|
|
31
|
+
#
|
|
32
|
+
# Should support clustered operation: A cluster of servers is spawned.
|
|
33
|
+
# The client connects to one of the servers at random. The client sticks
|
|
34
|
+
# to the server. Each server considers the others as clients and
|
|
35
|
+
# rebroadcasts all the events.
|
|
36
|
+
#
|
|
37
|
+
# We keep one service per server for simplicity, if we need multiple
|
|
38
|
+
# services we can implement a multiplexer service (handler).
|
|
39
|
+
#
|
|
40
|
+
# === TODO:
|
|
41
|
+
#
|
|
42
|
+
# - Investigate if this server can be done with select.
|
|
43
|
+
#
|
|
44
44
|
class Server < N::Application
|
|
45
45
|
MONITOR_INTERVAL = 2 * 60
|
|
46
46
|
|
|
@@ -78,6 +78,8 @@ class Server < N::Application
|
|
|
78
78
|
super()
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
+
# Start the server.
|
|
82
|
+
#
|
|
81
83
|
def start()
|
|
82
84
|
# a single tcp server accepts all tcp requests
|
|
83
85
|
@tcp_server = TCPServer.new(address, port)
|
|
@@ -86,10 +88,14 @@ class Server < N::Application
|
|
|
86
88
|
run()
|
|
87
89
|
end
|
|
88
90
|
|
|
91
|
+
# Stop the server.
|
|
92
|
+
#
|
|
89
93
|
def stop()
|
|
90
94
|
@status = STATUS_STOPED
|
|
91
95
|
end
|
|
92
96
|
|
|
97
|
+
# Run the main loop of the server.
|
|
98
|
+
#
|
|
93
99
|
def run()
|
|
94
100
|
@status = STATUS_RUNNING
|
|
95
101
|
$log.info "Server is running."
|
data/lib/n/ui/date-select.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
# = Date Select
|
|
2
|
-
#
|
|
3
1
|
# code:
|
|
4
|
-
# George Moschovitis <gm@navel.gr>
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
5
3
|
#
|
|
6
4
|
# (c) 2004 Navel, all rights reserved.
|
|
7
5
|
# $Id: select.rb 39 2004-09-29 12:40:53Z elathan $
|
|
@@ -11,7 +9,7 @@ module N; module UI
|
|
|
11
9
|
MONTHS_EN = %w{ - January February March April May June July August September October November December }
|
|
12
10
|
MONTHS_EL = %w{ - ���������� ����������� ������� �������� ����� ������� ������� ��������� ����������� ��������� ��������� ���������� }
|
|
13
11
|
|
|
14
|
-
#
|
|
12
|
+
# Generate a component that allows the user to select a day.
|
|
15
13
|
#
|
|
16
14
|
def self.date_select(prefix, day, month, year, yorder = 0, locale = "en")
|
|
17
15
|
str = ""
|
data/lib/n/ui/pager.rb
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# code: gmosx
|
|
1
|
+
# code:
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
4
3
|
#
|
|
5
4
|
# (c) 2004 Navel, all rights reserved.
|
|
6
|
-
# $Id: pager.rb
|
|
5
|
+
# $Id: pager.rb 99 2004-10-22 09:50:28Z gmosx $
|
|
7
6
|
|
|
8
7
|
module N; module UI
|
|
9
8
|
|
|
9
|
+
# = Pager
|
|
10
|
+
#
|
|
11
|
+
# Displays a collection of entitities in multiple pages.
|
|
12
|
+
#
|
|
10
13
|
# === Design:
|
|
11
14
|
#
|
|
12
15
|
# The new version is carefully designed for scaleability. It stores
|
|
13
|
-
# only the items for one page.
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# SQL LIMIT option to optimize database interaction.
|
|
16
|
+
# only the items for one page. The name parameter is needed, multiple
|
|
17
|
+
# pagers can coexist in a single page. Unlike the v1/v2 pagers this
|
|
18
|
+
# pager leverages the SQL LIMIT option to optimize database interaction.
|
|
17
19
|
#
|
|
18
20
|
# The pager does not extend Array (it includes an Array instead) to
|
|
19
21
|
# avoid a concat() in the initialization step.
|
data/lib/n/ui/popup.rb
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# code: gmosx
|
|
1
|
+
# code:
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
4
3
|
#
|
|
5
4
|
# (c) 2004 Navel, all rights reserved.
|
|
6
|
-
# $Id: popup.rb
|
|
5
|
+
# $Id: popup.rb 99 2004-10-22 09:50:28Z gmosx $
|
|
7
6
|
|
|
8
7
|
module N; module UI
|
|
9
8
|
|
|
10
9
|
# = Popup
|
|
11
10
|
#
|
|
11
|
+
# Display a popup window.
|
|
12
|
+
#
|
|
12
13
|
class Popup
|
|
13
14
|
|
|
14
15
|
# Emit the needed javascript.
|
data/lib/n/ui/select.rb
CHANGED
data/lib/n/ui/tabs.rb
CHANGED
data/lib/n/utils/array.rb
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# === Design:
|
|
4
|
-
#
|
|
5
|
-
# Implement as a module to avoid class polution. You can still Ruby's
|
|
6
|
-
# advanced features to include the module in your class.
|
|
7
|
-
# Passing the object to act upon allows to check for nil, which isn't
|
|
8
|
-
# possible if you use self.
|
|
9
|
-
#
|
|
10
|
-
# code:: gmosx, ekarak
|
|
1
|
+
# code:
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
11
3
|
#
|
|
12
4
|
# (c) 2002-2003 Navel, all rights reserved.
|
|
13
|
-
# $Id: array.rb
|
|
5
|
+
# $Id: array.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
14
6
|
|
|
15
7
|
require "sync"
|
|
16
8
|
|
|
@@ -22,13 +14,13 @@ module N
|
|
|
22
14
|
# because it is re-entrant.
|
|
23
15
|
# An exclusive lock is needed when writing, a shared lock IS NEEDED
|
|
24
16
|
# when reading
|
|
25
|
-
|
|
17
|
+
#
|
|
26
18
|
class SafeArray < Array
|
|
27
19
|
|
|
28
20
|
attr :sync
|
|
29
21
|
|
|
30
22
|
# gmosx: delegator is not used.
|
|
31
|
-
|
|
23
|
+
#
|
|
32
24
|
def initialize(delegator = nil)
|
|
33
25
|
@sync = ::Sync.new()
|
|
34
26
|
end
|
|
@@ -87,6 +79,6 @@ class SafeArray < Array
|
|
|
87
79
|
}
|
|
88
80
|
end
|
|
89
81
|
|
|
90
|
-
end
|
|
82
|
+
end
|
|
91
83
|
|
|
92
84
|
end # module
|
data/lib/n/utils/cache.rb
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
# = Cache
|
|
2
|
-
#
|
|
3
|
-
# Various caching mechanisms.
|
|
4
|
-
#
|
|
5
1
|
# code:
|
|
6
|
-
# George Moschovitis <gm@navel.gr>
|
|
7
|
-
# Anastasios Koutoumanos <ak@navel.gr>
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
3
|
+
# * Anastasios Koutoumanos <ak@navel.gr>
|
|
8
4
|
#
|
|
9
5
|
# (c) 2004 Navel, all rights reserved.
|
|
10
|
-
# $Id: cache.rb
|
|
6
|
+
# $Id: cache.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
11
7
|
|
|
12
8
|
module N;
|
|
13
9
|
|
data/lib/n/utils/gfx.rb
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
# = General graphics utilities collection
|
|
2
|
-
#
|
|
3
1
|
# code:
|
|
4
|
-
# George Moschovitis <gm@navel.gr>
|
|
5
|
-
# Elias Athanasopoulos <elathan@navel.gr>
|
|
6
|
-
# Asteraki <stella@navel.gr>
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
3
|
+
# * Elias Athanasopoulos <elathan@navel.gr>
|
|
7
4
|
#
|
|
8
5
|
# (c) 2004 Navel, all rights reserved.
|
|
9
|
-
# $Id: gfx.rb
|
|
6
|
+
# $Id: gfx.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
10
7
|
|
|
11
8
|
module N
|
|
12
9
|
|
|
13
10
|
# = GfxUtils
|
|
11
|
+
#
|
|
12
|
+
# General graphics utilities collection.
|
|
14
13
|
#
|
|
15
14
|
# === Design:
|
|
16
15
|
#
|
data/lib/n/utils/hash.rb
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# various hash utilities.
|
|
4
|
-
#
|
|
5
|
-
# Design:
|
|
6
|
-
# uses the delegator pattern to allow for multiple
|
|
7
|
-
# implementations!
|
|
8
|
-
#
|
|
9
|
-
# *code: gmosx
|
|
1
|
+
# code:
|
|
2
|
+
# * George Moschovitis <gm@navel.gr>
|
|
10
3
|
#
|
|
11
4
|
# (c) 2004 Navel, all rights reserved.
|
|
12
|
-
# $Id: hash.rb
|
|
5
|
+
# $Id: hash.rb 101 2004-10-22 12:35:39Z gmosx $
|
|
13
6
|
|
|
14
7
|
require "sync"
|
|
15
8
|
|
|
@@ -21,12 +14,14 @@ module N;
|
|
|
21
14
|
# because it is re-entrant.
|
|
22
15
|
# An exclusive lock is needed when writing, a shared lock IS NEEDED
|
|
23
16
|
# when reading
|
|
24
|
-
|
|
17
|
+
# uses the delegator pattern to allow for multiple
|
|
18
|
+
# implementations!
|
|
19
|
+
#
|
|
25
20
|
class SafeHash < Hash
|
|
26
21
|
attr :sync
|
|
27
22
|
|
|
28
23
|
# gmosx: delegator is not used.
|
|
29
|
-
|
|
24
|
+
#
|
|
30
25
|
def initialize(delegator = nil)
|
|
31
26
|
@sync = ::Sync.new
|
|
32
27
|
end
|