Class: FPM::Fry::Recipe
- Inherits:
-
Object
- Object
- FPM::Fry::Recipe
- Defined in:
- lib/fpm/fry/recipe.rb,
lib/fpm/fry/recipe/error.rb,
lib/fpm/fry/recipe/builder.rb
Overview
A FPM::Fry::Recipe contains all information needed to build a package.
It is usually created by Builder.
Defined Under Namespace
Classes: Builder, Error, NotFound, PackageBuilder, PackageRecipe, Step
Instance Attribute Summary collapse
-
#before_build_steps ⇒ Array<#to_s>
Steps that will be carried out before build.
-
#before_dependencies_steps ⇒ Array<#to_s>
Steps that will be carried out before dependencies are installed.
-
#build_depends ⇒ Hash<String,Hash>
Build dependencies.
-
#build_mounts ⇒ Object
Returns the value of attribute build_mounts.
-
#dockerfile_hooks ⇒ Array<#call>
Hooks that will be called when building the Dockerfile.
-
#input_hooks ⇒ Array<#call>
Hooks that will be called on the input package.
-
#packages ⇒ Array<FPM::Fry::PackageRecipe>
A list of packages that will be created.
-
#source ⇒ FPM::Fry::Source
The source used for building.
-
#steps ⇒ Array<#to_s>
Steps that will be carried out during build.
Instance Method Summary collapse
-
#apply_dockerfile_hooks(df) ⇒ Object
Filters the dockerfile.
-
#apply_input(package) ⇒ FPM::Package
Applies input settings to package.
-
#depends ⇒ Hash<String,Hash>
Calculates all dependencies of this recipe.
-
#initialize ⇒ Recipe
constructor
A new instance of Recipe.
-
#lint ⇒ Array<String>
Checks all packages for common errors.
Constructor Details
#initialize ⇒ Recipe
Returns a new instance of Recipe.
159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/fpm/fry/recipe.rb', line 159 def initialize @source = Source::Null @before_dependencies_steps = [] @before_build_steps = [] @steps = [] @packages = [PackageRecipe.new] @packages[0].files << '**' @build_depends = {} @input_hooks = [] @dockerfile_hooks = [] @build_mounts = [] end |
Instance Attribute Details
#before_build_steps ⇒ Array<#to_s>
Returns steps that will be carried out before build.
142 143 144 |
# File 'lib/fpm/fry/recipe.rb', line 142 def before_build_steps @before_build_steps end |
#before_dependencies_steps ⇒ Array<#to_s>
Returns steps that will be carried out before dependencies are installed.
139 140 141 |
# File 'lib/fpm/fry/recipe.rb', line 139 def before_dependencies_steps @before_dependencies_steps end |
#build_depends ⇒ Hash<String,Hash>
Returns build dependencies.
151 152 153 |
# File 'lib/fpm/fry/recipe.rb', line 151 def build_depends @build_depends end |
#build_mounts ⇒ Object
Returns the value of attribute build_mounts.
136 137 138 |
# File 'lib/fpm/fry/recipe.rb', line 136 def build_mounts @build_mounts end |
#dockerfile_hooks ⇒ Array<#call>
Returns hooks that will be called when building the Dockerfile.
157 158 159 |
# File 'lib/fpm/fry/recipe.rb', line 157 def dockerfile_hooks @dockerfile_hooks end |
#input_hooks ⇒ Array<#call>
Returns hooks that will be called on the input package.
154 155 156 |
# File 'lib/fpm/fry/recipe.rb', line 154 def input_hooks @input_hooks end |
#packages ⇒ Array<FPM::Fry::PackageRecipe>
Returns a list of packages that will be created.
148 149 150 |
# File 'lib/fpm/fry/recipe.rb', line 148 def packages @packages end |
#source ⇒ FPM::Fry::Source
Returns the source used for building.
134 135 136 |
# File 'lib/fpm/fry/recipe.rb', line 134 def source @source end |
#steps ⇒ Array<#to_s>
Returns steps that will be carried out during build.
145 146 147 |
# File 'lib/fpm/fry/recipe.rb', line 145 def steps @steps end |
Instance Method Details
#apply_dockerfile_hooks(df) ⇒ Object
Filters the dockerfile
199 200 201 202 203 204 |
# File 'lib/fpm/fry/recipe.rb', line 199 def apply_dockerfile_hooks( df ) dockerfile_hooks.each do |hook| hook.call(self, df) end return nil end |
#apply_input(package) ⇒ FPM::Package
Applies input settings to package
191 192 193 194 |
# File 'lib/fpm/fry/recipe.rb', line 191 def apply_input( package ) input_hooks.each{|h| h.call(self, package) } return package end |
#depends ⇒ Hash<String,Hash>
Calculates all dependencies of this recipe
174 175 176 177 178 179 180 |
# File 'lib/fpm/fry/recipe.rb', line 174 def depends depends = @packages.map(&:depends).inject(:merge) @packages.map(&:name).each do | n | depends.delete(n) end return depends end |
#lint ⇒ Array<String>
Checks all packages for common errors
184 185 186 |
# File 'lib/fpm/fry/recipe.rb', line 184 def lint packages.flat_map(&:lint) end |