Class: Teapot::Target
- Inherits:
-
Definition
- Object
- Definition
- Teapot::Target
- Includes:
- Build::Dependency
- Defined in:
- lib/teapot/target.rb
Instance Attribute Summary collapse
-
#rulebook ⇒ Object
readonly
Returns the value of attribute rulebook.
Attributes inherited from Definition
#context, #description, #name, #package
Instance Method Summary collapse
- #build(&block) ⇒ Object
-
#environment(configuration, chain) ⇒ Object
Given a specific configuration, generate the build environment based on this target and it’s provision chain.
- #freeze ⇒ Object
-
#initialize(context, package, name) ⇒ Target
constructor
A new instance of Target.
Methods inherited from Definition
Constructor Details
#initialize(context, package, name) ⇒ Target
Returns a new instance of Target.
35 36 37 38 39 40 41 |
# File 'lib/teapot/target.rb', line 35 def initialize(context, package, name) super context, package, name @build = nil @rulebook = Build::Rulebook.new end |
Instance Attribute Details
#rulebook ⇒ Object (readonly)
Returns the value of attribute rulebook.
43 44 45 |
# File 'lib/teapot/target.rb', line 43 def rulebook @rulebook end |
Instance Method Details
#build(&block) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/teapot/target.rb', line 69 def build(&block) if block_given? @build = block end return @build end |
#environment(configuration, chain) ⇒ Object
Given a specific configuration, generate the build environment based on this target and it’s provision chain.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/teapot/target.rb', line 53 def environment(configuration, chain) chain = chain.partial(self) # Calculate the dependency chain's ordered environments: environments = chain.provisions.collect do |provision| Build::Environment.new(&provision.value) end # Merge all the environments together: environment = Build::Environment.combine(*environments) environment.merge do default platforms_path configuration.platforms_path end end |
#freeze ⇒ Object
45 46 47 48 49 50 |
# File 'lib/teapot/target.rb', line 45 def freeze @build.freeze @rulebook.freeze super end |