webgen 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/ChangeLog +224 -0
  2. data/Rakefile +2 -3
  3. data/TODO +18 -1
  4. data/VERSION +1 -1
  5. data/doc/plugin/clidesc.rb +35 -0
  6. data/doc/plugin/extension.rb +73 -0
  7. data/doc/src/about.page +2 -1
  8. data/doc/src/default.css +5 -1
  9. data/doc/src/default.template +9 -0
  10. data/doc/src/documentation/cli.page +12 -0
  11. data/doc/src/documentation/gettingstarted.page +150 -0
  12. data/doc/src/documentation/index.page +1 -19
  13. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/html.page +0 -0
  14. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/index.page +0 -0
  15. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/markdown.page +0 -0
  16. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/rdoc.page +0 -0
  17. data/doc/src/documentation/{contenthandler → plugins/contenthandler}/textile.page +0 -0
  18. data/doc/src/documentation/plugins/filehandler/backing.page +33 -0
  19. data/doc/src/documentation/{filehandler → plugins/filehandler}/copy.page +0 -0
  20. data/doc/src/documentation/{filehandler → plugins/filehandler}/directory.page +1 -2
  21. data/doc/src/documentation/{filehandler → plugins/filehandler}/galleryhandler.page +1 -1
  22. data/doc/src/documentation/{filehandler → plugins/filehandler}/index.page +0 -0
  23. data/doc/src/documentation/{filehandler → plugins/filehandler}/pagehandler.page +0 -0
  24. data/doc/src/documentation/{filehandler → plugins/filehandler}/template.page +0 -0
  25. data/doc/src/documentation/{gallerylayouter → plugins/gallerylayouter}/defaultlayouter.page +0 -0
  26. data/doc/src/documentation/{gallerylayouter → plugins/gallerylayouter}/index.page +0 -0
  27. data/doc/src/documentation/{htmlvalidator → plugins/htmlvalidator}/index.page +0 -0
  28. data/doc/src/documentation/{htmlvalidator → plugins/htmlvalidator}/xmllint.page +0 -0
  29. data/doc/src/documentation/plugins/index.page +20 -0
  30. data/doc/src/documentation/plugins/system/configuration.page +12 -0
  31. data/doc/src/documentation/plugins/system/index.page +7 -0
  32. data/doc/src/documentation/plugins/system/logging.page +13 -0
  33. data/doc/src/documentation/{tags → plugins/tags}/date.page +0 -0
  34. data/doc/src/documentation/{tags → plugins/tags}/executecommand.page +0 -1
  35. data/doc/src/documentation/{tags → plugins/tags}/includefile.page +0 -0
  36. data/doc/src/documentation/{tags → plugins/tags}/index.page +2 -2
  37. data/doc/src/documentation/{tags → plugins/tags}/langbar.de.page +0 -0
  38. data/doc/src/documentation/{tags → plugins/tags}/langbar.page +1 -1
  39. data/doc/src/documentation/{tags → plugins/tags}/menu.de.page +1 -0
  40. data/doc/src/documentation/{tags → plugins/tags}/menu.page +1 -1
  41. data/doc/src/documentation/{tags → plugins/tags}/meta.page +0 -0
  42. data/doc/src/documentation/{tags → plugins/tags}/multilang.de.page +0 -0
  43. data/doc/src/documentation/{tags → plugins/tags}/multilang.fr.page +0 -0
  44. data/doc/src/documentation/{tags → plugins/tags}/multilang.page +0 -0
  45. data/doc/src/documentation/{tags → plugins/tags}/navbar.page +0 -0
  46. data/doc/src/documentation/{tags → plugins/tags}/relocatable.page +0 -0
  47. data/doc/src/documentation/{tags → plugins/tags}/sitemap.page +0 -0
  48. data/doc/src/documentation/{tags → plugins/tags}/wikilink.page +0 -0
  49. data/doc/src/download.page +1 -0
  50. data/doc/src/index.page +26 -8
  51. data/doc/src/meta.info +13 -18
  52. data/install.rb +1 -1
  53. data/lib/webgen/configuration.rb +6 -153
  54. data/lib/webgen/logging.rb +38 -10
  55. data/lib/webgen/node.rb +26 -6
  56. data/lib/webgen/plugin.rb +168 -0
  57. data/lib/webgen/plugins/filehandler/backing.rb +11 -56
  58. data/lib/webgen/plugins/filehandler/directory.rb +8 -8
  59. data/lib/webgen/plugins/filehandler/filecopy.rb +2 -2
  60. data/lib/webgen/plugins/filehandler/filehandler.rb +5 -9
  61. data/lib/webgen/plugins/filehandler/page.rb +40 -79
  62. data/lib/webgen/plugins/filehandler/picturegallery.rb +3 -3
  63. data/lib/webgen/plugins/filehandler/template.rb +2 -2
  64. data/lib/webgen/plugins/tags/langbar.rb +2 -2
  65. data/lib/webgen/plugins/tags/menu.rb +5 -13
  66. data/lib/webgen/plugins/tags/relocatable.rb +2 -2
  67. data/lib/webgen/plugins/tags/sitemap.rb +2 -2
  68. data/lib/webgen/plugins/tags/wikilink.rb +4 -3
  69. data/lib/webgen/webgen.rb +262 -57
  70. data/testsite/src/default.template +1 -1
  71. data/testsite/src/images/bghack.png +0 -0
  72. data/testsite/src/meta.info +7 -10
  73. metadata +65 -44
  74. data/doc/extension.config +0 -60
  75. data/doc/src/documentation/extloader.page +0 -20
  76. data/doc/src/documentation/filehandler/backing.page +0 -16
  77. data/lib/webgen/plugins/extloader.rb +0 -88
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: langbar.rb 223 2005-03-16 14:10:57Z thomas $
4
+ # $Id: langbar.rb 256 2005-04-14 01:13:57Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -39,7 +39,7 @@ module Tags
39
39
  end
