Class: Cany::Specification
- Inherits:
-
Object
- Object
- Cany::Specification
- Defined in:
- lib/cany/specification.rb,
lib/cany/specification/dsl.rb
Defined Under Namespace
Classes: DSL
Constant Summary collapse
- EXT =
'canspec'
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
-
#binary ⇒ Object
Returns the value of attribute binary.
-
#build ⇒ Object
Returns the value of attribute build.
-
#cany_version_constraint ⇒ Object
Returns the value of attribute cany_version_constraint.
-
#clean ⇒ Object
Returns the value of attribute clean.
-
#dependencies ⇒ Object
Returns the value of attribute dependencies.
-
#description ⇒ Object
Returns the value of attribute description.
-
#licence ⇒ Object
Returns the value of attribute licence.
-
#maintainer_email ⇒ Object
Returns the value of attribute maintainer_email.
-
#maintainer_name ⇒ Object
Returns the value of attribute maintainer_name.
-
#name ⇒ Object
Returns the value of attribute name.
-
#prepare ⇒ Object
Returns the value of attribute prepare.
-
#recipes ⇒ Object
Returns the value of attribute recipes.
-
#version ⇒ Object
Returns the value of attribute version.
-
#website ⇒ Object
Returns the value of attribute website.
Instance Method Summary collapse
-
#build_dependencies ⇒ Array<Dependency>
Return all dependencies needed to build this package.
-
#initialize(dsl = Cany::Specification::DSL, &block) ⇒ Specification
constructor
A new instance of Specification.
-
#runtime_dependencies ⇒ Array<Dependency>
Return all dependencies needed to build this package.
- #setup(dsl = Cany::Specification::DSL, &block) ⇒ Object
-
#setup_recipes ⇒ Object
private
This method creates recipe instances for all required recipes from the given spec.
-
#system_recipe ⇒ Recipe
Return the system recipe for this specification.
-
#system_recipe=(recipe) ⇒ Object
Define the given recipe instance as system recipe.
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(dsl = Cany::Specification::DSL, &block) ⇒ Specification
Returns a new instance of Specification.
12 13 14 15 16 |
# File 'lib/cany/specification.rb', line 12 def initialize(dsl=Cany::Specification::DSL, &block) @recipes = [] @dependencies = [] setup dsl, &block end |
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
9 10 11 |
# File 'lib/cany/specification.rb', line 9 def base_dir @base_dir end |
#binary ⇒ Object
Returns the value of attribute binary.
10 11 12 |
# File 'lib/cany/specification.rb', line 10 def binary @binary end |
#build ⇒ Object
Returns the value of attribute build.
10 11 12 |
# File 'lib/cany/specification.rb', line 10 def build @build end |
#cany_version_constraint ⇒ Object
Returns the value of attribute cany_version_constraint.
9 10 11 |
# File 'lib/cany/specification.rb', line 9 def cany_version_constraint @cany_version_constraint end |
#clean ⇒ Object
Returns the value of attribute clean.
10 11 12 |
# File 'lib/cany/specification.rb', line 10 def clean @clean end |
#dependencies ⇒ Object
Returns the value of attribute dependencies.
9 10 11 |
# File 'lib/cany/specification.rb', line 9 def dependencies @dependencies end |
#description ⇒ Object
Returns the value of attribute description.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def description @description end |
#licence ⇒ Object
Returns the value of attribute licence.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def licence @licence end |
#maintainer_email ⇒ Object
Returns the value of attribute maintainer_email.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def maintainer_email @maintainer_email end |
#maintainer_name ⇒ Object
Returns the value of attribute maintainer_name.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def maintainer_name @maintainer_name end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def name @name end |
#prepare ⇒ Object
Returns the value of attribute prepare.
10 11 12 |
# File 'lib/cany/specification.rb', line 10 def prepare @prepare end |
#recipes ⇒ Object
Returns the value of attribute recipes.
9 10 11 |
# File 'lib/cany/specification.rb', line 9 def recipes @recipes end |
#version ⇒ Object
Returns the value of attribute version.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def version @version end |
#website ⇒ Object
Returns the value of attribute website.
8 9 10 |
# File 'lib/cany/specification.rb', line 8 def website @website end |
Instance Method Details
#build_dependencies ⇒ Array<Dependency>
Return all dependencies needed to build this package
25 26 27 |
# File 'lib/cany/specification.rb', line 25 def build_dependencies dependencies.select(&:build?) end |
#runtime_dependencies ⇒ Array<Dependency>
Return all dependencies needed to build this package
32 33 34 |
# File 'lib/cany/specification.rb', line 32 def runtime_dependencies dependencies.select(&:runtime?) end |
#setup(dsl = Cany::Specification::DSL, &block) ⇒ Object
18 19 20 |
# File 'lib/cany/specification.rb', line 18 def setup(dsl=Cany::Specification::DSL, &block) dsl.new(self).exec(&block) end |
#setup_recipes ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method creates recipe instances for all required recipes from the given spec.
55 56 57 58 59 60 61 62 |
# 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 |
#system_recipe ⇒ Recipe
Return the system recipe for this specification.
48 49 50 51 |
# File 'lib/cany/specification.rb', line 48 def system_recipe raise NoSystemRecipe.new unless @system_recipe @system_recipe end |
#system_recipe=(recipe) ⇒ Object
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.
41 42 43 44 |
# File 'lib/cany/specification.rb', line 41 def system_recipe=(recipe) @system_recipe = recipe @recipes << recipe end |
#to_s ⇒ Object Also known as: inspect
64 65 66 |
# File 'lib/cany/specification.rb', line 64 def to_s "Cany::Specification<#{object_id}>(name=#{name}, recipes=[#{recipes.map(&:name).join(', ')}]" end |