Class: Cany::Dpkg::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/cany/dpkg/builder.rb

Overview

This class does the real job. It is called for every dpkg build step to build the package. An instance is created on every execution. The package specification is passed as option to the initializer. Afterwards the run method is called to execute the wanted build step. The first parameter specifies the build step name (clean, build, binary). This method uses recipes instances to do the job itself.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Builder



10
11
12
# File 'lib/cany/dpkg/builder.rb', line 10

def initialize(spec)
  @spec = spec
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



9
10
11
# File 'lib/cany/dpkg/builder.rb', line 9

def spec
  @spec
end

Instance Method Details

#run(build_step_name) ⇒ Object

This method is called to do the actual work



17
18
19
20
21
22
# File 'lib/cany/dpkg/builder.rb', line 17

def run(build_step_name)
  spec.system_recipe = DebHelperRecipe.new spec
  spec.setup_recipes
  spec.system_recipe.exec 'dh_prep' if build_step_name.to_s == 'binary'
  spec.recipes.first.send build_step_name.gsub('binary-arch', 'binary').to_s
end