40
40
 
41
41
  def process_tag( tag, node, refNode )
42
- output = node.parent.children.sort do |a, b| a['lang'] <=> b['lang'] end.collect do |n|
42
+ output = node.parent.find_all {|a| a['page:name'] == node['page:name']}.sort {|a, b| a['lang'] <=> b['lang']}.collect do |n|
43
43
  n['processor'].get_html_link( n, n, n['lang'] )
44
44
  end.join( get_param( 'separator' ) )
45
45
  return ( get_param( 'showSingleLang' ) || node.parent.children.length > 1 ? output : "" )
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: menu.rb 223 2005-03-16 14:10:57Z thomas $
4
+ # $Id: menu.rb 256 2005-04-14 01:13:57Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -67,7 +67,7 @@ module Tags
67
67
 
68
68
  # find the first menuOrder entry in the page files
69
69
  node = node['indexFile'] if node.kind_of?( FileHandlers::DirHandler::DirNode )
70
- node = node.find {|child| child['menuOrder'].to_s.to_i != 0} if node.kind_of?( FileHandlers::PageHandler::PageNode )
70
+ node = node.parent.find {|child| child['page:name'] == node['page:name'] && child['menuOrder'].to_s.to_i != 0} if !node.nil? && node['page:name']
71
71
  value ||= node['menuOrder'].to_s.to_i unless node.nil?
72
72
 
73
73
  # fallback value
@@ -151,7 +151,7 @@ module Tags
151
151
 
152
152
 
153
153
  def menu_entry( srcNode, node )
154
- langNode = node['processor'].get_lang_node( node, srcNode['lang'] )
154
+ langNode = node['processor'].get_page_node_for_lang( node, srcNode['lang'] )
155
155
  isDir = node.kind_of?( FileHandlers::DirHandler::DirNode )
156
156
 
157
157
  styles = []
@@ -173,20 +173,12 @@ module Tags
173
173
  menuNode = MenuNode.new( parent, node )
174
174
 
175
175
  node.each do |child|
176
+ next if menuNode.find {|n| n['page:name'] == child['page:name'] && !n['page:name'].nil? }
176
177
  menu = create_menu_tree( child, menuNode )
177
178
  menuNode.add_child( menu ) unless menu.nil?
178
179
  end
179
180
 
