Class: Rscons::Builders::Directory

Inherits:
Rscons::Builder show all
Defined in:
lib/rscons/builders/directory.rb

Overview

The Directory builder creates a directory.

Instance Method Summary collapse

Methods inherited from Rscons::Builder

#create_build_target, #default_variables, #features, #finalize, #name, #produces?, #setup, #standard_build, #standard_finalize, #standard_threaded_build

Instance Method Details

#run(target, sources, cache, env, vars) ⇒ String, false

Run the builder to produce a build target.

Parameters:

  • target (String)

    Target file name.

  • sources (Array<String>)

    Source file name(s).

  • cache (Cache)

    The Cache object.

  • env (Environment)

    The Environment executing the builder.

  • vars (Hash, VarSet)

    Extra construction variables.

Returns:

  • (String, false)

    Name of the target file on success or false on failure.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rscons/builders/directory.rb', line 16

def run(target, sources, cache, env, vars)
  if File.directory?(target)
    target
  elsif File.exists?(target)
    Ansi.write($stderr, :red, "Error: `#{target}' already exists and is not a directory", :reset, "\n")
    false
  else
    env.print_builder_run_message("Directory #{target}", nil)
    cache.mkdir_p(target)
    target
  end
end