Sha256: 12b575340b532ef6ee99fbccd994d9579bd0beb4736888687726b45330b4eea2

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
#
# Copyright (c) 2007-2017 Minero Aoki, Kenshi Muto
#               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'.freeze

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>\{(.*?)[,\}]/) { provide $1 }
    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) { |line| result[line.strip] = '(predefined)' }
  result
rescue Errno::ENOENT
  return {}
end

def location
  "#{ARGF.filename}:#{ARGF.file.lineno}"
end

main

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
review-3.2.0 bin/review-checkdep
review-3.1.0 bin/review-checkdep
review-3.0.0 bin/review-checkdep
review-3.0.0.rc1 bin/review-checkdep
review-3.0.0.preview4 bin/review-checkdep
review-3.0.0.preview3 bin/review-checkdep
review-3.0.0.preview2 bin/review-checkdep
review-3.0.0.preview1 bin/review-checkdep
review-2.5.0 bin/review-checkdep
review-2.4.0 bin/review-checkdep