我有一个 gem,nanoc,我想调试它。
它的命令行,nanoc
执行以下脚本(在 /.rvm/gems/ruby-1.9.2-p290/bin 中)
#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'nanoc' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end
gem 'nanoc', version
load Gem.bin_path('nanoc', 'nanoc', version)
它本身在最后一行加载解析为 (/.rvm/gems/ruby-1.9.2-p290/gems/nanoc-3.6.2/bin)
#!/usr/bin/env ruby
# encoding: utf-8
# Try loading bundler if it's possible
begin
require 'bundler/setup'
rescue LoadError
# no problem
end
# Add lib to load path
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
# Load nanoc
require 'nanoc'
require 'nanoc/cli'
# Run base
Nanoc::CLI.run(ARGV)
调试这类脚本的侵入性最小的选项是什么?如果我只是撬第一个文件,ARGV 将是文件名本身..
我是否必须修改文件才能运行调试器?