webgen 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. data/ChangeLog +870 -0
  2. data/Rakefile +37 -36
  3. data/VERSION +1 -1
  4. data/data/webgen/resources.yaml +2 -2
  5. data/data/webgen/webgui/app.rb +11 -0
  6. data/data/webgen/webgui/controller/main.rb +30 -26
  7. data/data/webgen/webgui/{view/page.xhtml → layout/default.xhtml} +8 -8
  8. data/data/webgen/webgui/start.rb +9 -0
  9. data/data/webgen/webgui/view/create_website.xhtml +6 -14
  10. data/data/webgen/webgui/view/manage_website.xhtml +2 -2
  11. data/data/webgen/website_bundles/default/README +6 -0
  12. data/data/webgen/website_bundles/default/src/index.page +15 -0
  13. data/data/webgen/{website_styles → website_bundles/style}/1024px/README +0 -0
  14. data/data/webgen/{website_styles → website_bundles/style}/1024px/src/default.css +0 -0
  15. data/data/webgen/{website_styles → website_bundles/style}/1024px/src/default.template +0 -0
  16. data/data/webgen/{website_styles → website_bundles/style}/1024px/src/images/background.gif +0 -0
  17. data/data/webgen/{website_styles → website_bundles/style}/andreas00/README +0 -0
  18. data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/default.css +0 -0
  19. data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/default.template +0 -0
  20. data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/bg.gif +0 -0
  21. data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/front.jpg +0 -0
  22. data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/menubg.gif +0 -0
  23. data/data/webgen/{website_styles → website_bundles/style}/andreas00/src/images/menubg2.gif +0 -0
  24. data/data/webgen/{website_styles → website_bundles/style}/andreas01/README +0 -0
  25. data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/default.css +0 -0
  26. data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/default.template +0 -0
  27. data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/images/bg.gif +0 -0
  28. data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/images/front.jpg +0 -0
  29. data/data/webgen/{website_styles → website_bundles/style}/andreas01/src/print.css +0 -0
  30. data/data/webgen/{website_styles → website_bundles/style}/andreas03/README +0 -0
  31. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/default.css +0 -0
  32. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/default.template +0 -0
  33. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/bodybg.png +0 -0
  34. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/contbg.png +0 -0
  35. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/footerbg.png +0 -0
  36. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/gradient1.png +0 -0
  37. data/data/webgen/{website_styles → website_bundles/style}/andreas03/src/images/gradient2.png +0 -0
  38. data/data/webgen/{website_styles → website_bundles/style}/andreas04/README +0 -0
  39. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/default.css +0 -0
  40. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/default.template +0 -0
  41. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/blinkarrow.gif +0 -0
  42. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/bodybg.png +0 -0
  43. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/contentbg.png +0 -0
  44. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/entrybg.png +0 -0
  45. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/flash.gif +0 -0
  46. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/flash2.gif +0 -0
  47. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/globe.gif +0 -0
  48. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/globebottom.gif +0 -0
  49. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/linkarrow.gif +0 -0
  50. data/data/webgen/{website_styles → website_bundles/style}/andreas04/src/images/menuhover.png +0 -0
  51. data/data/webgen/{website_styles → website_bundles/style}/andreas05/README +0 -0
  52. data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/default.css +0 -0
  53. data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/default.template +0 -0
  54. data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/images/bodybg.gif +0 -0
  55. data/data/webgen/{website_styles → website_bundles/style}/andreas05/src/images/front.png +0 -0
  56. data/data/webgen/{website_styles → website_bundles/style}/andreas06/README +0 -0
  57. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/default.css +6 -4
  58. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/default.template +2 -2
  59. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/bodybg.gif +0 -0
  60. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/boxbg.gif +0 -0
  61. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/greypx.gif +0 -0
  62. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/header.jpg +0 -0
  63. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/innerbg.gif +0 -0
  64. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/leaves.jpg +0 -0
  65. data/data/webgen/{website_styles → website_bundles/style}/andreas06/src/images/tabs.gif +0 -0
  66. data/data/webgen/{website_styles → website_bundles/style}/andreas07/README +0 -0
  67. data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/browserfix.css +0 -0
  68. data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/default.css +0 -0
  69. data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/default.template +0 -0
  70. data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/images/bodybg.gif +0 -0
  71. data/data/webgen/{website_styles → website_bundles/style}/andreas07/src/images/sidebarbg.gif +0 -0
  72. data/data/webgen/{website_styles → website_bundles/style}/andreas08/README +0 -0
  73. data/data/webgen/{website_styles → website_bundles/style}/andreas08/src/default.css +0 -0
  74. data/data/webgen/{website_styles → website_bundles/style}/andreas08/src/default.template +0 -0
  75. data/data/webgen/{website_styles → website_bundles/style}/andreas09/README +0 -0
  76. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/default.css +0 -0
  77. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/default.template +0 -0
  78. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-black.jpg +0 -0
  79. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-green.jpg +0 -0
  80. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-orange.jpg +0 -0
  81. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-purple.jpg +0 -0
  82. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg-red.jpg +0 -0
  83. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/bodybg.jpg +0 -0
  84. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/footerbg.jpg +0 -0
  85. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-black.jpg +0 -0
  86. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-green.jpg +0 -0
  87. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-orange.jpg +0 -0
  88. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-purple.jpg +0 -0
  89. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover-red.jpg +0 -0
  90. data/data/webgen/{website_styles → website_bundles/style}/andreas09/src/images/menuhover.jpg +0 -0
  91. data/data/webgen/{website_styles → website_bundles/style}/simple/README +0 -0
  92. data/data/webgen/{website_styles → website_bundles/style}/simple/src/default.css +0 -0
  93. data/data/webgen/{website_styles → website_bundles/style}/simple/src/default.template +0 -0
  94. data/data/webgen/website_skeleton/README +1 -1
  95. data/data/webgen/website_skeleton/config.yaml +5 -4
  96. data/doc/contentprocessor/blocks.page +43 -10
  97. data/doc/contentprocessor/builder.page +1 -1
  98. data/doc/contentprocessor/erb.page +12 -11
  99. data/doc/contentprocessor/redcloth.page +3 -1
  100. data/doc/extensions.page +3 -3
  101. data/doc/faq.page +13 -10
  102. data/doc/getting_started.page +12 -15
  103. data/doc/index.page +7 -1
  104. data/doc/manual.page +78 -27
  105. data/doc/reference_configuration.page +166 -3
  106. data/doc/reference_website_styles.page +28 -0
  107. data/doc/source/filesystem.page +39 -0
  108. data/doc/source/tararchive.page +40 -0
  109. data/doc/tag/tikz.page +2 -1
  110. data/doc/webgen_page_format.page +13 -12
  111. data/doc/website_styles.metainfo +8 -0
  112. data/lib/webgen/blackboard.rb +2 -2
  113. data/lib/webgen/cache.rb +4 -4
  114. data/lib/webgen/cli.rb +29 -16
  115. data/lib/webgen/cli/apply_command.rb +66 -0
  116. data/lib/webgen/cli/create_command.rb +22 -16
  117. data/lib/webgen/cli/utils.rb +23 -0
  118. data/lib/webgen/cli/webgui_command.rb +31 -16
  119. data/lib/webgen/configuration.rb +8 -6
  120. data/lib/webgen/contentprocessor.rb +4 -5
  121. data/lib/webgen/contentprocessor/blocks.rb +2 -0
  122. data/lib/webgen/contentprocessor/builder.rb +6 -3
  123. data/lib/webgen/contentprocessor/erb.rb +6 -3
  124. data/lib/webgen/contentprocessor/erubis.rb +7 -6
  125. data/lib/webgen/contentprocessor/haml.rb +6 -3
  126. data/lib/webgen/contentprocessor/rdoc.rb +0 -1
  127. data/lib/webgen/contentprocessor/redcloth.rb +3 -1
  128. data/lib/webgen/context.rb +73 -0
  129. data/lib/webgen/context/nodes.rb +36 -0
  130. data/lib/webgen/coreext.rb +3 -2
  131. data/lib/webgen/default_config.rb +3 -1
  132. data/lib/webgen/deprecated.rb +53 -0
  133. data/lib/webgen/node.rb +24 -19
  134. data/lib/webgen/output.rb +50 -7
  135. data/lib/webgen/page.rb +45 -36
  136. data/lib/webgen/path.rb +1 -1
  137. data/lib/webgen/source.rb +32 -4
  138. data/lib/webgen/source/resource.rb +3 -3
  139. data/lib/webgen/source/stacked.rb +1 -1
  140. data/lib/webgen/source/tararchive.rb +73 -0
  141. data/lib/webgen/sourcehandler.rb +4 -4
  142. data/lib/webgen/sourcehandler/base.rb +36 -24
  143. data/lib/webgen/sourcehandler/copy.rb +1 -1
  144. data/lib/webgen/sourcehandler/feed.rb +2 -2
  145. data/lib/webgen/sourcehandler/fragment.rb +1 -1
  146. data/lib/webgen/sourcehandler/metainfo.rb +15 -6
  147. data/lib/webgen/sourcehandler/page.rb +9 -5
  148. data/lib/webgen/sourcehandler/virtual.rb +44 -7
  149. data/lib/webgen/tag/base.rb +19 -13
  150. data/lib/webgen/tag/link.rb +1 -0
  151. data/lib/webgen/version.rb +1 -1
  152. data/lib/webgen/webgentask.rb +15 -13
  153. data/lib/webgen/website.rb +42 -11
  154. data/lib/webgen/websiteaccess.rb +1 -1
  155. data/lib/webgen/websitemanager.rb +61 -66
  156. data/man/man1/webgen.1 +4 -0
  157. data/misc/default.css +13 -0
  158. data/misc/default.template +1 -1
  159. data/misc/htmldoc.metainfo +2 -1
  160. data/misc/style.page +33 -0
  161. data/test/test_cli.rb +1 -7
  162. data/test/test_common_sitemap.rb +2 -2
  163. data/test/test_contentprocessor_blocks.rb +14 -1
  164. data/test/test_contentprocessor_builder.rb +3 -1
  165. data/test/test_contentprocessor_erb.rb +3 -2
  166. data/test/test_contentprocessor_erubis.rb +3 -3
  167. data/test/test_contentprocessor_fragments.rb +3 -3
  168. data/test/test_contentprocessor_haml.rb +3 -2
  169. data/test/test_contentprocessor_maruku.rb +3 -3
  170. data/test/test_contentprocessor_rdiscount.rb +1 -1
  171. data/test/test_contentprocessor_rdoc.rb +1 -1
  172. data/test/test_contentprocessor_redcloth.rb +9 -2
  173. data/test/test_contentprocessor_sass.rb +1 -1
  174. data/test/test_contentprocessor_tags.rb +1 -1
  175. data/test/{test_contentprocessor_context.rb → test_context.rb} +9 -7
  176. data/test/test_node.rb +27 -21
  177. data/test/test_page.rb +4 -4
  178. data/test/test_source_tararchive.rb +65 -0
  179. data/test/test_sourcehandler_fragment.rb +1 -1
  180. data/test/test_sourcehandler_memory.rb +6 -6
  181. data/test/test_sourcehandler_metainfo.rb +34 -13
  182. data/test/test_sourcehandler_page.rb +8 -0
  183. data/test/test_sourcehandler_virtual.rb +51 -12
  184. data/test/test_tag_breadcrumbtrail.rb +4 -4
  185. data/test/test_tag_coderay.rb +1 -1
  186. data/test/test_tag_date.rb +1 -1
  187. data/test/test_tag_executecommand.rb +1 -1
  188. data/test/test_tag_includefile.rb +3 -3
  189. data/test/test_tag_langbar.rb +6 -6
  190. data/test/test_tag_link.rb +8 -2
  191. data/test/test_tag_menu.rb +9 -9
  192. data/test/test_tag_metainfo.rb +1 -1
  193. data/test/test_tag_relocatable.rb +1 -1
  194. data/test/test_tag_sitemap.rb +1 -1
  195. data/test/test_tag_tikz.rb +2 -2
  196. data/test/test_website.rb +17 -0
  197. data/test/test_websitemanager.rb +16 -21
  198. metadata +146 -187
  199. data/data/webgen/website_templates/default/README +0 -6
  200. data/data/webgen/website_templates/default/src/index.page +0 -8
  201. data/data/webgen/website_templates/project/README +0 -5
  202. data/data/webgen/website_templates/project/src/about.page +0 -12
  203. data/data/webgen/website_templates/project/src/download.page +0 -15
  204. data/data/webgen/website_templates/project/src/features.page +0 -8
  205. data/data/webgen/website_templates/project/src/index.page +0 -9
  206. data/data/webgen/website_templates/project/src/screenshots.page +0 -18
  207. data/lib/webgen/contentprocessor/context.rb +0 -89
