Sha256: 98fa685b920fbb87c917c996b128fd9831366d91f6df5fc1df396aec8baed416
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'pathname' require 'optparse' require 'objspace' require 'find' $LOAD_PATH.unshift File.expand_path('../lib', __dir__) require 'ruby_minimum_version' quiet = false verbose = false parser = OptionParser.new parser.banner.concat(' [filename ...]') parser.version = RubyMinimumVersion::VERSION parser.on('--quiet') { quiet = true } parser.on('--verbose') { verbose = true } parser.parse! quiet or $stderr.print 'Searching for Ruby files...' filenames = ARGV.flat_map do |file| File.file?(file) ? file : Find.find(file).select { |file| File.file?(file) && !file.end_with?('~') } end quiet or warn " found #{filenames.count} file(s)\n" filenames.each do |filename| filename = File.expand_path(filename) filename_in_log = Pathname(filename).relative_path_from(Dir.pwd) unless File.file?(filename) warn "No such file #{filename_in_log}" exit 1 end unless quiet if verbose warn "Scanning #{filename_in_log}..." else $stderr.print "Scanning #{filename_in_log}..." end end version = RubyMinimumVersion.new(filename, verbose: verbose).minimum_version unless quiet if verbose warn 'Scanning done' else warn ' done' end end if filenames.count >= 2 puts "#{filename_in_log}: #{version}" else puts version end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_minimum_version-0.1.0 | exe/rubyver |