This problem emerged again with Rails 2.3.x. I hope I have fixed it this time.<br>The actual problem occur if running e.g. a test script with cmd-r.<br>Executor looks for the referenced file from current directory, which may be where the file being run is located, where as the output from the script is referring to the project directory.<br>
The actual_path_name function solves this, where 2 attempts are done. FIrst checks to see if the file referenced is relative to the current directory, if that fails, prefixes the referenced file with the project directory. This is really a better patch than the previous one, but not as pretty.<br>
<br>diff --git a/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb b/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb<br>index 75f1cca..60cf80d 100755<br>--- a/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb<br>
+++ b/Bundles/Ruby.tmbundle/Support/RubyMate/run_script.rb<br>@@ -66,6 +66,22 @@ def path_to_url_chunk(path)<br> end<br>end<br><br>+def actual_path_name(path)<br>+ prefix = ''<br>+ 2.times do<br>+ begin<br>+ file = Pathname.new(prefix + path).realpath.to_s<br>
+ url = '&url=file://' + e_url(file)<br>+ display_name = File.basename(file)<br>+ return file, url, display_name<br>+ rescue Errno::ENOENT<br>+ # Hmm lets try to prefix with project directory<br>
+ prefix = "#{ENV['TM_PROJECT_DIRECTORY']}/"<br>+ end<br>+ end<br>+ return path, '', path<br>+end<br>+<br>TextMate::Executor.run( cmd, :version_args => ["--version"],<br> :script_args => args ) do |line, type|<br>
if is_test_script and type == :out<br>@@ -82,13 +98,7 @@ TextMate::Executor.run( cmd, :version_args => ["--version"],<br> if file == '(eval)'<br> display_name = file<br> else<br>
- begin<br>- file = Pathname.new(file).realpath.to_s<br>- url = '&url=file://' + e_url(file)<br>- display_name = File.basename(file)<br>- rescue Errno::ENOENT<br>
- display_name = file<br>- end<br>+ file, url, display_name = actual_path_name(file)<br> end<br> end<br> out = indent<br><br><br><div class="gmail_quote">On Thu, Feb 5, 2009 at 6:36 PM, James Gray <span dir="ltr"><<a href="mailto:james@grayproductions.net">james@grayproductions.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Feb 5, 2009, at 2:51 AM, Stonefield wrote:<br>
<br>
> Sometimes the ouput from a run test command does not contain a<br>
> resolvable file name, which leads to the output raises an exception.<br>
> The enclosed patch fixes this problem (git diff).<br>
<br>
</div>Looks good to me. Applied.<br>
<br>
James Edward Gray II<br>
_______________________________________________<br>
textmate-dev mailing list<br>
<a href="mailto:textmate-dev@lists.macromates.com">textmate-dev@lists.macromates.com</a><br>
<a href="http://lists.macromates.com/listinfo/textmate-dev" target="_blank">http://lists.macromates.com/listinfo/textmate-dev</a><br>
</blockquote></div><br>