data/Rakefile CHANGED
@@ -7,6 +7,8 @@ begin
7
7
  rescue LoadError
8
8
  end
9
9
 
10
+ require 'rdoc/task'
11
+
10
12
  begin
11
13
  require 'rubyforge'
12
14
  rescue LoadError
@@ -17,16 +19,10 @@ begin
17
19
  rescue LoadError
18
20
  end
19
21
 
20
- begin
21
- require 'dcov'
22
- rescue LoadError
23
- end
24
-
25
22
  require 'fileutils'
26
23
  require 'rake/clean'
27
24
  require 'rake/testtask'
28
25
  require 'rake/packagetask'
29
- require 'rake/rdoctask'
30
26
 
31
27
  $:.unshift('lib')
32
28
  require 'webgen/webgentask'
@@ -60,16 +56,23 @@ Webgen::WebgenTask.new('htmldoc') do |site|
60
56
  ['/', "Webgen::Source::FileSystem", 'misc', 'htmldoc.metainfo'],
61
57
  ['/', "Webgen::Source::FileSystem", 'misc', 'htmldoc.virtual'],
62
58
  ['/', "Webgen::Source::FileSystem", 'misc', 'images/**/*']]
59
+ prefix = "webgen-website-bundle-"
60
+ config['resources'].select {|name, data| name =~ /^#{prefix}style/}.each do |name, data|
61
+ config['sources'] <<
62
+ ["/website_styles/#{name.sub(prefix, '')}", "Webgen::Source::FileSystem", 'misc', 'style.page']
63
+ config['sources'] <<
64
+ ["/website_styles/#{name.sub(prefix, '')}", 'Webgen::Source::Resource', name, '/src/**', '/src']
65
+ end
63
66
  config['output'] = ['Webgen::Output::FileSystem', 'htmldoc']
64
67
  end
65
68
  end
66
69
 
67
- rd = Rake::RDocTask.new do |rdoc|
70
+ rd = RDoc::Task.new do |rdoc|
68
71
  rdoc.rdoc_dir = 'htmldoc/rdoc'
69
72
  rdoc.title = 'webgen'
70
- rdoc.main = 'Webgen'
71
- rdoc.options << '--line-numbers' << '--inline-source' << '--promiscuous'
72
- rdoc.rdoc_files.include('lib/**/*.rb')
73
+ rdoc.main = 'lib/webgen/website.rb'
74
+ rdoc.options << '--line-numbers' << '--all'
75
+ rdoc.rdoc_files.include('lib')
73
76
  end
74
77
 
75
78
  tt = Rake::TestTask.new do |test|
@@ -156,23 +159,23 @@ EOF
156
159
  #### Dependencies, requirements and files
157
160
 
158
161
  s.files = PKG_FILES.to_a
159
- s.add_dependency('cmdparse', '2.0.2')
162
+ s.add_dependency('cmdparse', '>= 2.0.2')
160
163
  s.add_dependency('maruku', '0.5.9')
161
- s.add_dependency('facets', '2.4.3')
162
- s.add_dependency('rake', '0.8.3')
163
- s.add_dependency('ramaze', '2008.06')
164
- s.add_dependency('launchy', '0.3.2')
165
- s.add_development_dependency('rcov', '0.8.1.2.0')
166
- s.add_development_dependency('dcov', '0.2.2')
167
- s.add_development_dependency('rubyforge', '1.0.0')
168
- s.add_development_dependency('RedCloth', '3.0.0')
169
- s.add_development_dependency('haml', '2.0.1')
170
- s.add_development_dependency('builder', '2.1.2')
171
- s.add_development_dependency('rdoc', '2.0.0')
172
- s.add_development_dependency('coderay', '0.7.4.215')
173
- s.add_development_dependency('feedtools', '0.2.29')
174
- s.add_development_dependency('erubis', '2.6.2')
175
- s.add_development_dependency('rdiscount', '1.2.9')
164
+ s.add_dependency('facets', '2.4.5')
165
+ s.add_development_dependency('rake', '>= 0.8.3')
166
+ s.add_development_dependency('ramaze', '>= 2009.04')
167
+ s.add_development_dependency('launchy', '>= 0.3.2')
168
+ s.add_development_dependency('rcov', '>= 0.8.1.2.0')
169
+ s.add_development_dependency('rubyforge', '>= 1.0.0')
170
+ s.add_development_dependency('RedCloth', '>= 4.1.9')
171
+ s.add_development_dependency('haml', '>= 2.0.9')
172
+ s.add_development_dependency('builder', '>= 2.1.0')
173
+ s.add_development_dependency('rdoc', '>= 2.4.2')
174
+ s.add_development_dependency('coderay', '>= 0.7.4.214')
175
+ s.add_development_dependency('feedtools', '>= 0.2.29')
176
+ s.add_development_dependency('erubis', '>= 2.6.2')
177
+ s.add_development_dependency('rdiscount', '>= 1.2.9')
178
+ s.add_development_dependency('archive-tar-minitar', '>= 0.5.2')
176
179
 
177
180
  s.require_path = 'lib'
178
181
 
@@ -182,7 +185,7 @@ EOF
182
185
  #### Documentation
183
186
 
184
187
  s.has_rdoc = true
185
- s.rdoc_options = ['--line-numbers', '--inline-source', '--promiscuous', '--main', 'Webgen']
188
+ s.rdoc_options = ['--line-numbers', '--all', '--main', 'lib/webgen/website.rb']
186
189
 
187
190
  #### Author and project details
188
191
 
@@ -273,6 +276,13 @@ The official version is called 'webgen' and can be installed via
273
276
  ['/', "Webgen::Source::FileSystem", '../misc', 'default.css'],
274
277
  ['/documentation/', "Webgen::Source::FileSystem", '../misc', 'htmldoc.virtual'],
275
278
  ['/', "Webgen::Source::FileSystem", '../misc', 'images/**/*']]
