webgen 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. data/ChangeLog +76 -0
  2. data/Rakefile +23 -18
  3. data/TODO +5 -0
  4. data/VERSION +1 -1
  5. data/doc/metainfo.yaml +4 -1
  6. data/doc/src/default.template +5 -1
  7. data/doc/src/documentation/basics.page +148 -0
  8. data/doc/src/documentation/extending_webgen.page +4 -1
  9. data/doc/src/documentation/index.page +6 -3
  10. data/doc/src/documentation/plugins/core/filehandler.page +1 -1
  11. data/doc/src/documentation/plugins/file/directoryhandler.page +1 -1
  12. data/doc/src/documentation/references/index.page +20 -1
  13. data/doc/src/documentation/references/meta_info_reference.page +2 -1
  14. data/doc/src/documentation/{gettingstarted.page → tutorial.page} +6 -103
  15. data/doc/src/news.page +11 -0
  16. data/lib/webgen/config.rb +4 -4
  17. data/lib/webgen/node.rb +4 -2
  18. data/lib/webgen/plugins/filehandlers/template.rb +3 -1
  19. data/lib/webgen/plugins/miscplugins/rendered_files.rb +75 -0
  20. data/lib/webgen/rake/webgentask.rb +161 -0
  21. data/test/fixtures/sample_site/src/index.de.page +1 -0
  22. data/test/unittests/tc_filehandler_template.rb +3 -0
  23. data/test/unittests/tc_node.rb +3 -0
  24. metadata +6 -266
  25. data/doc/examples/website_styles/1024px/README +0 -9
  26. data/doc/examples/website_styles/1024px/config.yaml +0 -2
  27. data/doc/examples/website_styles/1024px/src/about.page +0 -12
  28. data/doc/examples/website_styles/1024px/src/default.css +0 -188
  29. data/doc/examples/website_styles/1024px/src/default.template +0 -62
  30. data/doc/examples/website_styles/1024px/src/download.page +0 -15
  31. data/doc/examples/website_styles/1024px/src/features.page +0 -8
  32. data/doc/examples/website_styles/1024px/src/images/background.gif +0 -0
  33. data/doc/examples/website_styles/1024px/src/index.page +0 -9
  34. data/doc/examples/website_styles/1024px/src/screenshots.page +0 -18
  35. data/doc/examples/website_styles/andreas00/README +0 -9
  36. data/doc/examples/website_styles/andreas00/config.yaml +0 -2
  37. data/doc/examples/website_styles/andreas00/src/about.page +0 -12
  38. data/doc/examples/website_styles/andreas00/src/default.css +0 -290
  39. data/doc/examples/website_styles/andreas00/src/default.template +0 -62
  40. data/doc/examples/website_styles/andreas00/src/download.page +0 -15
  41. data/doc/examples/website_styles/andreas00/src/features.page +0 -8
  42. data/doc/examples/website_styles/andreas00/src/images/bg.gif +0 -0
  43. data/doc/examples/website_styles/andreas00/src/images/front.jpg +0 -0
  44. data/doc/examples/website_styles/andreas00/src/images/menubg.gif +0 -0
  45. data/doc/examples/website_styles/andreas00/src/images/menubg2.gif +0 -0
  46. data/doc/examples/website_styles/andreas00/src/index.page +0 -9
  47. data/doc/examples/website_styles/andreas00/src/screenshots.page +0 -18
  48. data/doc/examples/website_styles/andreas01/README +0 -9
  49. data/doc/examples/website_styles/andreas01/config.yaml +0 -2
  50. data/doc/examples/website_styles/andreas01/src/about.page +0 -12
  51. data/doc/examples/website_styles/andreas01/src/default.css +0 -310
  52. data/doc/examples/website_styles/andreas01/src/default.template +0 -63
  53. data/doc/examples/website_styles/andreas01/src/download.page +0 -15
  54. data/doc/examples/website_styles/andreas01/src/features.page +0 -8
  55. data/doc/examples/website_styles/andreas01/src/images/bg.gif +0 -0
  56. data/doc/examples/website_styles/andreas01/src/images/front.jpg +0 -0
  57. data/doc/examples/website_styles/andreas01/src/index.page +0 -9
  58. data/doc/examples/website_styles/andreas01/src/print.css +0 -35
  59. data/doc/examples/website_styles/andreas01/src/screenshots.page +0 -18
  60. data/doc/examples/website_styles/andreas03/README +0 -9
  61. data/doc/examples/website_styles/andreas03/config.yaml +0 -2
  62. data/doc/examples/website_styles/andreas03/src/about.page +0 -12
  63. data/doc/examples/website_styles/andreas03/src/default.css +0 -223
  64. data/doc/examples/website_styles/andreas03/src/default.template +0 -60
  65. data/doc/examples/website_styles/andreas03/src/download.page +0 -15
  66. data/doc/examples/website_styles/andreas03/src/features.page +0 -8
  67. data/doc/examples/website_styles/andreas03/src/images/bodybg.png +0 -0
  68. data/doc/examples/website_styles/andreas03/src/images/contbg.png +0 -0
  69. data/doc/examples/website_styles/andreas03/src/images/footerbg.png +0 -0
  70. data/doc/examples/website_styles/andreas03/src/images/gradient1.png +0 -0
  71. data/doc/examples/website_styles/andreas03/src/images/gradient2.png +0 -0
  72. data/doc/examples/website_styles/andreas03/src/index.page +0 -9
  73. data/doc/examples/website_styles/andreas03/src/screenshots.page +0 -18
  74. data/doc/examples/website_styles/andreas04/README +0 -9
  75. data/doc/examples/website_styles/andreas04/config.yaml +0 -2
  76. data/doc/examples/website_styles/andreas04/src/about.page +0 -12
  77. data/doc/examples/website_styles/andreas04/src/default.css +0 -290
  78. data/doc/examples/website_styles/andreas04/src/default.template +0 -83
  79. data/doc/examples/website_styles/andreas04/src/download.page +0 -15
  80. data/doc/examples/website_styles/andreas04/src/features.page +0 -8
  81. data/doc/examples/website_styles/andreas04/src/images/blinkarrow.gif +0 -0
  82. data/doc/examples/website_styles/andreas04/src/images/bodybg.png +0 -0
  83. data/doc/examples/website_styles/andreas04/src/images/contentbg.png +0 -0
  84. data/doc/examples/website_styles/andreas04/src/images/entrybg.png +0 -0
  85. data/doc/examples/website_styles/andreas04/src/images/flash.gif +0 -0
  86. data/doc/examples/website_styles/andreas04/src/images/flash2.gif +0 -0
  87. data/doc/examples/website_styles/andreas04/src/images/globe.gif +0 -0
  88. data/doc/examples/website_styles/andreas04/src/images/globebottom.gif +0 -0
  89. data/doc/examples/website_styles/andreas04/src/images/linkarrow.gif +0 -0
  90. data/doc/examples/website_styles/andreas04/src/images/menuhover.png +0 -0
  91. data/doc/examples/website_styles/andreas04/src/index.page +0 -9
  92. data/doc/examples/website_styles/andreas04/src/screenshots.page +0 -18
  93. data/doc/examples/website_styles/andreas05/README +0 -9
  94. data/doc/examples/website_styles/andreas05/config.yaml +0 -2
  95. data/doc/examples/website_styles/andreas05/src/about.page +0 -12
  96. data/doc/examples/website_styles/andreas05/src/default.css +0 -33
  97. data/doc/examples/website_styles/andreas05/src/default.template +0 -42
  98. data/doc/examples/website_styles/andreas05/src/download.page +0 -15
  99. data/doc/examples/website_styles/andreas05/src/features.page +0 -8
  100. data/doc/examples/website_styles/andreas05/src/images/bodybg.gif +0 -0
  101. data/doc/examples/website_styles/andreas05/src/images/front.png +0 -0
  102. data/doc/examples/website_styles/andreas05/src/index.page +0 -9
  103. data/doc/examples/website_styles/andreas05/src/screenshots.page +0 -18
  104. data/doc/examples/website_styles/andreas06/README +0 -9
  105. data/doc/examples/website_styles/andreas06/config.yaml +0 -2
  106. data/doc/examples/website_styles/andreas06/src/about.page +0 -12
  107. data/doc/examples/website_styles/andreas06/src/default.css +0 -353
  108. data/doc/examples/website_styles/andreas06/src/default.template +0 -72
  109. data/doc/examples/website_styles/andreas06/src/download.page +0 -15
  110. data/doc/examples/website_styles/andreas06/src/features.page +0 -8
  111. data/doc/examples/website_styles/andreas06/src/images/bodybg.gif +0 -0
  112. data/doc/examples/website_styles/andreas06/src/images/boxbg.gif +0 -0
  113. data/doc/examples/website_styles/andreas06/src/images/greypx.gif +0 -0
  114. data/doc/examples/website_styles/andreas06/src/images/header.jpg +0 -0
  115. data/doc/examples/website_styles/andreas06/src/images/innerbg.gif +0 -0
  116. data/doc/examples/website_styles/andreas06/src/images/leaves.jpg +0 -0
  117. data/doc/examples/website_styles/andreas06/src/images/tabs.gif +0 -0
  118. data/doc/examples/website_styles/andreas06/src/index.page +0 -9
  119. data/doc/examples/website_styles/andreas06/src/screenshots.page +0 -18
  120. data/doc/examples/website_styles/andreas07/README +0 -9
  121. data/doc/examples/website_styles/andreas07/config.yaml +0 -2
  122. data/doc/examples/website_styles/andreas07/src/about.page +0 -12
  123. data/doc/examples/website_styles/andreas07/src/browserfix.css +0 -7
  124. data/doc/examples/website_styles/andreas07/src/default.css +0 -92
  125. data/doc/examples/website_styles/andreas07/src/default.template +0 -44
  126. data/doc/examples/website_styles/andreas07/src/download.page +0 -15
  127. data/doc/examples/website_styles/andreas07/src/features.page +0 -8
  128. data/doc/examples/website_styles/andreas07/src/images/bodybg.gif +0 -0
  129. data/doc/examples/website_styles/andreas07/src/images/sidebarbg.gif +0 -0
  130. data/doc/examples/website_styles/andreas07/src/index.page +0 -9
  131. data/doc/examples/website_styles/andreas07/src/screenshots.page +0 -18
  132. data/doc/examples/website_styles/andreas08/README +0 -9
  133. data/doc/examples/website_styles/andreas08/config.yaml +0 -2
  134. data/doc/examples/website_styles/andreas08/src/about.page +0 -12
  135. data/doc/examples/website_styles/andreas08/src/default.css +0 -224
  136. data/doc/examples/website_styles/andreas08/src/default.template +0 -53
  137. data/doc/examples/website_styles/andreas08/src/download.page +0 -15
  138. data/doc/examples/website_styles/andreas08/src/features.page +0 -8
  139. data/doc/examples/website_styles/andreas08/src/index.page +0 -9
  140. data/doc/examples/website_styles/andreas08/src/screenshots.page +0 -18
  141. data/doc/examples/website_styles/andreas09/README +0 -9
  142. data/doc/examples/website_styles/andreas09/config.yaml +0 -2
  143. data/doc/examples/website_styles/andreas09/src/about.page +0 -12
  144. data/doc/examples/website_styles/andreas09/src/default.css +0 -308
  145. data/doc/examples/website_styles/andreas09/src/default.template +0 -70
  146. data/doc/examples/website_styles/andreas09/src/download.page +0 -15
  147. data/doc/examples/website_styles/andreas09/src/features.page +0 -8
  148. data/doc/examples/website_styles/andreas09/src/images/bodybg-black.jpg +0 -0
  149. data/doc/examples/website_styles/andreas09/src/images/bodybg-green.jpg +0 -0
  150. data/doc/examples/website_styles/andreas09/src/images/bodybg-orange.jpg +0 -0
  151. data/doc/examples/website_styles/andreas09/src/images/bodybg-purple.jpg +0 -0
  152. data/doc/examples/website_styles/andreas09/src/images/bodybg-red.jpg +0 -0
  153. data/doc/examples/website_styles/andreas09/src/images/bodybg.jpg +0 -0
  154. data/doc/examples/website_styles/andreas09/src/images/footerbg.jpg +0 -0
  155. data/doc/examples/website_styles/andreas09/src/images/menuhover-black.jpg +0 -0
  156. data/doc/examples/website_styles/andreas09/src/images/menuhover-green.jpg +0 -0
  157. data/doc/examples/website_styles/andreas09/src/images/menuhover-orange.jpg +0 -0
  158. data/doc/examples/website_styles/andreas09/src/images/menuhover-purple.jpg +0 -0
  159. data/doc/examples/website_styles/andreas09/src/images/menuhover-red.jpg +0 -0
  160. data/doc/examples/website_styles/andreas09/src/images/menuhover.jpg +0 -0
  161. data/doc/examples/website_styles/andreas09/src/index.page +0 -9
  162. data/doc/examples/website_styles/andreas09/src/screenshots.page +0 -18
  163. data/doc/examples/website_styles/default/README +0 -9
  164. data/doc/examples/website_styles/default/config.yaml +0 -2
  165. data/doc/examples/website_styles/default/src/about.page +0 -12
  166. data/doc/examples/website_styles/default/src/default.css +0 -84
  167. data/doc/examples/website_styles/default/src/default.template +0 -38
  168. data/doc/examples/website_styles/default/src/download.page +0 -15
  169. data/doc/examples/website_styles/default/src/features.page +0 -8
  170. data/doc/examples/website_styles/default/src/index.page +0 -9
  171. data/doc/examples/website_styles/default/src/screenshots.page +0 -18
  172. data/doc/examples/website_styles/plain/README +0 -9
  173. data/doc/examples/website_styles/plain/config.yaml +0 -2
  174. data/doc/examples/website_styles/plain/src/about.page +0 -12
  175. data/doc/examples/website_styles/plain/src/default.css +0 -244
  176. data/doc/examples/website_styles/plain/src/default.template +0 -63
  177. data/doc/examples/website_styles/plain/src/download.page +0 -15
  178. data/doc/examples/website_styles/plain/src/features.page +0 -8
  179. data/doc/examples/website_styles/plain/src/images/a_hover.jpg +0 -0
  180. data/doc/examples/website_styles/plain/src/images/desc.jpg +0 -0
  181. data/doc/examples/website_styles/plain/src/images/li.gif +0 -0
  182. data/doc/examples/website_styles/plain/src/images/mainbar.jpg +0 -0
  183. data/doc/examples/website_styles/plain/src/images/menu.jpg +0 -0
  184. data/doc/examples/website_styles/plain/src/images/submenua.gif +0 -0
  185. data/doc/examples/website_styles/plain/src/images/submenua_hover.jpg +0 -0
  186. data/doc/examples/website_styles/plain/src/index.page +0 -9
  187. data/doc/examples/website_styles/plain/src/screenshots.page +0 -18
  188. data/doc/examples/website_templates/default/README +0 -8
  189. data/doc/examples/website_templates/default/config.yaml +0 -2
  190. data/doc/examples/website_templates/default/src/default.css +0 -84
  191. data/doc/examples/website_templates/default/src/default.template +0 -38
  192. data/doc/examples/website_templates/default/src/index.page +0 -8
  193. data/doc/examples/website_templates/personal_hp/README +0 -8
  194. data/doc/examples/website_templates/personal_hp/config.yaml +0 -2
  195. data/doc/examples/website_templates/personal_hp/src/about.page +0 -12
  196. data/doc/examples/website_templates/personal_hp/src/default.css +0 -84
  197. data/doc/examples/website_templates/personal_hp/src/default.template +0 -38
  198. data/doc/examples/website_templates/personal_hp/src/index.page +0 -9
  199. data/doc/examples/website_templates/personal_hp/src/links.page +0 -22
  200. data/doc/examples/website_templates/personal_hp/src/projects.page +0 -20
  201. data/doc/examples/website_templates/project/README +0 -9
  202. data/doc/examples/website_templates/project/config.yaml +0 -2
  203. data/doc/examples/website_templates/project/src/about.page +0 -12
  204. data/doc/examples/website_templates/project/src/default.css +0 -84
  205. data/doc/examples/website_templates/project/src/default.template +0 -38
  206. data/doc/examples/website_templates/project/src/download.page +0 -15
  207. data/doc/examples/website_templates/project/src/features.page +0 -8
  208. data/doc/examples/website_templates/project/src/index.page +0 -9
  209. data/doc/examples/website_templates/project/src/screenshots.page +0 -18
  210. data/doc/plugin/gallery/slides/collage.rb +0 -334
  211. data/doc/src/examples/gallery_styles/default/default.gallery +0 -78
  212. data/doc/src/examples/gallery_styles/default/gallery_gallery.template +0 -38
  213. data/doc/src/examples/gallery_styles/default/gallery_image.template +0 -30
  214. data/doc/src/examples/gallery_styles/default/gallery_main.template +0 -18
  215. data/doc/src/examples/gallery_styles/index.page +0 -22
  216. data/doc/src/examples/gallery_styles/slides/gallery_gallery.template +0 -62
  217. data/doc/src/examples/gallery_styles/slides/gallery_image.template +0 -53
  218. data/doc/src/examples/gallery_styles/slides/gallery_main.template +0 -32
  219. data/doc/src/examples/gallery_styles/slides/slides.gallery +0 -79
  220. data/doc/src/examples/website_styles/1024px.page +0 -5
  221. data/doc/src/examples/website_styles/andreas00.page +0 -5
  222. data/doc/src/examples/website_styles/andreas01.page +0 -5
  223. data/doc/src/examples/website_styles/andreas03.page +0 -5
  224. data/doc/src/examples/website_styles/andreas04.page +0 -5
  225. data/doc/src/examples/website_styles/andreas05.page +0 -5
  226. data/doc/src/examples/website_styles/andreas06.page +0 -5
  227. data/doc/src/examples/website_styles/andreas07.page +0 -5
  228. data/doc/src/examples/website_styles/andreas08.page +0 -5
  229. data/doc/src/examples/website_styles/andreas09.page +0 -5
  230. data/doc/src/examples/website_styles/default.page +0 -5
  231. data/doc/src/examples/website_styles/index.page +0 -71
  232. data/doc/src/examples/website_styles/plain.page +0 -5
  233. data/doc/src/examples/website_templates/default.page +0 -5
  234. data/doc/src/examples/website_templates/index.page +0 -24
  235. data/doc/src/examples/website_templates/personal_hp.page +0 -5
  236. data/doc/src/examples/website_templates/project.page +0 -5
