Sha256: cae813dcbc83174e22460d492f0324f8d1cf18f9c533d37801fc2fcc0a1ea4c7
Contents?: true
Size: 1.46 KB
Versions: 6
Compression:
Stored size: 1.46 KB
Contents
# -*- coding: utf-8 -*- # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net> require 'rubygems'; require 'require_relative' require_relative '../base/subcmd' class Trepan::Subcommand::InfoRuby < Trepan::Subcommand unless defined?(HELP) Trepanning::Subcommand.set_name_prefix(__FILE__, self) HELP = <<-EOH #{CMD} [-v|--verbose|-no-verbose] Show Ruby version information such as you'd get from "ruby -v" (which is really just the value of RUBY_RELEASE_DATE). See also constants: RUBY_DESCRIPITON, RUBY_VERSION, and RUBY_RELEASE_DATE." EOH MIN_ABBREV = 'ru'.size NEED_STACK = false MIN_ARGS = 0 MAX_ARGS = 0 SHORT_HELP = 'Ruby version information' end def parse_options(args) # :nodoc options = {} parser = OptionParser.new do |opts| opts.on("-v", "--[no-]verbose", "show additional version information") do |v| options[:verbose] = v end end parser.parse(args) return options end def run(args) options = parse_options(args[2..-1]) msg RUBY_DESCRIPTION if options[:verbose] # To be completed end end end if __FILE__ == $0 # Demo it. $0 = __FILE__ + 'notagain' # So we don't run this again require_relative '../../mock' cmd = MockDebugger::sub_setup(Trepan::Subcommand::InfoRuby, false) cmd.run(cmd.prefix) %w(-v --verbose --no-verbose).each do |opt| puts '-' * 10 + " #{opt}" cmd.run(cmd.prefix + [opt]) end end
Version data entries
6 entries across 6 versions & 1 rubygems