Sha256: d435e66da2a32856d33dddd71e37def30d716c3bcefb3d2ba38e4a75bf40e320

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

# Copyright (C) 2010 Rocky Bernstein <rockyb@rubyforge.net>
require 'rubygems'; require 'require_relative'
require_relative 'base/cmd'
class Trepan::Command::DirectoryCommand < Trepan::Command

  unless defined?(HELP)
    ALIASES      = %w(dir)
    CATEGORY     = 'files'
    MAX_ARGS     = 1  # Need at most this many
    NAME         = File.basename(__FILE__, '.rb')
    HELP = <<-HELP
#{NAME} [DIR]

Add directory DIR to beginning of search path for source files.
DIR can also be $cwd for the current working directory, or $cdir for the
directory in which the debugged file start.
With no argument, reset the search path to $cdir:$cwd, the default.

This command may be useful for debugging into Rubinius methods such as
kernel/common/module.rb if have the source code somewhere.

Examples:
   #{NAME} # reset to $cdir:$cwd
      HELP

    SHORT_HELP  = 
      'Add directory DIR to beginning of search path for source files'
  end
    
  # This method runs the command
  def run(args) # :nodoc
    if args.size > 1
      path = File.expand_path(args[1])
      settings[:directory] = "#{path}:#{settings[:directory]}"
      msg "Source directories searched: #{settings[:directory]}"
    else
      if confirm('Reintialize source path to empty?', false)
        settings[:directory] = '$cdir:$cwd'
        msg "Source directories searched: #{settings[:directory]}"
      end
    end
  end
end

if __FILE__ == $0
  require_relative '../mock'
  dbgr, cmd = MockDebugger::setup
  cmd.run([cmd.name])
  cmd.run([cmd.name, '/tmp'])
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rb8-trepanning-0.1.3 processor/command/directory.rb
rb8-trepanning-0.1.3-universal-ruby-1.9.2 processor/command/directory.rb
rb8-trepanning-0.1.3-universal-ruby-1.8.7 processor/command/directory.rb