Sha256: 16c2cdeabf1c1cd3b258668ed81fa8381a945eb11bd2acfb2afd8543b5eb08f9

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

module Cany
  module Dpkg
    # 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.
    class Builder
      attr_reader :spec
      def initialize(spec)
        @spec = spec
      end

      def debian(*args)
        File.join spec.base_dir, 'debian', *args
      end

      # This method is called to do the actual work
      # @api public
      # @param [String] build_step_name The name of the dpkg build step (clean, build, binary)
      def run(build_step_name)
        setup_recipes
        @recipes.first.send build_step_name.to_s
      end

      # @api private
      # This method creates recipe instances for all required recipes from the given spec.
      def setup_recipes
        @recipes = []
        @recipes << DebHelperRecipe.new(spec, nil)
        spec.recipes.reverse.each do |name|
          @recipes.unshift Recipe.from_name(name).new(spec, @recipes.first)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cany-0.0.2 lib/cany/dpkg/builder.rb
cany-0.0.1 lib/cany/dpkg/builder.rb