Class: Teapot::Build::Targets::Directory

Inherits:
Teapot::Build::Target show all
Defined in:
lib/teapot/build/targets/files.rb,
lib/teapot/build/targets/library.rb,
lib/teapot/build/targets/directory.rb,
lib/teapot/build/targets/executable.rb,
lib/teapot/build/targets/application.rb

Direct Known Subclasses

Application

Constant Summary collapse

BUILD_FILE =
"build.rb"

Instance Attribute Summary collapse

Attributes inherited from Teapot::Build::Target

#parent

Instance Method Summary collapse

Methods inherited from Teapot::Build::Target

#configure, target

Constructor Details

#initialize(parent, root = nil) ⇒ Directory

Returns a new instance of Directory.



29
30
31
32
33
34
# File 'lib/teapot/build/targets/directory.rb', line 29

def initialize(parent, root = nil)
	super parent
	
	@root = root
	@targets = []
end

Instance Attribute Details

#targetsObject (readonly)

Returns the value of attribute targets.



40
41
42
# File 'lib/teapot/build/targets/directory.rb', line 40

def targets
  @targets
end

Instance Method Details

#<<(target) ⇒ Object



42
43
44
# File 'lib/teapot/build/targets/directory.rb', line 42

def << (target)
	@targets << target
end

#add_application(*args, &block) ⇒ Object



49
50
51
# File 'lib/teapot/build/targets/application.rb', line 49

def add_application(*args, &block)
	self << Application.target(self, *args, &block)
end

#add_directory(path) ⇒ Object



46
47
48
49
50
51
52
53
# File 'lib/teapot/build/targets/directory.rb', line 46

def add_directory(path)
	directory = Directory.target(self, @root + path)
			
	build_path = (directory.root + BUILD_FILE).to_s
	directory.instance_eval(File.read(build_path), build_path)
			
	self << directory
end

#compile_executable(*args, &block) ⇒ Object



46
47
48
# File 'lib/teapot/build/targets/executable.rb', line 46

def compile_executable(*args, &block)
	self << Executable.target(self, *args, &block)
end

#compile_library(*args, &block) ⇒ Object



100
101
102
# File 'lib/teapot/build/targets/library.rb', line 100

def compile_library(*args, &block)
	self << Library.target(self, *args, &block)
end

#copy_files(*args, &block) ⇒ Object



72
73
74
# File 'lib/teapot/build/targets/files.rb', line 72

def copy_files(*args, &block)
	self << Files.target(self, *args, &block)
end

#copy_headers(*args, &block) ⇒ Object



76
77
78
# File 'lib/teapot/build/targets/files.rb', line 76

def copy_headers(*args, &block)
	self << Headers.target(self, *args, &block)
end

#execute(command, *arguments) ⇒ Object



55
56
57
58
59
# File 'lib/teapot/build/targets/directory.rb', line 55

def execute(command, *arguments)
	@targets.each do |target|
		target.execute(command, *arguments)
	end
end

#rootObject



36
37
38
# File 'lib/teapot/build/targets/directory.rb', line 36

def root
	@root || @parent.root
end