nitro 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/CHANGELOG +187 -0
  2. data/INSTALL +5 -0
  3. data/README +11 -5
  4. data/doc/AUTHORS +11 -1
  5. data/doc/RELEASES +217 -0
  6. data/doc/tutorial.txt +1 -2
  7. data/lib/nitro.rb +9 -6
  8. data/lib/nitro/adapter/webrick.rb +13 -2
  9. data/lib/nitro/builder/form.rb +11 -9
  10. data/lib/nitro/builder/rss.rb +2 -2
  11. data/lib/nitro/builder/xhtml.rb +15 -0
  12. data/lib/nitro/caching.rb +15 -10
  13. data/lib/nitro/conf.rb +0 -5
  14. data/lib/nitro/controller.rb +118 -81
  15. data/lib/nitro/cookie.rb +6 -6
  16. data/lib/nitro/dispatcher.rb +62 -18
  17. data/lib/nitro/element.rb +4 -1
  18. data/lib/nitro/element/java_script.rb +15 -0
  19. data/lib/nitro/localization.rb +3 -4
  20. data/lib/nitro/markup.rb +4 -4
  21. data/lib/nitro/mixin/debug.rb +30 -0
  22. data/lib/nitro/mixin/helper.rb +14 -0
  23. data/lib/nitro/mixin/javascript.rb +137 -0
  24. data/lib/nitro/{ui → mixin}/pager.rb +110 -82
  25. data/lib/nitro/render.rb +20 -8
  26. data/lib/nitro/request.rb +6 -0
  27. data/lib/nitro/routing.rb +6 -5
  28. data/lib/nitro/runner.rb +21 -9
  29. data/lib/nitro/server.rb +95 -0
  30. data/lib/nitro/service.rb +0 -1
  31. data/lib/nitro/session.rb +4 -5
  32. data/lib/nitro/shaders.rb +2 -2
  33. data/lib/nitro/template.rb +1 -1
  34. data/lib/nitro/testing/assertions.rb +2 -4
  35. data/lib/nitro/testing/context.rb +4 -6
  36. data/proto/public/js/behaviour.js +254 -0
  37. data/proto/public/js/controls.js +446 -0
  38. data/proto/public/js/dragdrop.js +537 -0
  39. data/proto/public/js/effects.js +612 -0
  40. data/proto/public/js/prototype.js +644 -370
  41. data/proto/public/settings.xhtml +64 -0
  42. data/test/nitro/adapter/tc_cgi.rb +2 -2
  43. data/test/nitro/builder/tc_rss.rb +1 -1
  44. data/test/nitro/mixin/tc_pager.rb +35 -0
  45. data/test/nitro/tc_controller.rb +1 -1
  46. data/test/nitro/tc_cookie.rb +14 -0
  47. data/test/nitro/tc_dispatcher.rb +11 -6
  48. data/test/nitro/tc_server.rb +35 -0
  49. metadata +20 -15
  50. data/lib/nitro/builder/atom.rb +0 -74
  51. data/lib/nitro/part.rb +0 -22
  52. data/lib/nitro/simple.rb +0 -11
  53. data/lib/nitro/ui/popup.rb +0 -41
  54. data/lib/nitro/ui/tabs.rb +0 -25
  55. data/lib/nitro/uri.rb +0 -193
  56. data/test/nitro/builder/tc_atom.rb +0 -24
  57. data/test/nitro/tc_uri.rb +0 -97
  58. data/test/nitro/ui/tc_pager.rb +0 -49
@@ -0,0 +1,64 @@
1
+ <html>
2
+ <head>
3
+ <title>Settings</title>
4
+ <style>
5
+ .path {
6
+ padding: 5px;
7
+ font-size: 140%;
8
+ background: #ddd;
9
+ }
10
+ .error {
11
+ padding: 5px;
12
+ padding-top: 15px;
13
+ font-size: 140%;
14
+ color: #f00;
15
+ }
16
+ .load {
17
+ padding: 5px;
18
+ color: #555;
19
+ }
20
+ .source {
21
+ border: 1px solid #ccc;
22
+ padding: 10px;
23
+ margin-top: 10px; margin-bottom: 10px;
24
+ }
25
+ h2 {
26
+ padding-left: 5px;
27
+ background: #eee;
28
+ }
29
+ table {
30
+ border-collapse: collapse;
31
+ width: 100%;
32
+ }
33
+ th {
34
+ border: 1px solid #ccc; padding: 5px; background: #ff0
35
+ }
36
+ td {
37
+ border: 1px solid #ccc; padding: 5px
38
+ }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <h1>Settings</h1>
43
+
44
+ <table width="100%">
45
+ <tr>
46
+ <th>Name</th>
47
+ <th>Value</th>
48
+ <th>Type</th>
49
+ <th>Description</th>
50
+ </tr>
51
+ <?r for s in Configuration.settings ?>
52
+ <tr>
53
+ <td>#{s.owner}.<strong>#{s.name}</strong></td>
54
+ <td>#{s.value.inspect}</td>
55
+ <td>#{s.type}</td>
56
+ <td>#{s.options[:doc]}</td>
57
+ </tr>
58
+ <?r end ?>
59
+ </table>
60
+
61
+ <br /><br />
62
+ Powered by <a href="http://www.nitrohq.com">Nitro</a> version #{Nitro::Version}
63
+ </body>
64
+ </html>
@@ -57,8 +57,8 @@ class TC_AdaptersCgi < Test::Unit::TestCase # :nodoc: all
57
57
  ctx.response_headers = {
58
58
  'Content-Type' => 'text/html'
59
59
  }
