Class Webgen::CreateCommand
In: lib/webgen/cli.rb
Parent: CmdParse::Command
RuntimeError PluginParamNotFound PluginNotFound ConfigurationFileInvalid CmdParse::CommandParser CommandParser DirectoryInfo GalleryStyle WebSiteStyle WebSiteTemplate SipttraStyle Test::Unit::TestCase TestCase PluginTestCase TagTestCase CmdParse::Command ShowCommand CheckCommand UseCommand CreateCommand TSort DependencyHash Hash Comparable Language DEFAULT_WRAPPER_MODULE WebSite ::Logger Logger Logger Qt::MainWindow MainWindow Qt::Dialog NewWebsiteDialog Qt::TextEdit LogWidget ::Rake::TaskLib WebgenTask ConfigurationFile Website PluginManager PluginLoader PluginParamValueNotFound Dummy Color CliUtils PluginDefs lib/webgen/languages.rb lib/webgen/website.rb lib/webgen/gui/common.rb lib/webgen/plugin.rb lib/webgen/test.rb lib/webgen/cli.rb ClassMethods PluginDefs LanguageManager lib/webgen/gui/new_website_dlg.rb lib/webgen/gui/main.rb GUI lib/webgen/rake/webgentask.rb Rake Webgen dot/m_60_0.png

Methods

execute   new   usage  

Public Class methods

[Source]

     # File lib/webgen/cli.rb, line 92
 92:     def initialize
 93:       super( 'create', false )
 94:       self.short_desc = "Creates the basic directories and files for webgen."
 95:       self.description = CliUtils.format( "\nIf the global verbosity level is set to 0 or 1, the created files are listed." )
 96:       self.options = CmdParse::OptionParserWrapper.new do |opts|
 97:         opts.separator "Options:"
 98:         opts.on( '-t', '--template TEMPLATE', Webgen::WebSiteTemplate.entries.keys, 'Specify the template which should be used' ) {|@template|}
 99:         opts.on( '-s', '--style STYLE', Webgen::WebSiteStyle.entries.keys, 'Specify the style which should be used' ) {|@style|}
100:         opts.separator ""
101:         opts.separator "Arguments:"
102:         opts.separator opts.summary_indent + "DIR: the base directory for the website"
103:         opts.separator ""
104:         opts.separator "Available templates and styles:"
105:         opts.separator ""
106:         opts.separator opts.summary_indent + "#{Color.bold( 'Templates' )}"
107:         Webgen::WebSiteTemplate.entries.sort.each {|name, entry| CliUtils.dirinfo_output( opts, name, entry ) }
108:         opts.separator opts.summary_indent + "#{Color.bold( 'Styles' )}"
109:         Webgen::WebSiteStyle.entries.sort.each {|name, entry| CliUtils.dirinfo_output( opts, name, entry ) }
110:       end
111:       @template = 'default'
112:       @style = 'default'
113:     end

Public Instance methods

[Source]

     # File lib/webgen/cli.rb, line 119
119:     def execute( args )
120:       if args.length == 0
121:         raise OptionParser::MissingArgument.new( 'DIR' )
122:       else
123:         files = Webgen::WebSite.create_website( args[0], @template, @style )
124:         if (0..1) === commandparser.verbosity
125:           puts "The following files were created:"
126:           puts files.collect {|f| "- " + f }.join("\n")
127:         end
128:       end
129:     end

[Source]

     # File lib/webgen/cli.rb, line 115
115:     def usage
116:       "Usage: #{commandparser.program_name} [global options] create [options] DIR"
117:     end

[Validate]