@@ -1,108 +1,8 @@
1
1
  ---
2
- title: Getting Started
2
+ title: Tutorial
3
3
  inMenu: true
4
4
  ---
5
- h1(#basics). Basics
6
-
7
-
8
- h2(#directories). The Needed Directories
9
-
10
-
11
- webgen needs a special directory structure so that it can work correctly. Basically, you have a
12
- website directory under which the following directories have to be:
13
-
14
- * @src@: The source directory in which all the source files for the website are. The name of this
15
- directory cannot be changed!
16
- * @output@: This directory is created, if it does not exist, when webgen is run. All the output
17
- files are put into this directory. The name of this directory and its location can be customized
18
- using the parameter {param: Core/Configuration:outDir}.
19
- * @plugin@: The extension directory. You can put self-written plugins into this directory so that
20
- they can be used by webgen. All <notextile><tt>*.rb</tt></notextile> files in this directory and
21
- its subdirectories are loaded as plugins. The name of this directory can't be customized, too!
22
-
23
- The directory in which these directories are in is called the *website directory*.
24
-
25
-
26
- h2(#cmdline). The @webgen@ Command
27
-
28
-
29
- The executable for webgen is called... webgen ;-) It uses a command style syntax (like Subversion's
30
- @svn@ or Rubygem's @gem@ commands) through the "cmdparse":http://cmdparse.rubyforge.org library. To
31
- get an overview of the possible commands run
32
-
33
- <pre>
34
- $ webgen help
35
- </pre>
36
-
37
- This will output something like this:
38
-
39
- <pre>
40
- Usage: webgen [options] COMMAND [options] [COMMAND [options] ...] [args]
41
-
42
- Available commands:
43
- check Checks things like validity of the config file or the availability of optional libraries
44
- config Checks the validity of the configuration and outputs the used options (=default command)
45
- libs Checks the availability of optional libraries used by plugins
46
- create Creates the basic directories and files for webgen.
47
- help Provide help for individual commands
48
- run Runs webgen, ie. generates the HTML files (=default command)
49
- show Shows various information
50
- config Shows information like the parameters for all or the matched plugins
51
- plugins Shows the available plugins
52
- use Changes the used website or gallery styles
53
- gallery_style Changes the used gallery style
54
- website_style Changes the used website style
55
- version Show the version of the program
56
-
57
- Global options:
58
- -d, --directory DIR The website directory, if none specified, current directory is used.
59
- -V, --verbosity LEVEL The verbosity level (0-3)
60
- -h, --help Show help
61
- -v, --version Show the version of the program
62
- </pre>
63
-
64
-
65
- As you can see, webgen supports many commands, from checking the validity of the configuration and
66
- the available libraries to displaying the configuration values. However, the main command is the
67
- @run@ command which does the actual website generation. This command uses the current working
68
- directory as website directory if none was specified via the @-d@ option.
69
-
70
- For more information on how the commands work have a look at the
71
- "cmdparse":http://cmdparse.rubyforge.org documentation!
72
-
73
-
74
- h2(#config). Configuration
75
-
76
-
77
- webgen provides a default configuration out of the box. If you can live with that, you do not need
78
- to write any configuration files. Because most people cannot, you can use your own configuration
79
- file. The configuration file has to be written in YAML and is called @config.yaml@. webgen assumes
80
- it to be in the website directory.
81
-
82
- Each plugin can specify parameters which can be configured through the configuration file. You can
83
- display a list of all available parameters by running
84
-
85
- <pre>
86
- $ webgen show config
87
- </pre>
88
-
89
- (This information is also provided on this website, have a look at the
90
- <a href="{relocatable: plugins}">plugins section</a>!)
91
-
92
- The list shows sorted by the plugin name the current values and the default values for each
93
- parameter. Each parameter can be overridden in the configuration file by specifing the plugin name
94
- as top level key and each parameter and value as a key/value pair. Therefore a configuration file
95
- looks like this (this is the one for the webgen homepage):
96
-
97
- <pre class="webgen-file">{includeFile: ../../config.yaml}</pre>
98
-
99
- There is a special key for file handler plugins: @defaultMetaInfo@. It's value should be a hash with
100
- the default meta information for nodes created by the plugin. The value is used to update the
101
- correct part of the {param: Core/FileHandler:defaultMetaInfo} parameter *if and only if* no value
102
- for the {param: Core/FileHandler:defaultMetaInfo} parameter has been set in the configuration file!
103
-
104
-
105
- h1(#website-creation). Website Creation Tutorial
5
+ h1(#website-creation). Tutorial
106
6
 
107
7
 
108
8
  This short tutorial shows you how to create a website with webgen.
@@ -135,7 +35,7 @@ example:
135
35
  $ webgen use website_style default
136
36
  </pre>
137
37
 
138
- Existing files may be overwritten be this command (after asking). However, this command is not able
38
+ Existing files may be overwritten by this command (after asking). However, this command is not able
139
39
  to delete previously copied website style files, so you have to remove them yourself!
140
40
 
141
41
  Have a look at the <a href="{relocatable: /examples}">examples</a> sections to see demonstrations
@@ -255,6 +155,9 @@ you can leave it there - it won't do any harm.
255
155
 
256
156
  Again, just run webgen and view the output!
257
157
 
158
+ For more information on how to write plugins have a look at the
159
+ <a href="{relocatable: extending_webgen.page}">extending webgen section</a>!
160
+
258
161
 
259
162
  h2(#website-conclusio). Conclusion
260
163
 
@@ -5,6 +5,17 @@ inMenu: true
5
5
  h2. News
6
6
 
7
7
 
8
+ h3(#news-2007-01-12). 12.01.2007 - webgen 0.4.1
9
+
10
+
11
+ A minor release with bug fixes and some small enhancements:
12
+
13
+ * webgen Windows bug resolved: webgen now really runs on Windows - thanks for the fast feedback!
14
+ * Rake task for running webgen - thanks to Jeremy Hinegardner for providing it!
15
+ * Meta information @template@ can now be set to @nil@ to specify that no template should be used!
16
+ * Small documentation updates - thanks to John Gabriel for pointing out some flaws!
17
+
18
+
8
19
  h3(#news-2007-01-05). 05.01.2007 - webgen 0.4.0
9
20
 
10
21
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: config.rb 531 2006-11-17 17:56:14Z thomas $
4
+ # $Id: config.rb 586 2007-01-10 16:46:05Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -24,7 +24,7 @@ require 'rbconfig'
24
24
 
25
25
  module Webgen
26
26
 
27
- VERSION = [0, 4, 0]
27
+ VERSION = [0, 4, 1]
28
28
  AUTHOR = 'Thomas Leitner <t_leitner@gmx.at>'
29
29
  SUMMARY = "webgen is a templated based static Web site generator."
30
30
  DESCRIPTION = "webgen is a Web site generator implemented in Ruby. " \
@@ -40,9 +40,9 @@ module Webgen
40
40
  # Returns the data directory for webgen.
41
41
  def self.data_dir
42
42
  unless defined?( @@data_dir )
43
- @@data_dir = File.join( Config::CONFIG["datadir"], "webgen" )
43
+ @@data_dir = File.expand_path( File.join( Config::CONFIG["datadir"], "webgen" ) )
44
44
 
45
- @@data_dir = File.join( File.dirname( __FILE__ ), '..', '..', 'data', 'webgen') if !File.exists?( @@data_dir )
45
+ @@data_dir = File.expand_path( File.join( File.dirname( __FILE__ ), '..', '..', 'data', 'webgen') ) if !File.exists?( @@data_dir )
46
46
 
47
47
  raise "Could not find webgen data directory! This is a bug, report it please!" unless File.directory?( @@data_dir )
48
48
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: node.rb 576 2007-01-03 19:41:12Z thomas $
4
+ # $Id: node.rb 585 2007-01-10 15:48:08Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -118,7 +118,9 @@ class Node
118
118
  def absolute_path
119
119
  return @precalc[:absolute_path] if @precalc
120
120
 
121
- if @path =~ ABSOLUTE_URL
121
+ if @parent.nil?
122
+ '/'
123
+ elsif @path =~ ABSOLUTE_URL
122
124
  @path
123
125
  else
124
126
  full_path.sub( /^#{Node.root( self ).path}/, '/' )
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: template.rb 542 2006-12-19 08:29:39Z thomas $
4
+ # $Id: template.rb 588 2007-01-12 09:55:32Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -77,6 +77,8 @@ module FileHandlers
77
77
  node['template'] = template_node
78
78
  elsif node['template'].kind_of?( Node )
79
79
  template_node = node['template']
80
+ elsif node.meta_info.has_key?( 'template' ) && node['template'].nil?
81
+ template_node = nil
80
82
  else
81
83
  log(:info) { "Using default template for <#{node.node_info[:src]}>" }
82
84
  template_node = get_default_template( node.parent, param( 'defaultTemplate' ) )
@@ -0,0 +1,75 @@
1
+ #
2
+ #--
3
+ # rendered_files.rb :
4
+ #
5
+ # webgen miscellaneous plugin to record the paths of all the files and
6
+ # directories written during rendering.
7
+ #
8
+ # Copyright (C) 2007 Jeremy Hinegardner
9
+ #
10
+ # This program is free software; you can redistribute it and/or modify
11
+ # it under the terms of the GNU General Public License as published by
12
+ # the Free Software Foundation; either version 2 of the License, or (at
13
+ # your option) any later version.
14
+ #
15
+ # This program is distributed in the hope that it will be useful, but
16
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
+ # General Public License for more details.
19
+ #
20
+ # You should have received a copy of the GNU General Public License
21
+ # along with this program; if not, write to the Free Software
22
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23
+ # USA
24
+ #
25
+ #++
26
+ #
27
+
28
+
29
+
30
+
31
+ load_plugin 'webgen/plugins/filehandlers/filehandler'
32
+
33
+ module MiscPlugins
34
+
35
+ # This plugin registers as a listener for message :after_node_written
36
+ # with the 'Core/FileHandler' plugin.
37
+ #
38
+ # When its callback is invoked, if the node in question is a file or
39
+ # directory it records the nodes fully expanded path in @files
40
+ #
41
+ # The list of files currently rendered can then be retrieved by
42
+ # getting a handle on this plugin and calling +files+.
43
+ #
44
+ # Example:
45
+ #
46
+ # @plugin_manager['Misc/RenderedFiles'].files
47
+ #
48
+ class RenderedFilesPlugin < Webgen::Plugin
49
+ infos( :name => 'Misc/RenderedFiles',
50
+ :author => 'Jeremy Hinegardner <jeremy@hinegardner.org>',
51
+ :summary => 'Keeps track of all the files and directories written during rendering.')
52
+
53
+ depends_on 'Core/FileHandler'
54
+
55
+ attr_reader :files
56
+
57
+ def initialize(plugin_manager)
58
+ super
59
+ @plugin_manager['Core/FileHandler'].add_msg_listener(:after_node_written, method(:record_file))
60
+ @files = []
61
+ end
62
+
63
+ #######
64
+ private
65
+ #######
66
+
67
+ # we use expand_path to remove possible environmental parameters
68
+ # or ../'s in the path
69
+ def record_file(node)
70
+ if node.is_file? or node.is_directory? then
71
+ @files << File.expand_path(node.full_path)
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,161 @@
1
+ # -*- ruby -*-
2
+
3
+ #
4
+ #--
5
+ # webgentask.rb:
6
+ #
7
+ # Define a task library for running webgen
8
+ #
9
+ # Copyright (C) 2007 Jeremy Hinegardner
10
+ #
11
+ # This program is free software; you can redistribute it and/or modify
12
+ # it under the terms of the GNU General Public License as published by
13
+ # the Free Software Foundation; either version 2 of the License, or (at
14
+ # your option) any later version.
15
+ #
16
+ # This program is distributed in the hope that it will be useful, but
17
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ # General Public License for more details.
20
+ #
21
+ # You should have received a copy of the GNU General Public License
22
+ # along with this program; if not, write to the Free Software
23
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24
+ # USA
25
+ #
26
+ #++
27
+ #
28
+
29
+ require 'rake'
30
+ require 'rake/tasklib'
31
+
32
+ module Webgen
33
+
34
+ module Rake
35
+
36
+ ##
37
+ # A Rake task that generates a webgen website.
38
+ #
39
+ # It is assumed that you have already used the 'webgen' command
40
+ # to create the base directory for the site. This task is here
41
+ # to make it easier to integrate the generation of the website
42
+ # within the broader scope of another project.
43
+ #
44
+ # === Basics
45
+ #
46
+ # require 'webgen/rake/webgentask'
47
+ #
48
+ # Webgen::Rake::WebgenTask.new do |t|
49
+ # t.directory = File.join(Dir.pwd, "webgen")
50
+ # end
51
+ #
52
+ # === Attributes
53
+ #
54
+ # The attributes available to the task in the new block are:A
55
+ #
56
+ # * name - the name of the task. This can also be set as
57
+ # a parameter to new (default :webgen)
58
+ # * directory - the root directory of the webgen site
59
+ # (default File.join(Dir.pwd, "webgen")
60
+ # * clobber_outdir - remove webgens output directory on clobber
61
+ # (default false)
62
+ #
63
+ # === Tasks Provided
64
+ #
65
+ # The tasks provided are :
66
+ #
67
+ # * webgen - create the website
68
+ # * clobber_webgen - remove all the files created during creation
69
+ #
70
+ # If the +name+ attribute is changed then the tasks are changed
71
+ # to reflect that. For Example:
72
+ #
73
+ # Webgen::Rake::WebgenTask.new(:my_webgen) do |t|
74
+ # t.clobber_outdir = true
75
+ # end
76
+ #
77
+ # This will create tasks:
78
+ #
79
+ # * my_webgen
80
+ # * clobber_my_webgen
81
+ #
82
+ class WebgenTask < ::Rake::TaskLib
83
+
84
+ # Name of webgen task. (default is :webgen)
85
+ attr_accessor :name
86
+
87
+ # The directory of the webgen site. This would be the
88
+ # directory of your config.yaml file. Or the parent
89
+ # directory of the src/ directory for webgen
90
+ #
91
+ # The default for this is assumed to be
92
+ # File.join(Dir.pwd,"webgen")
93
+ attr_accessor :directory
94
+
95
+ # During the clobber, should webgen's output directory be
96
+ # clobbered. The default is false
97
+ attr_accessor :clobber_outdir
98
+
99
+ # Create a webgen task
100
+ def initialize(name = :webgen)
101
+ @name = name
102
+ @directory = File.join(Dir.pwd, "webgen")
103
+ @clobber_outdir = false
104
+
105
+ yield self if block_given?
106
+
107
+ @rendered_files = FileList.new
108
+
109
+ define
110
+ end
111
+
112
+ def define
113
+ desc "Run webgen"
114
+ task @name do |t|
115
+ Dir.chdir(@directory) do
116
+ begin
117
+ # some items from webgen may be sensitive to the
118
+ # current directory when it runs
119
+
120
+ require 'webgen/website'
121
+ @website = Webgen::WebSite.new @directory
122
+ @out_dir = File.expand_path(@website.param_for_plugin('Core/Configuration', 'outDir'))
123
+ @website.render
124
+ puts "Webgen rendered to : #{@out_dir}"
125
+
126
+ file_list = @website.manager['Misc/RenderedFiles'].files
127
+
128
+ # remove @out_dir from the list of rendered_files
129
+ file_list.delete @out_dir
130
+
131
+ @rendered_files << file_list
132
+ rescue => e
133
+ puts "Webgen task failed: #{e}"
134
+ raise e
135
+ end
136
+ end
137
+ end
138
+
139
+ clobber_task = paste("clobber_",@name)
140
+
141
+ # bit of conundrum here since we don't know what files
142
+ # to remove until they have been generated, so we have
143
+ # to generate all the files to remove them.
144
+ #
145
+ # I don't know of the right way to do this yet.
146
+ desc "Remove webgen products"
147
+ task clobber_task => [@name] do
148
+ rm_rf @rendered_files
149
+ if @clobber_outdir then
150
+ rm_r @out_dir rescue nil
151
+ end
152
+ end
153
+
154
+ task :clobber => [clobber_task]
155
+ self
156
+ end
157
+
158
+ end
159
+ end
160
+ end
161
+