Sha256: 75bbf8ecb8016acfa587d83b4a5366d49dc8ca3fd165ee36b2351f95c029a4d4

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 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} ~/.rvm/src/rbx-head  # Adds an rvm-like directory to path
   #{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: $cdir:$cwd'
      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

5 entries across 5 versions & 1 rubygems

Version Path
rbx-trepanning-0.0.8-universal-rubinius-1.2 processor/command/directory.rb
rbx-trepanning-0.0.7-universal-rubinius-1.2 processor/command/directory.rb
rbx-trepanning-0.0.6-universal-rubinius-1.2 processor/command/directory.rb
rbx-trepanning-0.0.5-universal-rubinius-1.2.1 processor/command/directory.rb
rbx-trepanning-0.0.4-universal-rubinius-1.2 processor/command/directory.rb