Sha256: c448e57e0f35945981c128a985e962ef3f1aa0c6e4ee857ccb32b92da2b31bc2

Contents?: true

Size: 1.53 KB

Versions: 115

Compression:

Stored size: 1.53 KB

Contents

module Autoproj
    # A set of packages that can be referred to by name
    class Metapackage
        # The metapackage name
        attr_reader :name
        # The packages listed in this metapackage
        attr_reader :packages
        # The normal dependency handling behaviour is to generate an error if a
        # metapackage is selected for the build but some of its dependencies
        # cannot be built. This modifies the behaviour to simply ignore the
        # problematic packages.
        attr_writer :weak_dependencies

        # @return [Boolean] whether the dependencies from this metapackage are
        #   weak or not
        # @see #weak_dependencies
        def weak_dependencies?
            !!@weak_dependencies
        end

        def initialize(name)
            @name = name
            @packages = []
            @weak_dependencies = false
        end

        # Adds a package to this metapackage
        #
        # @param [Autobuild::Package] pkg
        def add(pkg)
            @packages << pkg
        end

        # Lists the packages contained in this metapackage
        #
        # @yieldparam [Autobuild::Package] pkg
        def each_package(&block)
            @packages.each(&block)
        end

        # Tests if the given package is included in this metapackage
        #
        # @param [String,#name] pkg the package or package name
        def include?(pkg)
            if !pkg.respond_to?(:to_str)
                pkg = pkg.name
            end
            @packages.any? { |p| p.name == pkg }
        end
    end
end

Version data entries

115 entries across 115 versions & 1 rubygems

Version Path
autoproj-1.9.7.rc16 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc15 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc14 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc13 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc12 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc11 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc10 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc9 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc7 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc6 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc5 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc4 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc3 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc2 lib/autoproj/metapackage.rb
autoproj-1.9.7.rc1 lib/autoproj/metapackage.rb