180
- return menuNode.has_children? ? menuNode : ( put_node_in_menu?( node ) ? node : nil )
181
- end
182
-
183
-
184
- def put_node_in_menu?( node )
185
- inMenu = node['inMenu']
186
- inMenu ||= node.parent && node.parent.kind_of?( FileHandlers::PageHandler::PageNode ) &&
187
- node.parent.find do |child| child['inMenu'] end
188
- inMenu &&= !node['virtual']
189
- inMenu
181
+ return menuNode.has_children? ? menuNode : ( node['inMenu'] && !node['virtual'] ? node : nil )
190
182
  end
191
183
 
192
184
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: relocatable.rb 224 2005-03-16 15:26:33Z thomas $
4
+ # $Id: relocatable.rb 256 2005-04-14 01:13:57Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -47,7 +47,7 @@ module Tags
47
47
  def process_tag( tag, node, refNode )
48
48
  unless get_param( 'item' ).nil?
49
49
  destNode = refNode.node_for_string( get_param( 'item' ) )
50
- return ( destNode.nil? ? '' : node.relpath_to_node( destNode['node:isLangNode'] ? destNode : destNode['processor'].get_lang_node( destNode, node['lang'] ) ) )
50
+ return ( destNode.nil? ? '' : node.relpath_to_node( destNode['page:name'] ? destNode['processor'].get_page_node_for_lang( destNode, node['lang'] ) : destNode ) )
51
51
  else
52
52
  return ''
53
53
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: sitemap.rb 211 2005-02-26 17:23:20Z thomas $
4
+ # $Id: sitemap.rb 256 2005-04-14 01:13:57Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -56,7 +56,7 @@ module Tags
56
56
  isDir = child.kind_of?( FileHandlers::DirHandler::DirNode )
57
57
  subout = output_node( child, srcNode )
58
58
  if subout != '' || !isDir
59
- langNode = child['processor'].get_lang_node( child, srcNode['lang'] )
59
+ langNode = child['processor'].get_page_node_for_lang( child, srcNode['lang'] )
60
60
  link = langNode['processor'].get_html_link( langNode, srcNode, ( isDir ? langNode['directoryName'] || child['directoryName'] : langNode['title'] ) )
61
61
  end
62
62
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: wikilink.rb 203 2005-02-21 18:42:04Z thomas $
4
+ # $Id: wikilink.rb 252 2005-04-13 20:21:12Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -32,7 +32,8 @@ module Tags
32
32
  add_param 'rootURL', '/wiki/wiki.pl?', 'The root URL for the wiki link, ie. the path to the wiki CGI.'
33
33
  add_param 'relURL', nil, 'The relativ URL for the wiki link (the varying part that is appended to rootURL). ' \
34
34
  'If it is not specified, the title of the current page is used.'
35
- add_param 'convertSpaces', true, 'True if spaces in the relative URL should be converted to underscores.'
35
+ add_param 'invalidChars', ' &;', 'The characters which are invalid as wiki URLs.'
36
+ add_param 'replacementChar', '_', 'The character(s) which should be used instead of the invalid characters.'
36
37
 
37
38
  def initialize
38
39
  super
@@ -50,7 +51,7 @@ module Tags
50
51
  def get_link( node )
51
52
  link = get_param( 'rootURL' )
52
53
  relURL = get_param( 'relURL' ) || node['title']
53
- link + (get_param( 'convertSpaces' ) ? relURL.tr( ' ', '_' ) : relURL )
54
+ link + relURL.tr( get_param( 'invalidChars' ), get_param( 'replacementChar' ) )
54
55
  end
55
56
 
56
57
  end
data/lib/webgen/webgen.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  #--
3
3
  #
4
- # $Id: webgen.rb 230 2005-03-17 09:29:43Z thomas $
4
+ # $Id: webgen.rb 259 2005-04-21 10:37:47Z thomas $
5
5
  #
6
6
  # webgen: template based static website generator
7
7
  # Copyright (C) 2004 Thomas Leitner
@@ -21,7 +21,9 @@
21
21
  #
22
22
 
23
23
  require 'optparse'
