Debugging a gem in ruby -
i have gem, nanoc, i'd debug.
its command line, nanoc
executes following script (in /.rvm/gems/ruby-1.9.2-p290/bin)
#!/usr/bin/env ruby # # file generated rubygems. # # application 'nanoc' installed part of gem, , # file here 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)
which loads @ last line resolved (/.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 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)
what least intrusive options debug kind of scripts ? if pry first file, argv filename itself..
do have modify files run debugger ?
honestly, i'm not sure undestand question. put pry inside lib nanoc.
alternatively, fork git repo, , clone , run gem it's bundle , debug way well:
https://github.com/nanoc/nanoc
clone repo, add debug code, , run bundle exec bin/nanoc
way keeping locally installed copy clean. once figure out wrong, can build new gem, install it, commit code, , make pull request fix everybody.
Comments
Post a Comment