• R/O
  • SSH
  • HTTPS

tenarai: 提交


Commit MetaInfo

修訂69 (tree)
時間2008-04-02 20:07:30
作者junkikuchi

Log Message

updated.

Change Summary

差異

--- trunk/Rakefile (revision 68)
+++ trunk/Rakefile (revision 69)
@@ -2,571 +2,10 @@
22 # Copyright (C) 2007, 2008 Jun Kikuchi <kikuchi@bonnou.com>
33 #
44
5-require 'main'
5+BASE_DIR = File.dirname(__FILE__)
6+$LOAD_PATH.push("#{BASE_DIR}/lib")
67
7-init_model = {
8- 'service' => [
9- {
10- :name => 'user',
11- :class => 'Service',
12- :row => {'name' => 'user'},
13- :relation => {
14- 'widget' => 'widget:session.user.content.view.html',
15- },
16- },
17- ],
18-
19- 'user' => [
20- {
21- :name => 'login',
22- :class => 'User',
23- :row => {
24- 'name' => 'login',
25- '_password' => Tenarai::ClassLoader['User'].digest('')
26- },
27- :relation => {
28- 'content' => 'content:login',
29- },
30- },
31-
32- {
33- :name => 'admin',
34- :class => 'User',
35- :row => {
36- 'name' => 'admin',
37- '_password' => Tenarai::ClassLoader['User'].digest('admin'),
38- },
39- :relation => {
40- 'content' => 'content:admin',
41- },
42- },
43-
44- {
45- :name => 'skelton',
46- :class => 'User',
47- :row => {
48- 'name' => 'skelton',
49- '_password' => Tenarai::ClassLoader['User'].digest('')
50- },
51- :relation => {
52- 'content' => 'content:skelton',
53- },
54- },
55- ],
56-
57- 'content' => [
58- {
59- :name => 'login',
60- :class => 'Content',
61- :row => {
62- 'title' => 'login',
63- 'body' => 'login',
64- },
65- :relation => {'view' => 'view:resource.login'},
66- },
67-
68- {
69- :name => 'admin',
70- :class => 'Content',
71- :row => {
72- 'title' => 'admin',
73- 'body' => '',
74- },
75- :relation => {'view' => 'view:resource.admin.user'},
76- },
77- {
78- :name => 'admin.new_user',
79- :class => 'Content',
80- :row => {
81- 'title' => 'new user',
82- 'body' => '',
83- },
84- :relation => {'view' => 'view:resource.admin.user.new'},
85- },
86- {
87- :name => 'admin.user_list',
88- :class => 'Content',
89- :row => {
90- 'title' => 'user list',
91- 'body' => '',
92- },
93- :relation => {'view' => 'view:resource.admin.user.list'},
94- },
95- {
96- :name => 'admin.user_list.user_home',
97- :class => 'Content',
98- :row => {
99- 'title' => 'user detail',
100- 'body' => '',
101- },
102- :relation => {'view' => 'view:resource.admin.user.home'},
103- },
104-
105- {
106- :name => 'skelton',
107- :class => 'Content',
108- :row => {
109- 'title' => 'skelton',
110- 'body' => 'skelton',
111- },
112- :relation => {'view' => 'view:resource.skelton'},
113- },
114- ],
115-
116- 'view' => [
117- {
118- :name => 'resource',
119- :class => 'View',
120- :row => {'name' => 'resource'},
121- },
122-
123- {
124- :name => 'resource.login',
125- :class => 'View',
126- :row => {'name' => 'login'},
127- },
128-
129- {
130- :name => 'resource.admin',
131- :class => 'View',
132- :row => {'name' => 'admin'},
133- },
134-
135- {
136- :name => 'resource.admin.user',
137- :class => 'View',
138- :row => {'name' => 'user'},
139- },
140- {
141- :name => 'resource.admin.user.list',
142- :class => 'View',
143- :row => {'name' => 'list'},
144- },
145- {
146- :name => 'resource.admin.user.new',
147- :class => 'View',
148- :row => {'name' => 'user'},
149- },
150- {
151- :name => 'resource.admin.user.home',
152- :class => 'View',
153- :row => {'name' => 'user'},
154- },
155-
156- {
157- :name => 'resource.skelton',
158- :class => 'View',
159- :row => {'name' => 'skelton'},
160- },
161- ],
162-
163- 'widget' => [
164- {
165- :name => 'session',
166- :class => 'Widget::Session',
167- :row => {},
168- :relation => {'view' => 'view:resource'},
169- },
170- {
171- :name => 'session.user',
172- :class => 'Widget::User',
173- :row => {},
174- :relation => {'view' => 'view:resource'},
175- :preference => {
176- 'preference.default.user_id' => :'user:login'
177- #'preference.default.user_id' => :'user:admin'
178- }
179- },
180- {
181- :name => 'session.user.content',
182- :class => 'Widget::Content',
183- :row => {},
184- :relation => {'view' => 'view:resource'},
185- },
186- {
187- :name => 'session.user.content.view',
188- :class => 'Widget::View',
189- :row => {},
190- :relation => {'view' => 'view:resource'},
191- },
192- {
193- :name => 'session.user.content.view.html',
194- :class => 'Widget::HTML',
195- :row => {},
196- :relation => {'view' => 'view:resource'},
197- :preference => {
198- 'box.text.text_align' => 'left',
199- 'box.size.width' => '900px',
200- 'box.margin.margin_right' => 'auto',
201- 'box.margin.margin_left' => 'auto',
202- }
203- },
204-
205- {
206- :name => 'session.user.content.view.html.login',
207- :class => 'Widget::Panel',
208- :row => {},
209- :relation => {'view' => 'view:resource.login'},
210- :preference => {}
211- },
212- {
213- :name => 'session.user.content.view.html.login.title',
214- :class => 'Widget::Content::Title',
215- :row => {},
216- :relation => {'view' => 'view:resource.login'},
217- },
218- {
219- :name => 'session.user.content.view.html.login.reset_style',
220- :class => 'Widget::YUI::ResetFontsGrids',
221- :row => {},
222- :relation => {'view' => 'view:resource.login'},
223- :preference => {
224- 'yui.reset_fonts_grids.url' => 'http://localhost/pub/yui-2.4.1/build/reset-fonts-grids/reset-fonts-grids.css',
225- }
226- },
227- {
228- :name => 'session.user.content.view.html.login.hd',
229- :class => 'Widget::Panel',
230- :row => {},
231- :relation => {'view' => 'view:resource.login'},
232- :preference => {
233- 'box.margin.margin_top' => '10px',
234- 'box.margin.margin_bottom' => '10px',
235- 'box.padding.padding_top' => '10px',
236- 'box.padding.padding_bottom' => '10px',
237- 'box.border.border_bottom' => 'solid 3px blue',
238- }
239- },
240- {
241- :name => 'session.user.content.view.html.login.hd.header',
242- :class => 'Widget::Content::Header',
243- :row => {},
244- :relation => {'view' => 'view:resource.login'},
245- :preference => {
246- 'box.font.font_size' => '197%',
247- }
248- },
249- {
250- :name => 'session.user.content.view.html.login.bd',
251- :class => 'Widget::Panel',
252- :row => {},
253- :relation => {'view' => 'view:resource.login'},
254- },
255- {
256- :name => 'session.user.content.view.html.login.bd.form',
257- :class => 'Widget::User::Login',
258- :row => {},
259- :relation => {'view' => 'view:resource.login'},
260- :preference => {
261- 'box.font.font_size' => '152%',
262- 'box.margin.margin_top' => '25px',
263- 'box.margin.margin_right' => 'auto',
264- 'box.margin.margin_left' => 'auto',
265- 'box.size.width' => '500px',
266- }
267- },
268- {
269- :name => 'session.user.content.view.html.login.ft',
270- :class => 'Widget::Panel',
271- :row => {},
272- :relation => {'view' => 'view:resource.login'},
273- },
274-
275- {
276- :name => 'session.user.content.view.html.admin',
277- :class => 'Widget::Panel',
278- :row => {},
279- :relation => {'view' => 'view:resource.admin'},
280- :preference => {}
281- },
282- {
283- :name => 'session.user.content.view.html.admin.reset_style',
284- :class => 'Widget::YUI::ResetFontsGrids',
285- :row => {},
286- :relation => {'view' => 'view:resource.admin'},
287- :preference => {
288- 'yui.reset_fonts_grids.url' => 'http://localhost/pub/yui-2.4.1/build/reset-fonts-grids/reset-fonts-grids.css',
289- }
290- },
291- {
292- :name => 'session.user.content.view.html.admin.hd',
293- :class => 'Widget::Panel',
294- :row => {},
295- :relation => {'view' => 'view:resource.admin'},
296- :preference => {
297- 'box.margin.margin_top' => '10px',
298- 'box.margin.margin_bottom' => '10px',
299- 'box.padding.padding_top' => '10px',
300- 'box.padding.padding_bottom' => '10px',
301- 'box.border.border_bottom' => 'solid 3px blue',
302- }
303- },
304- {
305- :name => 'session.user.content.view.html.admin.hd.logout',
306- :class => 'Widget::User::Logout',
307- :row => {},
308- :relation => {'view' => 'view:resource.admin'},
309- :preference => {
310- 'box.text.text_align' => 'right',
311- }
312- },
313- {
314- :name => 'session.user.content.view.html.admin.hd.header',
315- :class => 'Widget::Content::Header',
316- :row => {},
317- :relation => {'view' => 'view:resource.admin'},
318- :preference => {
319- 'box.font.font_size' => '197%',
320- }
321- },
322- {
323- :name => 'session.user.content.view.html.admin.bd',
324- :class => 'Widget::Panel',
325- :row => {},
326- :relation => {'view' => 'view:resource.admin'},
327- },
328- {
329- :name => 'session.user.content.view.html.admin.ft',
330- :class => 'Widget::Panel',
331- :row => {},
332- :relation => {'view' => 'view:resource.admin'},
333- },
334-
335- {
336- :name => 'session.user.content.view.html.admin.bd.tab',
337- :class => 'Widget::Content::Tab',
338- :row => {},
339- :relation => {'view' => 'view:resource.admin.user'},
340- :preference => {
341- }
342- },
343- {
344- :name => 'session.user.content.view.html.admin.bd.user',
345- :class => 'Widget::UserAdmin',
346- :row => {},
347- :relation => {'view' => 'view:resource.admin.user'},
348- },
349- {
350- :name => 'session.user.content.view.html.admin.bd.user.list',
351- :class => 'Widget::UserAdmin::List',
352- :row => {},
353- :relation => {'view' => 'view:resource.admin.user.list'},
354- :preference => {
355- 'box.size.width' => '900px',
356- 'head.background.background_color' => 'silver',
357- 'head.padding.padding_top' => '5px',
358- 'head.padding.padding_right' => '5px',
359- 'head.padding.padding_bottom' => '5px',
360- 'head.padding.padding_left' => '5px',
361- 'body.padding.padding_top' => '5px',
362- 'body.padding.padding_right' => '5px',
363- 'body.padding.padding_bottom' => '5px',
364- 'body.padding.padding_left' => '5px',
365- }
366- },
367- {
368- :name => 'session.user.content.view.html.admin.bd.user.new',
369- :class => 'Widget::UserAdmin::Form',
370- :row => {},
371- :relation => {'view' => 'view:resource.admin.user.new'},
372- :preference => {
373- 'box.size.width' => '900px',
374- 'preference.form.type' => 'new',
375- }
376- },
377- {
378- :name => 'session.user.content.view.html.admin.bd.user.home',
379- :class => 'Widget::UserAdmin::Form',
380- :row => {},
381- :relation => {'view' => 'view:resource.admin.user.home'},
382- :preference => {
383- 'box.size.width' => '900px',
384- 'preference.form.type' => 'edit',
385- }
386- },
387-=begin
388- {
389- :name => 'session.user.content.view.html.admin.bd.user.content',
390- :class => 'Widget::UserAdmin::Content',
391- :row => {},
392- :relation => {'view' => 'view:resource.admin.user.home'},
393- :preference => {}
394- },
395-=end
396-=begin
397- {
398- :name => 'session.user.content.view.html.admin.bd.user.home.content',
399- :class => 'Widget::UserAdmin::Content',
400- :row => {},
401- :relation => {'view' => 'view:resource.admin.user.home'},
402- :preference => {
403- 'box.size.width' => '900px',
404- 'preference.form.type' => 'edit',
405- }
406- },
407-=end
408-=begin
409- {
410- :name => 'session.user.content.view.html.admin.new_user',
411- :class => 'Widget::User::Form',
412- :row => {},
413- :relation => {'view' => 'view:resource.admin'},
414- :preference => {'preference.form.type' => 'new'}
415- },
416-
417- {
418- :name => 'session.user.content.view.html.admin.edit_user',
419- :class => 'Widget::User::Form',
420- :row => {},
421- :relation => {'view' => 'view:resource.admin'},
422- :preference => {'preference.form.type' => 'edit'}
423- },
424-
425- {
426- :name => 'session.user.content.view.html.admin.title',
427- :class => 'Widget::Content::Title',
428- :row => {},
429- :relation => {'view' => 'view:resource.admin'},
430- },
431-=end
432-=begin
433- {
434- :name => 'session.user.content.view.html.admin.reset_style',
435- :class => 'Widget::YUI::ResetFontsGrids',
436- :row => {},
437- :relation => {'view' => 'view:resource.admin'},
438- :preference => {
439- 'yui.reset_fonts_grids.url' => 'http://localhost/pub/yui-2.4.1/build/reset-fonts-grids/reset-fonts-grids.css',
440- }
441- },
442-=end
443-=begin
444- {
445- :name => 'session.user.content.view.html.admin.header',
446- :class => 'Widget::Content::Header',
447- :row => {},
448- :relation => {'view' => 'view:resource.admin'},
449- },
450-
451- {
452- :name => 'session.user.content.view.html.admin.tab',
453- :class => 'Widget::Content::Tab',
454- :row => {},
455- :relation => {'view' => 'view:resource.admin'},
456- },
457-
458- {
459- :name => 'session.user.content.view.html.admin.path',
460- :class => 'Widget::Content::Path',
461- :row => {},
462- :relation => {'view' => 'view:resource.admin'},
463- },
464-
465- {
466- :name => 'session.user.content.view.html.admin.list',
467- :class => 'Widget::Content::List',
468- :row => {},
469- :relation => {'view' => 'view:resource.admin'},
470- },
471-
472- {
473- :name => 'session.user.content.view.html.admin.new_content',
474- :class => 'Widget::Content::Form',
475- :row => {},
476- :relation => {'view' => 'view:resource.admin'},
477- :preference => {'preference.form.type' => 'new'}
478- },
479-
480- {
481- :name => 'session.user.content.view.html.admin.edit_content',
482- :class => 'Widget::Content::Form',
483- :row => {},
484- :relation => {'view' => 'view:resource.admin'},
485- :preference => {'preference.form.type' => 'edit'}
486- },
487-
488- {
489- :name => 'session.user.content.view.html.admin.view',
490- :class => 'Widget::View::List',
491- :row => {},
492- :relation => {'view' => 'view:resource.admin'},
493- },
494-
495- {
496- :name => 'session.user.content.view.html.admin.widget',
497- :class => 'Widget::Widget',
498- :row => {},
499- :relation => {'view' => 'view:resource.admin'},
500- :preference => {}
501- },
502-
503- {
504- :name => 'session.user.content.view.html.admin.widget.list',
505- :class => 'Widget::Widget::List',
506- :row => {},
507- :relation => {'view' => 'view:resource.admin'},
508- },
509-
510- {
511- :name => 'session.user.content.view.html.admin.panel',
512- :class => 'Widget::Panel',
513- :row => {},
514- :relation => {'view' => 'view:resource.admin'},
515- :preference => {
516- 'box.size.width' => '100px',
517- 'box.size.height' => '100px',
518- 'box.padding.padding_left' => '10px',
519- 'box.padding.padding_top' => '10px',
520- 'box.padding.padding_right' => '10px',
521- 'box.padding.padding_bottom' => '10px',
522- 'box.background.background_color' => 'gray',
523- }
524- },
525-
526- {
527- :name => 'session.user.content.view.html.admin.panel.panel',
528- :class => 'Widget::Panel',
529- :row => {},
530- :relation => {'view' => 'view:resource.admin'},
531- :preference => {
532- 'box.size.width' => '80px',
533- 'box.size.height' => '80px',
534- 'box.margin.margin_left' => '10px',
535- 'box.margin.margin_top' => '10px',
536- 'box.margin.margin_right' => '10px',
537- 'box.margin.margin_bottom' => '10px',
538- 'box.background.background_color' => 'green',
539- }
540- },
541-=end
542-=begin
543- {
544- :name => 'session.user.content.view.html.admin.jquery',
545- :class => 'Widget::JQuery',
546- :row => {},
547- :relation => {'view' => 'view:resource.admin'},
548- :preference => {}
549- },
550-
551- {
552- :name => 'session.user.content.view.html.admin.gmaps',
553- :class => 'Widget::GoogleMaps',
554- :row => {},
555- :relation => {'view' => 'view:resource.admin'},
556- :preference => {
557- 'box.size.width' => '500px',
558- 'box.size.height' => '500px',
559- }
560- },
561-=end
562- ],
563-}
564-
5658 task :default do
5669 require 'test/unit'
56710 Test::Unit::AutoRunner.run(true, "#{BASE_DIR}/test")
56811 end
569-
570-task :install do Main.new(CONFIG).install end
571-task :init do Main.new(CONFIG).load_model(init_model) end
572-task :uninstall do Main.new(CONFIG).uninstall end
--- trunk/init_model.rb (nonexistent)
+++ trunk/init_model.rb (revision 69)
@@ -0,0 +1,100 @@
1+
2+CONFIG[:init_model] = {
3+ 'service' => [
4+ {
5+ :name => 'index',
6+ :class => 'Service',
7+ :row => {'name' => 'index'},
8+ :relation => {
9+ 'widget' => 'widget:session.user.content.view.html',
10+ },
11+ },
12+ ],
13+
14+ 'user' => [
15+ {
16+ :name => 'index',
17+ :class => 'User',
18+ :row => {
19+ 'name' => 'index',
20+ '_password' => Tenarai::ClassLoader['User'].digest('')
21+ },
22+ :relation => { 'content' => 'content:index', },
23+ },
24+ ],
25+
26+ 'content' => [
27+ {
28+ :name => 'index',
29+ :class => 'Content',
30+ :row => {
31+ 'title' => 'index',
32+ 'body' => '',
33+ },
34+ :relation => {'view' => 'view:resource.index'},
35+ },
36+ ],
37+
38+ 'view' => [
39+ {
40+ :name => 'resource',
41+ :class => 'View',
42+ :row => {'name' => 'resource'},
43+ },
44+ {
45+ :name => 'resource.index',
46+ :class => 'View',
47+ :row => {'name' => 'index'},
48+ },
49+ ],
50+
51+ 'widget' => [
52+ {
53+ :name => 'session',
54+ :class => 'Widget::Session',
55+ :row => {},
56+ :relation => {'view' => 'view:resource'},
57+ },
58+ {
59+ :name => 'session.user',
60+ :class => 'Widget::User',
61+ :row => {},
62+ :relation => {'view' => 'view:resource'},
63+ :preference => {
64+ 'preference.default.user_id' => :'user:index'
65+ }
66+ },
67+ {
68+ :name => 'session.user.content',
69+ :class => 'Widget::Content',
70+ :row => {},
71+ :relation => {'view' => 'view:resource'},
72+ },
73+ {
74+ :name => 'session.user.content.view',
75+ :class => 'Widget::View',
76+ :row => {},
77+ :relation => {'view' => 'view:resource'},
78+ },
79+ {
80+ :name => 'session.user.content.view.html',
81+ :class => 'Widget::HTML',
82+ :row => {},
83+ :relation => {'view' => 'view:resource'},
84+ :preference => {
85+ 'html.size.width' => '100%',
86+ 'html.size.height' => '100%',
87+ 'body.size.width' => '100%',
88+ 'body.size.height' => '100%',
89+ 'body.text.text_align' => 'left',
90+ }
91+ },
92+ {
93+ :name => 'session.user.content.view.html.title',
94+ :class => 'Widget::Content::Header',
95+ :row => {},
96+ :relation => {'view' => 'view:resource.index'},
97+ :preference => {}
98+ },
99+ ],
100+}
--- trunk/main.rb (revision 68)
+++ trunk/main.rb (revision 69)
@@ -3,6 +3,8 @@
33 # Copyright (C) 2008 Jun Kikuchi <kikuchi@bonnou.com>
44 #
55
6+CONFIG = {}
7+
68 require 'config'
79
810 $LOAD_PATH.push("#{BASE_DIR}/lib")
@@ -10,9 +12,10 @@
1012 require 'tenarai/server'
1113 require 'tenarai/classloader'
1214 require 'tenarai/db/container'
13-
1415 Tenarai::ClassLoader.dir = CONFIG[:server][:app_dir]
1516
17+require 'init_model'
18+
1619 class Main
1720 def initialize(config)
1821 @config = config
@@ -75,11 +78,11 @@
7578 end
7679 end
7780
78- def load_model(init_model)
81+ def load
7982 model do |m|
8083 map = {}
81- create_row(m, map, init_model)
82- update_preference(m, map, init_model)
84+ create_row(m, map, @config[:init_model])
85+ update_preference(m, map, @config[:init_model])
8386 end
8487 end
8588
@@ -137,6 +140,12 @@
137140 end
138141
139142 case ARGV.shift
143+when 'install'
144+ Main.new(CONFIG).install
145+when 'uninstall'
146+ Main.new(CONFIG).uninstall
147+when 'load'
148+ Main.new(CONFIG).load
140149 when 'cgi'
141150 Main.new(CONFIG).cgi
142151 when 'mongrel'
--- trunk/config.rb (revision 68)
+++ trunk/config.rb (revision 69)
@@ -1,43 +1,43 @@
11
22 BASE_DIR = File.dirname(__FILE__)
33
4-CONFIG = {
5- :db => {
6- :engine => :mysql,
7- :db => 'test',
8- :host => 'localhost',
9- :user => 'root',
10- :password => 'root',
11- #:echo => true,
12- },
4+CONFIG[:db] = {
5+ :engine => :mysql,
6+ :db => 'text',
7+ :host => 'localhost',
8+ :user => 'root',
9+ :password => 'root',
10+ #:echo => true,
11+}
1312
14- :server => {
15- :address => '0.0.0.0',
16- :port => 8080,
17- #:port => 8080..8085,
18- :pub_dir => "#{BASE_DIR}/pub",
19- :app_dir => "#{BASE_DIR}/webapp",
13+CONFIG[:server] = {
14+ :address => '0.0.0.0',
15+ :port => 8080,
16+ #:port => 8080..8085,
17+ :pub_dir => "#{BASE_DIR}/pub",
18+ :app_dir => "#{BASE_DIR}/webapp",
19+}
20+
21+CONFIG[:model] = {
22+ :table => {
23+ 'service' => {:row => 'Service', :class => 'ServiceTable'},
24+ 'user' => {:row => 'User', :class => 'UserTable' },
25+ 'session' => {:row => 'Session', :class => 'SessionTable'},
26+ 'content' => {:row => 'Content' },
27+ 'view' => {:row => 'View' },
28+ 'widget' => {:row => 'Widget' },
29+ 'tracklog' => {:row => 'TrackLog'},
2030 },
2131
22- :model => {
23- :table => {
24- 'service' => {:row => 'Service', :class => 'ServiceTable'},
25- 'user' => {:row => 'User', :class => 'UserTable' },
26- 'session' => {:row => 'Session', :class => 'SessionTable'},
27- 'content' => {:row => 'Content' },
28- 'view' => {:row => 'View' },
29- 'widget' => {:row => 'Widget' },
30- },
31-
32- :relation => [
33- ['service.widget', 'widget' ],
34- ['user.content', 'content' ],
35- ['user.session', 'session.user' ],
36- ['content.parent', 'content.node' ],
37- ['content.view', 'view' ],
38- ['view.parent', 'view.node' ],
39- ['widget.parent', 'widget.node' ],
40- ['widget.view', 'view.widget' ],
41- ],
42- },
32+ :relation => [
33+ ['service.widget', 'widget' ],
34+ ['user.content', 'content' ],
35+ ['user.session', 'session.user' ],
36+ ['content.parent', 'content.node' ],
37+ ['content.view', 'view' ],
38+ ['content.tracklog', 'tracklog.content'],
39+ ['view.parent', 'view.node' ],
40+ ['widget.parent', 'widget.node' ],
41+ ['widget.view', 'view.widget' ],
42+ ],
4343 }
Show on old repository browser