Sha256: 0a3932dd793da8f83cac093dfac1edaabc205c8fad48328d94306eff4f7c16ee

Contents?: true

Size: 1.48 KB

Versions: 141

Compression:

Stored size: 1.48 KB

Contents

require 'yaml'
module Autoproj
    YAML_LOAD_ERROR =
        if defined? Psych::SyntaxError
            Psych::SyntaxError
        else
            ArgumentError
        end
            
    class ConfigError < RuntimeError
        attr_accessor :file
        def initialize(file = nil)
            super
            @file = file
        end
    end
    class InternalError < RuntimeError; 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

141 entries across 141 versions & 1 rubygems

Version Path
autoproj-1.13.7 lib/autoproj/base.rb
autoproj-1.13.6 lib/autoproj/base.rb
autoproj-1.13.5 lib/autoproj/base.rb
autoproj-1.13.5.rc1 lib/autoproj/base.rb
autoproj-1.13.4 lib/autoproj/base.rb
autoproj-1.13.3 lib/autoproj/base.rb
autoproj-1.13.3.b2 lib/autoproj/base.rb
autoproj-1.13.3.b1 lib/autoproj/base.rb
autoproj-1.13.2.b4 lib/autoproj/base.rb
autoproj-1.13.2.b3 lib/autoproj/base.rb
autoproj-1.13.2.b2 lib/autoproj/base.rb
autoproj-1.13.2.b1 lib/autoproj/base.rb
autoproj-1.13.2 lib/autoproj/base.rb
autoproj-1.13.1 lib/autoproj/base.rb
autoproj-1.13.0 lib/autoproj/base.rb
autoproj-1.12.6 lib/autoproj/base.rb
autoproj-1.13.0.b8 lib/autoproj/base.rb
autoproj-1.13.0.b7 lib/autoproj/base.rb
autoproj-1.13.0.b6 lib/autoproj/base.rb
autoproj-1.13.0.b5 lib/autoproj/base.rb