class Cany::Specification
Constants
- EXT
Attributes
Public Class Methods
# File lib/cany/specification.rb, line 12 def initialize(dsl=Cany::Specification::DSL, &block) @recipes = [] @dependencies = [] setup dsl, &block end
Public Instance Methods
@api public Return all dependencies needed to build this package @return [Array<Dependency>] A list of dependencies.
# File lib/cany/specification.rb, line 25 def build_dependencies dependencies.select(&:build?) end
@api public Return all dependencies needed to build this package @return [Array<Dependency>] A list of dependencies.
# File lib/cany/specification.rb, line 32 def runtime_dependencies dependencies.select(&:runtime?) end
# File lib/cany/specification.rb, line 18 def setup(dsl=Cany::Specification::DSL, &block) dsl.new(self).exec(&block) end
@api private This method creates recipe instances for all required recipes from the given spec.
# File lib/cany/specification.rb, line 55 def setup_recipes last_recipe = nil recipes.reverse.each do |recipe| recipe.inner = last_recipe unless last_recipe.nil? last_recipe = recipe end recipes.map(&:prepare) end
Return the system recipe for this specification. @return [Recipe] The system reciep @raise [NoSystemRecipe] if no system recipe was specified.
# File lib/cany/specification.rb, line 48 def system_recipe raise NoSystemRecipe.new unless @system_recipe @system_recipe end
Define the given recipe instance as system recipe. It can be accessed by other recipes under the system name and it is added as last recipe and do system specific things. At the moment the only recipe designed to work as system recipe is the DebHelperRecipe The attribute should be set after all recipe changes are over. @param recipe the system recipe instance
# File lib/cany/specification.rb, line 41 def system_recipe=(recipe) @system_recipe = recipe @recipes << recipe end
# File lib/cany/specification.rb, line 64 def to_s "Cany::Specification<#{object_id}>(name=#{name}, recipes=[#{recipes.map(&:name).join(', ')}]" end