60
-
61
- res = "Status: 200 OK\r\nContent-Type: text/html\r\nSet-Cookie: nauthnauth=gmosx\r\nSet-Cookie: nsidnsid=1233\r\n\r\n"
60
+
61
+ res = "Status: 200 OK\r\nContent-Type: text/html\r\nSet-Cookie: nauthnauth=gmosx; Path=/\r\nSet-Cookie: nsidnsid=1233; Path=/\r\n\r\n"
62
62
  assert_equal res, CgiUtils.response_headers(ctx)
63
63
  end
64
64
  =begin
@@ -6,7 +6,7 @@ require 'nitro/builder/rss'
6
6
  class TC_BuildersRss < Test::Unit::TestCase # :nodoc: all
7
7
  include Nitro
8
8
 
9
- Blog = Struct.new(:title, :body, :view_uri)
9
+ Blog = Struct.new(:title, :body, :to_href)
10
10
 
11
11
  def test_render
12
12
  blogs = []
@@ -0,0 +1,35 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'nitro/mixin/pager'
6
+
7
+ class TC_Pager < Test::Unit::TestCase # :nodoc: all
8
+ include Nitro
9
+ include Nitro::PagerMixin
10
+
11
+ class RequestMock < Hash
12
+ attr_accessor :query
13
+
14
+ def initialize
15
+ @query = {}
16
+ end
17
+
18
+ def get(k, default)
19
+ return self[k] || default
20
+ end
21
+ end
22
+
23
+ def request
24
+ RequestMock.new
25
+ end
26
+
27
+ def test_all
28
+ stuff = [1, 2, 3, 4, 5, 6, 7, 8, 9]
29
+
30
+ items, pager = paginate(stuff, :per_page => 2)
31
+ assert_equal 2, items.size
32
+ assert_equal 9, pager.total_count
33
+ end
34
+
35
+ end
@@ -24,7 +24,7 @@ class TC_Controller < Test::Unit::TestCase # :nodoc: all
24
24
 
25
25
  def setup
26
26
  @disp = Dispatcher.new({
27
- 'blog' => Blog2Controller,
27
+ '/blog' => Blog2Controller,
28
28
  })
29
29
  @conf = OpenStruct.new
30
30
  @conf.dispatcher = @disp
@@ -0,0 +1,14 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'nitro/cookie'
6
+
7
+ class TC_Cookie < Test::Unit::TestCase # :nodoc: all
8
+ include Nitro
9
+
10
+ def test_init
11
+ c = Cookie.new('hello', 'world')
12
+ assert_equal '/', c.path
13
+ end
14
+ end
@@ -14,13 +14,13 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
14
14
 
15
15
  def setup
16
16
  @d = Dispatcher.new({
17
- :root => MainController,
18
- 'blog' => BlogController
17
+ '/' => MainController,
18
+ '/blog' => BlogController
19
19
  })
20
20
 
21
21
  @dxml = Dispatcher.new({
22
- :root => MainController,
23
- 'blog' => BlogController,
22
+ '/' => MainController,
23
+ '/blog' => BlogController,
24
24
  # FIXME: this is a hack!
25
25
  'xml:blog' => BlogController
26
26
  })
@@ -32,7 +32,7 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
32
32
 
33
33
  def test_initialize
34
34
  d = Dispatcher.new(BlogController)
35
- assert_equal BlogController, d.controllers[:root]
35
+ assert_equal BlogController, d.controllers['/']
36
36
  end
37
37
 
38
38
  def test_dispatch
@@ -59,7 +59,11 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
59
59
  klass, action = @d.dispatch('/')
60
60
  assert_equal MainController, klass
61
61
  assert_equal 'index_action', action
62
-
62
+
63
+ =begin
64
+ # gmosx: this functionality is deprecated. Use multiple
65
+ # controller to define multiple apis.
66
+
63
67
  # multi-api dispatcher.
64
68
 
