Parent

Methods

Class/Module Index [+]

Quicksearch

Webgen::CLI::CreateCommand

The CLI command for creating a webgen website.

Public Instance Methods

execute(args) click to toggle source

Create a webgen website in the directory args[0].

# File lib/webgen/cli/create_command.rb, line 46
def execute(args)
  if args.length == 0
    raise OptionParser::MissingArgument.new('DIR')
  else
    wm = Webgen::WebsiteManager.new(args[0])
    paths = wm.create_website
    begin
      if @bundles
        @bundles = ['default', 'simple'] if @bundles.empty?
        @bundles.each {|name| paths += wm.apply_bundle(Utils.match_bundle_name(wm, name)) }
      end
    rescue
      require 'fileutils'
      FileUtils.rm_rf(args[0])
      raise
    end
    if commandparser.verbosity == :verbose
      puts "The following files were created in the directory #{args[0]}:"
      puts paths.sort.join("\n")
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.