[SVN] Re: Patch for RubyMate: 'No such file or directory' when backtrace contains eval

Elliot Winkler elliot.winkler at gmail.com
Fri Jan 16 19:42:06 UTC 2009


Actually, here's a better patch that removes the link to the method when
coming from an eval.

-- Elliot


On Fri, Jan 16, 2009 at 1:33 PM, Elliot Winkler <elliot.winkler at gmail.com>wrote:

> Hi all,
>
> I've noticed for a while now that when executing a Ruby script in TextMate,
> RubyMate will crap out with a "No such file or directory" error. For
> example, here's the output from RubyMate:
>
> Loaded suite
> /Users/elliot/Sites/localhost/htdocs/proj/work/store/test/models/fast/order_transaction_test
> Started
> ....F..................
> Finished in 0.155584 seconds.
>
>   1) Failure:
>
> test_ordertransaction_HASH_refund_should_partially_refund_the_transaction_by_the_given_amount_if_one_is_passed(OrderTransactionTest::TestOrdertransactionHASHRefund_3042040)
> /usr/local/lib/ruby/1.8/pathname.rb:420:in `lstat': No such file or
> directory -
> /Users/elliot/Sites/localhost/htdocs/proj/work/store/test/models/fast/(eval)
> (Errno::ENOENT) from
> /usr/local/lib/ruby/1.8/pathname.rb:420:in `realpath_rec' from
> /usr/local/lib/ruby/1.8/pathname.rb:453:in `realpath' from
> /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb:83
> from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:88:in
> `call' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:88:in
> `run' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/io.rb:41:in
> `call' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/io.rb:41:in
> `exhaust' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/io.rb:41:in
> `each_line' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/io.rb:41:in
> `exhaust' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/process.rb:165:in
> `run' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:100:in
> `run' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:199:in
> `process_output_wrapper' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:99:in
> `run' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/htmloutput.rb:134:in
> `call'
> from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/htmloutput.rb:134:in
> `show' from
> /Applications/TextMate.app/Contents/SharedSupport/Support/lib/tm/executor.rb:84:in
> `run' from
>
> /Applications/TextMate.app/Contents/SharedSupport/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb:65
>
> Whereas executing the script in the terminal results in:
>
> Loaded suite order_transaction_test
> Started
> ....F..................
> Finished in 0.151166 seconds.
>
>   1) Failure:
>
> test_ordertransaction_HASH_refund_should_partially_refund_the_transaction_by_the_given_amount_if_one_is_passed(OrderTransactionTest::TestOrdertransactionHASHRefund_8582050)
>     [(eval):1:in `create_refund_transaction'
>
> /Users/elliot/Sites/localhost/htdocs/proj/work/store/app/models/order_transaction.rb:122:in
> `refund!'
>      order_transaction_test.rb:138:in
> `test_ordertransaction_HASH_refund_should_partially_refund_the_transaction_by_the_given_amount_if_one_is_passed'
>
> /usr/local/lib/ruby/gems/1.8/gems/jeremymcanally-context-0.5/lib/context/suite.rb:32:in
> `run'
>
> /usr/local/lib/ruby/gems/1.8/gems/jeremymcanally-context-0.5/lib/context/suite.rb:30:in
> `each'
>
> /usr/local/lib/ruby/gems/1.8/gems/jeremymcanally-context-0.5/lib/context/suite.rb:30:in
> `run'
>
> /usr/local/lib/ruby/gems/1.8/gems/jeremymcanally-context-0.5/lib/context/suite.rb:32:in
> `run'
>
> /usr/local/lib/ruby/gems/1.8/gems/jeremymcanally-context-0.5/lib/context/suite.rb:30:in
> `each'
>
> /usr/local/lib/ruby/gems/1.8/gems/jeremymcanally-context-0.5/lib/context/suite.rb:30:in
> `run']:
> #<Mock:0x192dc94>.create_refund_transaction(:order, 1, 111) - expected
> calls: 0, actual calls: 1
> Similar expectations:
> #<Mock:0x192dc94>.create_refund_transaction(:order, 33, 111)
>
> 23 tests, 9 assertions, 1 failures, 0 errors
>
> I finally figured out today that it's because there's an eval in the
> backtrace which is being interpreted as a filename. So RubyMate tries to
> expand the path of the file, but of course "(eval)" is not a valid filename.
>
> I was surprised that this was not already being taken into account. But
> attached is a patch that fixes this for me.
>
> -- Elliot Winkler
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-dev/attachments/20090116/ee5f77dc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rubymate_fix_2.diff
Type: application/octet-stream
Size: 1596 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20090116/ee5f77dc/attachment.diff>


More information about the textmate-dev mailing list