24
- require 'webgen/configuration'
24
+ require 'rbconfig'
25
+ require 'cmdparse'
26
+ require 'webgen/plugin'
25
27
 
26
28
  module Webgen
27
29
 
@@ -45,62 +47,16 @@ module Webgen
45
47
 
46
48
  end
47
49
 
48
- class WebgenMain
49
-
50
- def main( cmdOptions )
51
- Color.colorify if $stdout.isatty
52
- main, data = parse_options( cmdOptions )
53
-
54
- Plugin['Configuration'].init_all( data )
55
- main.call
56
- end
57
-
58
-
59
- def parse_options( cmdOptions )
60
- config = Plugin['Configuration']
61
- data = {}
62
- main = method( :runMain )
63
-
64
- opts = OptionParser.new do |opts|
65
- opts.summary_width = 25
66
- opts.summary_indent = ' '
67
50
 
68
- opts.banner = "Usage: webgen [options]\n#{Webgen::SUMMARY}"
51
+ class RunWebgenCommand < CommandParser::Command
69
52
 
70
- opts.separator ""
71
- opts.separator "Configuration options:"
72
-
73
- opts.on( "--config-file FILE", "-C", String, "The configuration file which should be used" ) { |data['configfile']| }
74
- opts.on( "--source-dir DIR", "-S", String, "The directory from where the files are read" ) { |data['srcDirectory']| }
75
- opts.on( "--output-dir DIR", "-O", String, "The directory where the output should go" ) { |data['outDirectory']| }
76
- opts.on( "--verbosity LEVEL", "-V", Integer, "The verbosity level" ) { |data['verbosityLevel']| }
77
- opts.on( "--[no-]logfile", "-L", "Log to file webgen.log" ) { |logfile| config.set_log_dev_to_logfile if logfile }
78
-
79
- opts.separator ""
80
- opts.separator "Other options:"
81
-
82
- opts.on( "--list-plugins", "-p", "List all the plugins and information about them" ) { main = method( :runListPlugins ) }
83
- opts.on( "--list-configuration", "-c", "List all plugin configuration parameters" ) { main = method( :runListConfiguration ) }
84
- opts.on_tail( "--help", "Display this help screen" ) { puts opts; exit }
85
- opts.on_tail( "--version", "-v", "Show version" ) do
86
- puts "Webgen #{Webgen::VERSION.join('.')}"
87
- exit
88
- end
89
- end
53
+ def initialize; super( 'run' ); end
90
54
 
91
- begin
92
- opts.parse!( cmdOptions )
93
- rescue RuntimeError => e
94
- print "Error:\n" << e.reason << ": " << e.args.join(", ") << "\n\n"
95
- puts opts
96
- exit
97
- end
98
-
99
- [main, data]
100
- end
55
+ def description; "Runs webgen. This command is used as default command when no command was issued."; end
101
56
 
57
+ def usage; "Usage: #{@options.program_name} [global options] run"; end
102
58
 
103
- def runMain
59
+ def execute( commandParser, args )
104
60
  logger.info "Starting Webgen..."
105
61
 
106
62
  # load all the files in src dir and build tree
@@ -114,12 +70,32 @@ module Webgen
114
70
 
115
71
  logger.info "Webgen finished"
116
72
  end
73
+ end
74
+
75
+
76
+ class ShowCommand < CommandParser::Command
77
+
78
+ def initialize; super( 'show' ); end
79
+
80
+ def description; "Shows all available plugins or their configuration items."; end
117
81
 
82
+ def usage; "Usage: #{@options.program_name} [global options] show plugins|config"; end
118
83
 
119
- def runListPlugins
84
+ def execute( commandParser, args )
85
+ case args[0]
86
+ when 'plugins' then showPlugins
87
+ when 'config' then showConfiguration
88
+ else puts "You have to specify either 'plugins' or 'config'"
89
+ end
90
+ exit
91
+ end
92
+
93
+ private
94
+
95
+ def showPlugins
120
96
  print "List of loaded plugins:\n"
121
97
 
