Class: Teapot::Build::Target
- Inherits:
-
Object
- Object
- Teapot::Build::Target
- Defined in:
- lib/teapot/build/target.rb
Direct Known Subclasses
Teapot::Build::Targets::Directory, Teapot::Build::Targets::External, Teapot::Build::Targets::Files, Teapot::Build::Targets::Library
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
- #configure(&block) ⇒ Object
- #execute(command, environment, *arguments) ⇒ Object
-
#initialize(parent) ⇒ Target
constructor
A new instance of Target.
- #root ⇒ Object
Constructor Details
#initialize(parent) ⇒ Target
Returns a new instance of Target.
35 36 37 38 |
# File 'lib/teapot/build/target.rb', line 35 def initialize(parent) @parent = parent @configure = nil end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
40 41 42 |
# File 'lib/teapot/build/target.rb', line 40 def parent @parent end |
Class Method Details
.target(*args, &block) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/teapot/build/target.rb', line 50 def self.target(*args, &block) instance = self.new(*args) if block_given? instance.instance_eval(&block) end return instance end |
Instance Method Details
#configure(&block) ⇒ Object
46 47 48 |
# File 'lib/teapot/build/target.rb', line 46 def configure(&block) @configure = Proc.new &block end |
#execute(command, environment, *arguments) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/teapot/build/target.rb', line 60 def execute(command, environment, *arguments) if @configure environment = environment.merge &@configure end # Flatten the environment to a hash: values = environment.flatten puts "Performing #{self.class}/#{command} for #{root}...".color(:cyan) # Show the environment to the user: Environment::System::dump(values) self.send(command, values, *arguments) end |