Class: Awestruct::CLI::Generate

Inherits:
Object
  • Object
show all
Defined in:
lib/awestruct/cli/generate.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, profile = nil, base_url = nil, default_base_url = Options::DEFAULT_BASE_URL, force = false, generate = true) ⇒ Generate

Returns a new instance of Generate.



8
9
10
11
12
13
14
15
# File 'lib/awestruct/cli/generate.rb', line 8

def initialize(config, profile=nil, base_url=nil, default_base_url=Options::DEFAULT_BASE_URL, force=false, generate=true)
  @profile          = profile
  @base_url         = base_url
  @default_base_url = default_base_url
  @force            = force
  @generate         = generate
  @engine           = Awestruct::Engine.new( config )
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/awestruct/cli/generate.rb', line 17

def run()
  begin
    base_url = @base_url || @default_base_url
    $LOG.info "Generating site: #{base_url}" if $LOG.info?
    start_time = DateTime.now
    @engine.run( @profile, @base_url, @default_base_url, @force, @generate )
    $LOG.trace "Total time in engine.run #{DateTime.now.to_time - start_time.to_time} seconds"
  rescue =>e
    ExceptionHelper.log_building_error e, ''
    return false
  end
end