Class: Middleman::Cli::BuildAction

Inherits:
Thor::Actions::EmptyDirectory
  • Object
show all
Defined in:
lib/middleman-core/cli/build.rb

Overview

A Thor Action, modular code, which does the majority of the work.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base, config = {}) ⇒ BuildAction

Setup the action

Parameters:



108
109
110
111
112
113
114
115
116
117
118
# File 'lib/middleman-core/cli/build.rb', line 108

def initialize(base, config={})
  @app        = base.class.shared_instance
  @source_dir = Pathname(@app.source_dir)
  @build_dir  = Pathname(@app.build_dir)
  @to_clean   = Set.new

  @logger = @app.logger
  @rack = ::Rack::Test::Session.new(@app.class.to_rack_app)

  super(base, @build_dir, config)
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



102
103
104
# File 'lib/middleman-core/cli/build.rb', line 102

def logger
  @logger
end

#sourceObject (readonly)

Returns the value of attribute source.



101
102
103
# File 'lib/middleman-core/cli/build.rb', line 101

def source
  @source
end

Instance Method Details

#invoke!void

This method returns an undefined value.

Execute the action



122
123
124
125
126
# File 'lib/middleman-core/cli/build.rb', line 122

def invoke!
  queue_current_paths if should_clean?
  execute!
  clean! if should_clean?
end