Sha256: 7a0f25e5400087ecdd986e96a31819d8fc6c6c89aceeeb51baae4e6c7b79fc61

Contents?: true

Size: 1.28 KB

Versions: 83

Compression:

Stored size: 1.28 KB

Contents

require 'yaml'
module Autoproj
    YAML_LOAD_ERROR =
        if defined? Psych::SyntaxError
            Psych::SyntaxError
        else
            ArgumentError
        end
            
    # Yields, and if the given block raises a ConfigError with no file assigned,
    # add that file to both the object and the exception message
    def self.in_file(file, exception_t = ConfigError)
        yield

    rescue exception_t => e
        if exception_t != ConfigError
            raise ConfigError.new(file), "in #{file}: #{e.message}", e.backtrace
        elsif !e.file
            e.file = file
            raise e, "in #{file}: #{e.message}", e.backtrace
        else
            raise e
        end
    end

    @post_import_blocks = Hash.new { |h, k| h[k] = Array.new }
    class << self
        attr_reader :post_import_blocks
    end

    def self.each_post_import_block(pkg, &block)
        @post_import_blocks[nil].each(&block)
        if @post_import_blocks.has_key?(pkg)
            @post_import_blocks[pkg].each(&block)
        end
    end

    def self.post_import(*packages, &block)
        if packages.empty?
            @post_import_blocks[nil] << block
        else
            packages.each do |pkg|
                @post_import_blocks[pkg] << block
            end
        end
    end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
autoproj-2.5.0.pre1 lib/autoproj/base.rb
autoproj-2.4.0 lib/autoproj/base.rb
autoproj-2.3.1 lib/autoproj/base.rb
autoproj-2.3.0 lib/autoproj/base.rb
autoproj-2.2.2 lib/autoproj/base.rb
autoproj-2.2.1 lib/autoproj/base.rb
autoproj-2.2.0 lib/autoproj/base.rb
autoproj-2.1.2 lib/autoproj/base.rb
autoproj-2.1.1 lib/autoproj/base.rb
autoproj-2.1.0 lib/autoproj/base.rb
autoproj-2.1.0.rc1 lib/autoproj/base.rb
autoproj-2.0.3 lib/autoproj/base.rb
autoproj-2.0.2 lib/autoproj/base.rb
autoproj-2.0.1 lib/autoproj/base.rb
autoproj-2.0.0 lib/autoproj/base.rb
autoproj-2.0.0.rc42 lib/autoproj/base.rb
autoproj-2.0.0.rc41 lib/autoproj/base.rb
autoproj-2.0.0.rc40 lib/autoproj/base.rb
autoproj-2.0.0.rc39 lib/autoproj/base.rb
autoproj-2.0.0.rc38 lib/autoproj/base.rb