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.


16
17
18
19
20
21
22
23
24
25
26
27
28
# 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
    desc = "Directory #{target}"
    env.print_builder_run_message(desc, desc)
    cache.mkdir_p(target)
    target
  end
end