Sha256: 77a94b24f04aba6500e59ce1d4b91a25d959a67556ee68fc1bc6a8cfc8fdf3f3
Contents?: true
Size: 1.27 KB
Versions: 25
Compression:
Stored size: 1.27 KB
Contents
#!/usr/bin/env ruby # # $Id: review-checkdep 3748 2007-12-24 07:06:06Z aamine $ # # Copyright (c) 1999-2007 Minero Aoki # # This program is free software. # You can distribute or modify this program under the terms of # the GNU LGPL, Lesser General Public License version 2.1. # For details of the GNU LGPL, see the file "COPYING". # require 'pathname' bindir = Pathname.new(__FILE__).realpath.dirname $LOAD_PATH.unshift((bindir + '../lib').realpath) PREDEF_FILE = 'PREDEF' def main @provided = parse_predefined() @unprovided = {} ARGF.each do |line| case line when /\A\#@require\((.*)\)/ kw = $1 unless @provided.key?(kw) puts "#{location()}: not provided: #{kw}" @unprovided[kw] = location() end when /\A\#@provide\((.*)\)/ provide $1 else line.scan(/@<kw>\{(.*?)[,\}]/) do provide $1 end end end end def provide(kw) @provided[kw] ||= location() if @unprovided[kw] reqpos = @unprovided.delete(kw) puts "#{location()}: provided now: #{kw} (#{reqpos})" end end def parse_predefined result = {} File.foreach(PREDEF_FILE) do |line| result[line.strip] = '(predefined)' end result rescue Errno::ENOENT return {} end def location "#{ARGF.filename}:#{ARGF.file.lineno}" end main
Version data entries
25 entries across 25 versions & 3 rubygems