Sha256: 43ba3361fb9a58a76008c4ad11815af153ccefe940cb4f0321633092989f4250

Contents?: true

Size: 1.26 KB

Versions: 49

Compression:

Stored size: 1.26 KB

Contents

module Autoproj
    # Manifest of installed packages imported from another autoproj installation
    class InstallationManifest
        Package = Struct.new :name, :srcdir, :prefix

        DEFAULT_MANIFEST_NAME = ".autoproj-installation-manifest"

        attr_reader :path
        attr_reader :packages
        def initialize(path)
            @path = path
        end

        def default_manifest_path
            File.join(path, DEFAULT_MANIFEST_NAME)
        end
            
        def load(path = default_manifest_path)
            @packages = CSV.read(path).map do |row|
                Package.new(*row)
            end
        end

        def each(&block)
            packages.each(&block)
        end

        def [](name)
            packages.find { |pkg| pkg.name == name }
        end

        def self.from_root(root_dir)
            manifest = InstallationManifest.new(root_dir)
            manifest_file = File.join(root_dir,  ".autoproj-installation-manifest")
            if !File.file?(manifest_file)
                raise ConfigError.new, "no .autoproj-installation-manifest file exists in #{root_dir}. You should probably rerun autoproj envsh in that folder first"
            end
            manifest.load(manifest_file)
            manifest
        end
    end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
autoproj-1.11.0.rc6 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.rc5 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.rc4 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.rc3 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.rc2 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.rc1 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.b3 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.b2 lib/autoproj/installation_manifest.rb
autoproj-1.11.0.b1 lib/autoproj/installation_manifest.rb