Sha256: 6ce35c41cedbc5122e4a7978328463d783ab0b6658ca3f76fd53b2ffd025cb26

Contents?: true

Size: 1.61 KB

Versions: 7

Compression:

Stored size: 1.61 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net>
require_relative '../base/subcmd'

class Trepan::Subcommand::InfoRuby < Trepan::Subcommand
  unless defined?(HELP)
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP         = <<-EOH
#{CMD}

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_DESCRIPTION, 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]
    #   msg "Options:"
    #   msg "  Interpreter type: #{Rubinius::INTERPRETER}"
    #   if jit = Rubinius::JIT
    #     msg "  JIT enabled: #{jit.join(', ')}"
    #   else
    #     msg "  JIT disabled"
    #   end
    # 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

7 entries across 7 versions & 1 rubygems

Version Path
trepanning-2.15.35 processor/command/info_subcmd/ruby.rb
trepanning-1.93.35 processor/command/info_subcmd/ruby.rb
trepanning-2.15.33 processor/command/info_subcmd/ruby.rb
trepanning-1.93.32 processor/command/info_subcmd/ruby.rb
trepanning-0.1.6 processor/command/info_subcmd/ruby.rb
trepanning-0.1.4 processor/command/info_subcmd/ruby.rb
trepanning-0.1.3 processor/command/info_subcmd/ruby.rb