Sha256: 6321079a5932f45d44b89f96a893a355d8ed86c180f60cad8551baa0f1f8f47d

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 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::InfoFiles < Trepan::Subcommand
  Trepan::Util::suppress_warnings {
    Trepanning::Subcommand.set_name_prefix(__FILE__, self)
    HELP         = 'Show files cached by the debugger'
    MIN_ABBREV   = 'files'.size
    MIN_ARGS     = 0
    MAX_ARGS     = 0
    NEED_STACK   = false
  }

  def run(args)
    files = LineCache::cached_files
    files += SCRIPT_LINES__.keys unless 'stat' == args[0] 
    files.uniq.sort.each do |file|
      stat = LineCache::stat(file)
      path = LineCache::path(file)
      print "File %s" % file
      if path and path != file
        msg(" - %s" % path)
      else
        msg ''
      end
      msg(("\t%s" % stat.mtime)) if stat
    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::InfoFiles, false)
  cmd.run(cmd.prefix)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rb8-trepanning-0.1.6 processor/command/info_subcmd/files.rb
rb8-trepanning-0.1.5 processor/command/info_subcmd/files.rb
rb8-trepanning-0.1.4 processor/command/info_subcmd/files.rb