65
69
  # no xml prefix, use xhtml api.
@@ -71,6 +75,7 @@ class TC_Dispatcher < Test::Unit::TestCase # :nodoc: all
71
75
  klass, action = @dxml.dispatch('/xml:blog/list')
72
76
  assert_equal BlogController, klass
73
77
  assert_equal 'list_action', action
78
+ =end
74
79
  end
75
80
 
76
81
  end
@@ -0,0 +1,35 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
2
+
3
+ require 'test/unit'
4
+
5
+ require 'nitro/server'
6
+
7
+ class TC_Server < Test::Unit::TestCase # :nodoc: all
8
+ include Nitro
9
+
10
+ class RootController
11
+ end
12
+
13
+ class UsersController
14
+ end
15
+
16
+ class TestController
17
+ end
18
+
19
+ class DeepController
20
+ end
21
+
22
+ def test_all
23
+ srv = Server.new('test')
24
+
25
+ srv.root = RootController
26
+ srv.root.users = UsersController
27
+ srv.root.test = TestController
28
+ srv.root.really.really.deep = DeepController
29
+
30
+ assert_equal RootController, srv.map['/']
31
+ assert_equal UsersController, srv.map['/users']
32
+ assert_equal TestController, srv.map['/test']
33
+ assert_equal DeepController, srv.map['/really/really/deep']
34
+ end
35
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: nitro
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.19.0
7
- date: 2005-06-17
6
+ version: 0.20.0
7
+ date: 2005-07-12
8
8
  summary: Nitro Web Engine
9
9
  require_paths:
10
10
  - lib
@@ -67,12 +67,17 @@ files:
67
67
  - proto/public/media
68
68
  - proto/public/scaffold
69
69
  - proto/public/js
70
+ - proto/public/settings.xhtml
70
71
  - proto/public/index.xhtml
71
72
  - proto/public/cgi.rb
72
73
  - proto/public/error.xhtml
73
74
  - proto/public/fcgi.rb
74
75
  - proto/public/media/nitro.png
75
76
  - proto/public/js/prototype.js
77
+ - proto/public/js/dragdrop.js
78
+ - proto/public/js/behaviour.js
79
+ - proto/public/js/controls.js
80
+ - proto/public/js/effects.js
76
81
  - lib/nitro
77
82
  - lib/nitro.rb
78
83
  - lib/nitro/builder
@@ -81,7 +86,6 @@ files:
81
86
  - lib/nitro/adapter
82
87
  - lib/nitro/caching
83
88
  - lib/nitro/element
84
- - lib/nitro/ui
85
89
  - lib/nitro/controller.rb
86
90
  - lib/nitro/scaffold.rb
87
91
  - lib/nitro/mail.rb
@@ -90,12 +94,10 @@ files:
90
94
  - lib/nitro/conf.rb
91
95
  - lib/nitro/localization.rb
92
96
  - lib/nitro/request.rb
93
- - lib/nitro/simple.rb
97
+ - lib/nitro/mixin
94
98
  - lib/nitro/caching.rb
95
99
  - lib/nitro/markup.rb
96
- - lib/nitro/uri.rb
97
100
  - lib/nitro/output.rb
98
- - lib/nitro/part.rb
99
101
  - lib/nitro/buffering.rb
100
102
  - lib/nitro/cookie.rb
101
103
  - lib/nitro/testing.rb
@@ -112,12 +114,12 @@ files:
112
114
  - lib/nitro/service.rb
113
115
  - lib/nitro/service
114
116
  - lib/nitro/flash.rb
117
+ - lib/nitro/server.rb
115
118
  - lib/nitro/builder/xhtml.rb
116
119
  - lib/nitro/builder/xml.rb
117
120
  - lib/nitro/builder/form.rb
118
121
  - lib/nitro/builder/rss.rb
119
122
  - lib/nitro/builder/table.rb
120
- - lib/nitro/builder/atom.rb
121
123
  - lib/nitro/testing/assertions.rb
122
124
  - lib/nitro/testing/context.rb
123
125
  - lib/nitro/testing/testcase.rb
@@ -132,18 +134,20 @@ files:
132
134
  - lib/nitro/caching/actions.rb
133
135
  - lib/nitro/caching/output.rb
134
136
  - lib/nitro/caching/fragments.rb
135
- - lib/nitro/ui/pager.rb
136
- - lib/nitro/ui/popup.rb
137
- - lib/nitro/ui/tabs.rb
137
+ - lib/nitro/element/java_script.rb
138
+ - lib/nitro/mixin/debug.rb
139
+ - lib/nitro/mixin/pager.rb
140
+ - lib/nitro/mixin/javascript.rb
141
+ - lib/nitro/mixin/helper.rb
138
142
  - lib/nitro/service/xmlrpc.rb