279
+ prefix = "webgen-website-bundle-"
280
+ config['resources'].select {|name, data| name =~ /^#{prefix}style/}.each do |name, data|
281
+ config['sources'] <<
282
+ ["/documentation/website_styles/#{name.sub(prefix, '')}", "Webgen::Source::FileSystem", '../misc', 'style.page']
283
+ config['sources'] <<
284
+ ["/documentation/website_styles/#{name.sub(prefix, '')}", 'Webgen::Source::Resource', name, '/src/**', '/src']
285
+ end
276
286
  end
277
287
  end
278
288
 
@@ -302,15 +312,6 @@ The official version is called 'webgen' and can be installed via
302
312
  end
303
313
  end
304
314
 
305
- if defined? Dcov
306
- desc "Analyze documentation coverage"
307
- task :dcov do
308
- class Dcov::Analyzer; def generate; end; end
309
- class NilClass; def file_absolute_name; nil; end; end
310
- Dcov::Analyzer.new(:path => Dir.getwd, :files => Dir.glob('lib/**'))
311
- end
312
- end
313
-
314
315
  EXCLUDED_FOR_TESTS=FileList.new(['lib/webgen/cli{*,**/*}', 'lib/webgen/version.rb',
315
316
  'lib/webgen/output.rb', 'lib/webgen/source.rb',
316
317
  'lib/webgen/tag.rb', 'lib/webgen/default_config.rb',
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.7
1
+ 0.5.8
@@ -1,3 +1,3 @@
1
1
  website_skeleton: webgen-website-skeleton
2
- website_styles/*: webgen-website-style-$basename
3
- website_templates/*: webgen-website-template-$basename
2
+ website_bundles/style/*: webgen-website-bundle-style-$basename
3
+ website_bundles/default: webgen-website-bundle-default
@@ -0,0 +1,11 @@
1
+ # This file contains your application, it requires dependencies and necessary
2
+ # parts of the application.
3
+ #
4
+ # It will be required from either `config.ru` or `start.rb`
5
+
6
+ # Add the directory this file resides in to the load path, so you can run the
7
+ # app from any other working directory
8
+ $LOAD_PATH.unshift(__DIR__)
9
+
10
+ # Initialize controllers and models
11
+ require 'controller/main'
@@ -34,19 +34,26 @@ class MemoryOutput
34
34
 
35
35
  end
36
36
 
37
+
37
38
  class MainController < Ramaze::Controller
38
39
 
39
- layout '/page'
40
+ layout(:default) {|name, wish| !["path_autocomplete", "preview_website", "preview_website_bundles"].include?(name)}
41
+ helper :xhtml
42
+ engine :Etanni
43
+
44
+ def initialize
45
+ @title = 'webgen webgui'
46
+ end
40
47
 
41
48
  def site_ops
42
49
  session['website_dir'] = request['website_dir'].to_s
43
50
 
44
51
  if File.directory?(session['website_dir'])
45
- redirect R(:manage_website)
52
+ redirect r(:manage_website)
46
53
  elsif session['website_dir']
47
- redirect R(:create_website)
54
+ redirect r(:create_website)
48
55
  else
49
- redirect R('/')
56
+ redirect r('/')
50
57
  end
51
58
  end
52
59
 
@@ -57,7 +64,6 @@ class MainController < Ramaze::Controller
57
64
  ''
58
65
  end
59
66
  end
60
- deny_layout :path_autocomplete
61
67
 
62
68
  def manage_website
63
69
  if request['render_site'] && session['website_dir']
@@ -77,37 +83,29 @@ class MainController < Ramaze::Controller
77
83
  ws = Webgen::Website.new(session['website_dir'])
78
84
  ws.init
79
85
  ws.execute_in_env do
80
- oi = ws.blackboard.invoke(:output_instance)
81
- path = File.join(*args)
82
- response.header["Content-Type"] = Ramaze::Tool::MIME.trait[:types][File.extname(path)].to_s
83
- response.header['Cache-Control'] = 'no-store'
84
- response.header['Pragma'] = 'no-cache'
85
- response.body = (oi.read(path) rescue '')
86
- throw(:respond)
86
+ send_preview_file(args, ws.blackboard.invoke(:output_instance))
87
87
  end
88
88
  end
89
89
 
90
90
  def create_website
91
- @cur_style = request['website_style'] || @cur_style || '1024px'
92
- @cur_template = request['website_template'] || @cur_template || 'default'
91
+ @cur_bundle = request['website_bundle'] || @cur_bundle || 'style-andreas07'
93
92
 
94
93
  if request['create_site']
95
94
  wm = Webgen::WebsiteManager.new(session['website_dir'])
96
95
  wm.create_website
97
- wm.apply_template(@cur_template)
98
- wm.apply_style(@cur_style)
96
+ wm.apply_bundle('default')
97
+ wm.apply_bundle(@cur_bundle)
99
98
 
100
- redirect R(:manage_website)
99
+ redirect r(:manage_website)
101
100
  else
102
101
  wm = Webgen::WebsiteManager.new(session['website_dir'])
103
- @templates = wm.templates.keys.sort
104
- @styles = wm.styles.keys.select {|k| k =~ /^website-|[^-]+/ }.sort
102
+ @bundles = wm.bundles.keys.sort
105
103
 
106
- if !@cur_style.nil? && !@cur_template.nil?
104
+ if !@cur_bundle.nil?
107
105
  ws = Webgen::Website.new('unknown', nil) do |config|
108
106
  config['sources'] = [
109
- ['/', 'Webgen::Source::Resource', 'webgen-website-template-' + @cur_template, '/src/**', '/src'],
110
- ['/', 'Webgen::Source::Resource', 'webgen-website-style-' + @cur_style, '/src/**', '/src']
107
+ ['/', 'Webgen::Source::Resource', 'webgen-website-bundle-default', '/src/**', '/src'],
108
+ ['/', 'Webgen::Source::Resource', 'webgen-website-bundle-' + @cur_bundle, '/src/**', '/src']
111
109
  ]
112
110
  config['output'] = ['MemoryOutput']
113
111
  config['website.cache'] = [:memory, '']
@@ -118,14 +116,20 @@ class MainController < Ramaze::Controller
118
116
  end
119
117
  end
120
118
 
121
- def preview_style_and_template(*args)
119
+ def preview_website_bundles(*args)
122
120
  throw(:respond) unless session['create_website_preview']
121
+ send_preview_file(args, session['create_website_preview'])
122
+ end
123
+
124
+ def send_preview_file(args, oi)
123
125
  path = File.join(*args)
124
- response.header["Content-Type"] = Ramaze::Tool::MIME.trait[:types][File.extname(path)].to_s
126
+ path += ".html" if path !~ /\.\w+$/
127
+ response.header["Content-Type"] = Rack::Mime.mime_type(File.extname(path)).to_s
125
128
  response.header['Cache-Control'] = 'no-store'
126
129
  response.header['Pragma'] = 'no-cache'
127
- response.body = session['create_website_preview'].read(path)
128
- throw(:respond)
130
+ response.body = [(oi.read(path) rescue '')]
131
+ throw(:respond, response)
129
132
  end
133
+ private :send_preview_file
130
134
 
131
135
  end
@@ -7,24 +7,24 @@
7
7
  <meta http-equiv="Content-Style-Type" content="text/css" />
8
8
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
9
 
10
- <link href="#{R '/css/style.css'}" rel="stylesheet" type="text/css" />
11
- <link href="#{R '/css/jquery.autocomplete.css'}" rel="stylesheet" type="text/css" />
10
+ <link href="#{r '/css/style.css'}" rel="stylesheet" type="text/css" />
11
+ <link href="#{r '/css/jquery.autocomplete.css'}" rel="stylesheet" type="text/css" />
12
12
 
13
- <script type='text/javascript' src="#{R '/js/jquery.js'}"></script>
14
- <script type='text/javascript' src="#{R '/js/jquery.autocomplete.js'}"></script>
13
+ <script type='text/javascript' src="#{r '/js/jquery.js'}"></script>
14
+ <script type='text/javascript' src="#{r '/js/jquery.autocomplete.js'}"></script>
15
15
  <script type='text/javascript'>
16
16
  $(document).ready(function() {
17
- $("#website_dir").autocomplete('#{R MainController, :path_autocomplete}');
17
+ $("#website_dir").autocomplete('#{r :path_autocomplete}');
18
18
  });
19
19
  </script>
20
20
  </head>
21
21
  <body>
22
22
  <div id="header">
23
- <img src="#{R '/img/webgen_logo.png'}" alt='logo' />
24
- <h2><a href="#{R '/'}">webgen <span>webgui</span></a></h2>
23
+ <img src="#{r '/img/webgen_logo.png'}" alt='logo' />
24
+ <h2><a href="#{r '/'}">webgen <span>webgui</span></a></h2>
25
25
 
26
26
  <div id='site-select-form'>
27
- <form method='post' action='#{R MainController, :site_ops}'>
27
+ <form method='post' action='#{r :site_ops}'>
28
28
  <p>
29
29
  <input type='text' id='website_dir' name='website_dir' value='#{session["website_dir"]}' size="70" />
30
30
  <input type='submit' id='set_site' name='set_site' value='Set website directory' />
@@ -0,0 +1,9 @@
1
+ # Use this file directly like `ruby start.rb` if you don't want to use the
2
+ # `ramaze start` command.
3
+ # All application related things should go into `app.rb`, this file is simply
4
+ # for options related to running the application locally.
5
+
6
+ require 'ramaze'
7
+ require File.expand_path('app', File.dirname(__FILE__))
8
+
9
+ Ramaze.start(:adapter => :webrick, :port => 7000, :file => __FILE__)
@@ -1,22 +1,14 @@
1
- <form method='post' action='#{R :create_website}'>
1
+ <form method='post' action='#{r :create_website}'>
2
2
  <p>
3
- Choose a <label for="website_style">style:</label>
4
- <select name="website_style" id="website_style">
5
- <?r for style in @styles ?>
6
- <option #{style == @cur_style ? selected='selected' : ''}>#{style}</option>
3
+ Choose a <label for="website_style">website bundle:</label>
4
+ <select name="website_bundle" id="website_bundle">
5
+ <?r for bundle in @bundles ?>
6
+ <option #{bundle == @cur_bundle ? selected='selected' : ''}>#{bundle}</option>
7
7
  <?r end ?>
8
8
  </select>
9
-
10
- and a <label for="website_template">template:</label>
11
- <select name="website_template" id="website_template">
12
- <?r for template in @templates ?>
13
- <option #{template == @cur_template ? selected='selected' : ''}>#{template}</option>
14
- <?r end ?>
15
- </select>
16
-
17
9
  <input type='submit' id='preview_site' name='preview_site' value='Preview website' />
18
10
  <input type='submit' id='create_site' name='create_site' value='Create website' />
19
11
  </p>
20
12
  </form>
21
13
 
22
- <object type='text/html' data='#{R :preview_style_and_template, "/index.html"}' width='100%' height='600px' style='border: 1px solid black' />
14
+ <object type='text/html' data='#{r :preview_website_bundles, "/index.html"}' width='100%' height='600px' style='border: 1px solid black' />
@@ -1,4 +1,4 @@
1
- <form method='post' action='#{R :manage_website}'>
1
+ <form method='post' action='#{r :manage_website}'>
2
2
  <p>
3
3
  <label for='verbosity'>Verbosity:
4
4
  <select id='verbosity' name='verbosity'>
@@ -15,4 +15,4 @@
15
15
  <pre>#{CGI::escapeHTML(@log.to_s)}</pre>
16
16
  </div>
17
17
 
18
- <object id='website_preview' type='text/html' data='#{R :preview_website, "/index.html"}' width='100%' height='600px' style='border: 1px solid black' />
18
+ <object id='website_preview' type='text/html' data='#{r :preview_website, "/index.html"}' width='100%' height='600px' style='border: 1px solid black' />
@@ -0,0 +1,6 @@
1
+ description:
2
+ This is the default website bundle. It only contains a sample index page sothat something is shown
3
+ after a new website is created.
4
+
5
+ author:
6
+ Thomas Leitner
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Empty Index Page
3
+ in_menu: true
4
+ routed_title: New webgen Website
5
+ ---
6
+ ## Welcome to *webgen*!
7
+
8
+ This is just a place holder for the start page for your new website!
9
+
10
+ You can start by adjusting the meta information for this page file and adding some real content and
11
+ then adding some more page files!
12
+
13
+ For more information about webgen have a look at the [documentation]!
14
+
15
+ [documentation]: http://webgen.rubyforge.org/documentation/index.html