122
- headers = Hash.new {|h,k| h[k] = k.gsub(/([A-Z])/, ' \1').strip}
98
+ headers = Hash.new {|h,k| h[k] = (k.nil? ? "Other Plugins" : k.gsub(/([A-Z][a-z])/, ' \1').strip) }
123
99
 
124
100
  ljustlength = 30 + Color.green.length + Color.reset.length
125
101
  header = ''
@@ -133,8 +109,7 @@ module Webgen
133
109
  end
134
110
  end
135
111
 
136
-
137
- def runListConfiguration
112
+ def showConfiguration
138
113
  print "List of configuration parameters:\n\n"
139
114
  ljustlength = 20 + Color.green.length + Color.reset.length
140
115
  Plugin.config.sort { |a, b| a[0].name <=> b[0].name }.each do |klass, data|
@@ -152,4 +127,234 @@ module Webgen
152
127
 
153
128
  end
154
129
 
130
+
131
+ class CreateCommand < CommandParser::Command
132
+
133
+ def initialize; super( 'create' ); end
134
+
135
+ def description;
136
+ "Creates the basic directories and files for webgen. This includes the source and output directories, " \
137
+ "the log and the plugin directory. Also, a basic template plus a CSS and an index file are created."
138
+ end
139
+
140
+ def usage; "Usage: #{@options.program_name} [global options] create DIR"; end
141
+
142
+ def execute( commandParser, args )
143
+ if args.length == 0
144
+ raise OptionParser::MissingArgument.new( 'DIR' )
145
+ else
146
+ create_dir( args[0] )
147
+ create_dir( File.join( args[0], 'src' ) )
148
+ create_dir( File.join( args[0], 'output' ) )
149
+ create_dir( File.join( args[0], 'log' ) )
150
+ create_dir( File.join( args[0], 'plugin' ) )
151
+ create_file( File.join( args[0], 'config.yaml' ), content_config_yaml )
152
+ create_file( File.join( args[0], 'src', 'default.template' ), content_default_template )
153
+ create_file( File.join( args[0], 'src', 'default.css' ), content_default_css )
154
+ create_file( File.join( args[0], 'src', 'index.page' ), content_index_page )
155
+ end
156
+ end
157
+
158
+ def create_dir( dir )
159
+ Dir.mkdir( dir ) unless File.exists?( dir )
160
+ end
161
+
162
+ def create_file( file, content )
163
+ File.open( file, 'w') do |f|
164
+ f.puts( content )
165
+ end unless File.exists?( file )
166
+ end
167
+
168
+ def content_config_yaml
169
+ "# Configuration file for webgen\n# Used to set the parameters of the plugins"
170
+ end
171
+
172
+ def content_default_template
173
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
174
+ <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
175
+ <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"{lang:}\">
176
+ <head>
177
+ <title>{title: }</title>
178
+ <link href=\"{relocatable: default.css}\" rel=\"stylesheet\" />
179
+ <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
180
+ </head>
181
+ <body>
182
+ <div id=\"header\">
183
+ <h1>{title: }</h1>
184
+ </div>
185
+
186
+ <div id=\"headerbar\" class=\"bar\">
187
+ <span class=\"left\">Navbar: {navbar: }</span>
188
+ <span class=\"right\">Language: {langbar: }</span>
189
+ <div style=\"clear:both\"></div>
190
+ </div>
191
+
192
+ <div id=\"menu\">
193
+ {menu: {subtreeLevel: 4}}
194
+ </div>
195
+
196
+ <div id=\"body\">
197
+ {content: }
198
+ </div>
199
+
200
+ <div id=\"footer\" class=\"bar\">
201
+ generated with <a href=\"http://webgen.rubyforge.org\"><em><b>webgen</b></em></a> on <b>{date: }</b>
202
+ </div>
203
+ </body>
204
+ </html>
205
+ "
206
+ end
207
+
208
+ def content_default_css
209
+ "
210
+ #all { background-color: #CCCCCC; }
211
+
212
+ #header {
213
+ border-bottom: 1px solid black;
214
+ padding: 1ex;
215
+ background-color: #888888;
216
+ }
217
+ #header h1 {
218
+ margin: 0ex;
219
+ font-size: 300%;
220
+ font-style: italic;
221
+ font-weight: normal;
222
+ }
223
+
224
+ , #headerbar { border-bottom: 1px solid black; }
225
+ #footer { border-top: 1px solid black; }
226
+
227
+ #body {
228
+ margin-left: 250px;
229
+ margin-right: 20px;
230
+ padding: 10px;
231
+ }
232
+
233
+ #menu {
234
+ float: left;
235
+ width: 230px;
236
+ padding: 20px 0px 0px 2px;
237
+ }
238
+
239
+ .bar {
240
+ clear: both;
241
+ padding: 3px;
242
+ text-align: center;
243
+ font-size: 90%;
244
+ background-color: #AAAAAA;
245
+ }
246
+
247
+ .left, .right {
248
+ padding: 0px 1em;
249
+ }
250
+
251
+ .left {
252
+ float: left;
253
+ text-align: left;
254
+ }
255
+
256
+ .right {
257
+ float: right;
258
+ text-align: right;
259
+ }
260
+
261
+ /* styling the menu */
262
+
263
+ #menu a {
264
+ text-decoration: none;
265
+ font-weight: bold;
266
+ font-size: 130%;
267
+ }
268
+
269
+ #menu a:hover {
270
+ text-decoration: underline;
271
+ }
272
+
273
+ #menu .webgen-menuitem-selected {
274
+ border-left: 3px solid black;
275
+ }
276
+
277
+ #menu ul {
278
+ list-style-type: none;
279
+ padding: 0px;
280
+ margin-left: 10px;
281
+ }
282
+
283
+ #menu li > ul {
284
+ font-size: 95%;
285
+ }
286
+
287
+ #menu li {
288
+ margin: 0.0em 0px;
289
+ padding: 2px 0px;
290
+ padding-left: 5px;
291
+ border-left: 3px solid #CCCCCC;
292
+ }
293
+ "
294
+ end
295
+
296
+ def content_index_page
297
+ "---
298
+ title: Empty index page
299
+ inMenu: true
300
+ directoryName: New Website
301
+ ---
302
+ h2. Empty index file
303
+
304
+ Fill this file with your own data!!!
305
+ "
306
+ end
307
+
308
+ end
309
+
310
+
311
+ class WebgenCommandParser < CommandParser
312
+
313
+ def initialize
314
+ super
315
+ self.options do |opts|
316
+ opts.program_name = "webgen"
317
+ opts.version = Webgen::VERSION
318
+ opts.summary_width = 25
319
+ opts.summary_indent = ' '
320
+
321
+ opts.banner = "Usage: webgen [global options] COMMAND [command options]\n#{Webgen::SUMMARY}"
322
+
323
+ opts.separator ""
324
+ opts.separator "Global options:"
325
+
326
+ opts.on( "--verbosity LEVEL", "-V", Integer, "The verbosity level" ) { |verbosity| Plugin.set_param( 'Logging', 'verbosityLevel', verbosity ) }
327
+ opts.on( "--[no-]logfile", "-L", "Log to file" ) { |logfile| Plugin.set_param( 'Logging', 'logToFile', logfile ) }
328
+
329
+ opts.separator ""
330
+ end
331
+
332
+ self.add_command( RunWebgenCommand.new, true )
333
+ self.add_command( ShowCommand.new )
334
+ self.add_command( CreateCommand.new )
335
+ self.add_command( CommandParser::HelpCommand.new )
336
+ self.add_command( CommandParser::VersionCommand.new )
337
+ end
338
+
339
+ end
340
+
341
+
342
+ class WebgenMain
343
+
344
+ def main( cmdOptions )
345
+ Color.colorify if $stdout.isatty && !Config::CONFIG['arch'].include?( 'mswin32' )
346
+ begin
347
+ wcp = WebgenCommandParser.new
348
+ wcp.parse!( ARGV, false )
349
+ Plugin['Configuration'].init_all
350
+ wcp.execute
351
+ rescue CommandParser::InvalidCommandError => e
352
+ puts "Error: invalid command given"
353
+ puts
354
+ wcp.commands['help'].execute( wcp, {} )
355
+ end
356
+ end
357
+
358
+ end
359
+
155
360
  end