Class: Webgen::CLI::GenerateCommand

Inherits:
CmdParse::Command
  • Object
show all
Defined in:
lib/webgen/cli/commands/generate.rb

Overview

The CLI command for generating a webgen website.

Instance Method Summary collapse

Constructor Details

#initializeGenerateCommand

:nodoc:



11
12
13
14
15
16
17
18
19
# File 'lib/webgen/cli/commands/generate.rb', line 11

def initialize # :nodoc:
  super('generate', takes_commands: false)
  short_desc('Generate the webgen website')
  long_desc("This command is executed by default when no other command was specified.")
  options.on('-a', '--auto [SEC]', Integer, "Auto-generate the website every SEC seconds (5=default, 0=off)") do |val|
    @auto_generate_secs = val || 5
  end
  @auto_generate_secs = 0
end

Instance Method Details

#executeObject

:nodoc:



21
22
23
24
25
26
27
# File 'lib/webgen/cli/commands/generate.rb', line 21

def execute # :nodoc:
  if @auto_generate_secs <= 0
    command_parser.website.execute_task(:generate_website)
  else
    auto_generate
  end
end