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:



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/middleman-core/cli/build.rb', line 112

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.



106
107
108
# File 'lib/middleman-core/cli/build.rb', line 106

def logger
  @logger
end

#sourceObject (readonly)

Returns the value of attribute source.



105
106
107
# File 'lib/middleman-core/cli/build.rb', line 105

def source
  @source
end

Instance Method Details

#invoke!

This method returns an undefined value.

Execute the action



126
127
128
129
130
# File 'lib/middleman-core/cli/build.rb', line 126

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