139
143
  - test/nitro
140
144
  - test/public
141
145
  - test/nitro/builder
146
+ - test/nitro/mixin
142
147
  - test/nitro/ui
143
148
  - test/nitro/adapter
144
149
  - test/nitro/tc_localization.rb
145
150
  - test/nitro/tc_template.rb
146
- - test/nitro/tc_uri.rb
147
151
  - test/nitro/tc_mail.rb
148
152
  - test/nitro/tc_controller.rb
149
153
  - test/nitro/tc_session.rb
@@ -152,12 +156,13 @@ files:
152
156
  - test/nitro/tc_element.rb
153
157
  - test/nitro/tc_caching.rb
154
158
  - test/nitro/tc_flash.rb
159
+ - test/nitro/tc_server.rb
160
+ - test/nitro/tc_cookie.rb
155
161
  - test/nitro/builder/tc_rss.rb
156
162
  - test/nitro/builder/tc_table.rb
157
163
  - test/nitro/builder/tc_xhtml.rb
158
164
  - test/nitro/builder/tc_xml.rb
159
- - test/nitro/builder/tc_atom.rb
160
- - test/nitro/ui/tc_pager.rb
165
+ - test/nitro/mixin/tc_pager.rb
161
166
  - test/nitro/adapter/raw_post1.bin
162
167
  - test/nitro/adapter/tc_cgi.rb
163
168
  - test/nitro/adapter/tc_webrick.rb
@@ -194,7 +199,7 @@ dependencies:
194
199
  -
195
200
  - "="
196
201
  - !ruby/object:Gem::Version
197
- version: 0.19.0
202
+ version: 0.20.0
198
203
  version:
199
204
  - !ruby/object:Gem::Dependency
200
205
  name: og
@@ -204,7 +209,7 @@ dependencies:
204
209
  -
205
210
  - "="
206
211
  - !ruby/object:Gem::Version
207
- version: 0.19.0
212
+ version: 0.20.0
208
213
  version:
209
214
  - !ruby/object:Gem::Dependency
210
215
  name: facets
@@ -1,74 +0,0 @@
1
- # WARNING: unfinished code, do NOT use yet.
2
-
3
- require 'nitro/builder/xml'
4
-
5
- module Nitro
6
-
7
- # Build Atom represenations of ruby object collections.
8
- # Utilize duck typing to grab the attributes to render.
9
- # Add this mixin to you classes to support Atom
10
- # syndication.
11
-
12
- module AtomBuilderMixin
13
- include XmlBuilderMixin
14
-
15
- # Build Atom syndication stream.
16
- #
17
- # === Options
18
- #
19
- # [+:description+]
20
- # Description of the feed.
21
- # [+:encoding+]
22
- # Character encoding.
23
- # [+:base+]
24
- # Base url of the feed.
25
- # [+:link+]
26
- # Link of the Feed.
27
-
28
- def build_atom(objects, options = {})
29
- c = {
30
- :description => 'Syndication',
31
- :encoding => 'utf-8'
32
- }.update(options)
33
-
34
- c[:base] ||= c[:link]
35
-
36
- raise "Option ':base' cannot be infered!" unless c[:base]
37
-
38
- pi! :xml, :version => '1.0', :encoding => o[:encoding]
39
- feed(:version => '0.3') do
40
- for obj in objects
41
- entry do
42
- if obj.respond_to?(:author)
43
- author { name(obj.author) }
44
- end
45
-
46
- issued obj.create_time.xmlschema
47
- modified obj.update_time.xmlschema
48
- title obj.title
49
-
50
- if obj.respond_to?(:categories)
51
- for category in categories
52
- dc :subject => category.name
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end
59
-
60
- end
61
-
62
- # Abstract class for the AtomBuilderMixin.
63
-
64
- class AtomBuilder < String
65
- include AtomBuilderMixin
66
-
67
- class << self
68
- def build(objects, options = {})
69
- AtomBuilder.new.build_atom(objects, options)
70
- end
71
- end
72
- end
73
-
74
- end
data/lib/nitro/part.rb DELETED
@@ -1,22 +0,0 @@
1
- # WARNING: UNDER CONSTRUCTION, dont use yet!
2
-
3
- require 'glue/attribute'
4
-
5
- module Nitro
6
-
7
- class Part
8
- cattr_accessor :parts_root, '/home/gmosx/private/plasma/src'
9
- end
10
-
11
- end
12
-
13
- module Kernel
14
-
15
- def require_part(name)
16
- # gmosx: RDoc complains about this, so lets use an
17
- # eval, AAAAAAAARGH!
18
- # require "#{N::Part.parts_root}/#{name}/mount"
19
- eval %{ require '#{Nitro::Part.parts_root}/#{name}/mount' }
20
- end
21
-
22
- end