<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>vendor/TextMate/Zena.tmbundle/Support/RubyMate/catch_exception.rb</filename>
    </added>
    <added>
      <filename>vendor/TextMate/Zena.tmbundle/Support/RubyMate/stdin_dialog.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -24,7 +24,7 @@ export RUBYLIB=&quot;$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}&quot;
 	&lt;key&gt;input&lt;/key&gt;
 	&lt;string&gt;document&lt;/string&gt;
 	&lt;key&gt;keyEquivalent&lt;/key&gt;
-	&lt;string&gt;@r&lt;/string&gt;
+	&lt;string&gt;~r&lt;/string&gt;
 	&lt;key&gt;name&lt;/key&gt;
 	&lt;string&gt;Run all yaml tests&lt;/string&gt;
 	&lt;key&gt;output&lt;/key&gt;</diff>
      <filename>vendor/TextMate/Zena.tmbundle/Commands/Run all yaml tests.tmCommand</filename>
    </modified>
    <modified>
      <diff>@@ -7,8 +7,7 @@
 	&lt;key&gt;command&lt;/key&gt;
 	&lt;string&gt;# Assumes the current file is a yaml test file
 # Runs with the currently-focused method as the test name
-
-args=$(${TM_RUBY:=ruby} &lt;&lt;&quot;EOF&quot;
+args=$(${TM_RUBY:=ruby} &amp;lt;&amp;lt;&quot;EOF&quot;
 
 n = ENV['TM_LINE_NUMBER'].to_i
 
@@ -36,7 +35,7 @@ exit_show_tool_tip
 fi
 
 export RUBYLIB=&quot;$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}&quot;
-&quot;${TM_RUBY:-ruby}&quot; -- &quot;$TM_BUNDLE_SUPPORT/RubyMate/run_script.rb&quot; $args&lt;/string&gt;
+&quot;${TM_RUBY:-ruby}&quot; -- &quot;$TM_BUNDLE_SUPPORT/RubyMate/run_script.rb&quot; $args	&lt;/string&gt;
 	&lt;key&gt;input&lt;/key&gt;
 	&lt;string&gt;document&lt;/string&gt;
 	&lt;key&gt;keyEquivalent&lt;/key&gt;</diff>
      <filename>vendor/TextMate/Zena.tmbundle/Commands/Run focused yaml test.tmCommand</filename>
    </modified>
    <modified>
      <diff>@@ -1,74 +1,118 @@
-require &quot;#{ENV[&quot;TM_SUPPORT_PATH&quot;]}/lib/scriptmate&quot;
-require &quot;cgi&quot;
+require &quot;#{ENV['TM_SUPPORT_PATH']}/lib/scriptmate&quot;
+require 'cgi'
 
-$SCRIPTMATE_VERSION = &quot;$Revision: 8136 $&quot;
+$SCRIPTMATE_VERSION = &quot;$Revision: 6354 $&quot;
 
-class TrivialScript &lt; UserCommand
-  attr_reader :lang
-  def initialize(*args)
-    super
-    @cmd = &quot;ruby #{ARGV.join(' ')}&quot;
-    @display_name = ARGV.last
-    @lang         = &quot;Ruby&quot;
-  end
+class RubyScript &lt; UserScript
+  attr_reader :test_name, :base_path, :path, :content
+  def lang; 'Ruby' end
+  def executable; @hashbang || ENV['TM_RUBY'] || 'ruby' end
+  def args; ['-rcatch_exception', '-rstdin_dialog'] end
   def version_string
-    ruby_path = %x{ ruby -e 'require &quot;rbconfig&quot;; print Config::CONFIG[&quot;bindir&quot;] + &quot;/&quot; + Config::CONFIG[&quot;ruby_install_name&quot;]'}
-    res = &quot;Ruby r&quot; + %x{ ruby -e 'print RUBY_VERSION' }
+    ruby_path = %x{ #{executable} -e 'require &quot;rbconfig&quot;; print Config::CONFIG[&quot;bindir&quot;] + &quot;/&quot; + Config::CONFIG[&quot;ruby_install_name&quot;]'}
+    res = &quot;Ruby r&quot; + %x{ #{executable} -e 'print RUBY_VERSION' }
     res + &quot; (#{ruby_path})&quot;
   end
-  def args; ['-rcatch_exception', '-rstdin_dialog'] end
-  def run
-    stdin, stdout, stderr, pid = my_popen3(@cmd)
-    return stdout, stderr, nil, pid
+  def test_script?
+    @path    =~ /(?:\b|_)(?:tc|ts|test)(?:\b|_)/ or
+    @content =~ /\brequire\b.+(?:test\/unit|test_helper)/
+  end
+  def filter_cmd(cmd)
+    cmd -= [ENV['TM_FILEPATH']]
+    if test_script?
+      path_ary = @path.split('/')
+      if index = path_ary.rindex('test')
+        test_path = File.join(*path_ary[0..index])
+        lib_path  = File.join( *( path_ary[0..-2] +
+                                  ['..'] * (path_ary.length - index - 1) ) +
+                                  ['lib'] )
+        if File.exist? lib_path
+          cmd.insert(1, &quot;-I#{e_sh lib_path}:#{e_sh test_path}&quot;)
+        end
+      end
+    end
+    if index = cmd.rindex('--name')
+      @test_name = cmd[index+1]
+      @base_path = cmd[index-1].gsub(/\_test.rb$/,'')
+    else
+      @base_path = cmd.last.gsub(/\_test.rb$/,'')
+    end
+    @cmd = cmd
   end
 end
 
 class RubyMate &lt; ScriptMate
+  def base_path
+    @base_path ||= begin
+      path_ary = @command.path.split('/')
+      if index = path_ary.rindex('test')
+        File.join(*path_ary[0..(index -1)])
+      else
+        @command.path
+      end
+    end
+  end
+
+  def run
+    super
+  rescue =&gt; err
+    File.open('/Users/gaspard/yaml.log', 'ab') do |f|
+      f.puts err.message
+      f.puts err.backtrace.join(&quot;\n&quot;)
+    end
+    raise err
+  end
+
+  def absolute_path(path)
+    if path =~ %r{\A/}
+      path
+    else
+      &quot;#{base_path}/#{path}&quot;
+    end
+  end
+
+  def full_method_name(file, method)
+    if absolute_path(file) == @command.path
+      method
+    else
+      &quot;#{File.basename(file)} #{method}&quot;
+    end
+  end
+
   def filter_stdout(str)
-    if str =~ /\A[.EF]+\Z/
-      return htmlize(str).gsub(/[EF]+/, &quot;&lt;span style=\&quot;color: red\&quot;&gt;\\&amp;&lt;/span&gt;&quot;) +
-            &quot;&lt;br style=\&quot;display: none\&quot;/&gt;&quot;
+    if @command.test_script? and str =~ /\A[.EF]+\Z/
+      # ...F....E....
+      htmlize(str).gsub(/[EF]+/, &quot;&lt;span style=\&quot;color: red\&quot;&gt;\\&amp;&lt;/span&gt;&quot;) + &quot;&lt;br style=\&quot;display: none\&quot;/&gt;&quot;
     else
-      str.map do |line|
-        if line =~ /^(\s+)(\S.*?):(\d+)(?::in\s*`(.*?)')?/
-          indent, file, line, method = $1, $2, $3, $4
-          url, display_name = '', 'untitled document';
-          unless file == &quot;-&quot;
-            indent += &quot; &quot; if file.sub!(/^\[/, &quot;&quot;)
-            url = '&amp;amp;url=file://' + e_url(file)
-            display_name = File.basename(file)
-          end
-          if method =~ /^test_([a-zA-Z]+)_(.*)/
-            line = 0
-            yaml_file, test_name = $1, $2
-            file_path = File.join(File.dirname(ENV['TM_FILEPATH']), &quot;#{yaml_file}.yml&quot;)
-            $file_contents[file_path] ||= File.read(file_path)
-            $file_contents[file_path].split(&quot;\n&quot;).each do |l|
-              line += 1
-              break if l =~ /^#{test_name}:/
+      if @command.test_script?
+        str.map do |line|
+          if line =~ %r{\(eval\).*in `(test_(\w+?)_(.*))'}
+            test_name = $1
+            group, method = $2, $3
+            begin
+              file  = File.join(@command.base_path, &quot;#{group}.yml&quot;)
+              lines = File.read(file).split(&quot;\n&quot;)
+              position  = lines.rindex { |l| l =~ %r{^#{method}:} } + 1
+              &quot;&lt;span&gt;&lt;a class='near' href=\&quot;txmt://open?url=file://#{e_url(file)}&amp;amp;line=#{position}\&quot;&gt;#{test_name}&lt;/a&gt;&lt;/span&gt;:#{position}&lt;br/&gt;&quot;
+            rescue =&gt; err
+              line
             end
-            line = line.to_s
-            url = '&amp;amp;url=file://' + e_url(file_path)
+          elsif line =~ /^\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors/
+            &quot;&lt;span style=\&quot;color: #{$1 + $2 == &quot;00&quot; ? &quot;green&quot; : &quot;red&quot;}\&quot;&gt;#{$&amp;}&lt;/span&gt;&lt;br/&gt;&quot;
+          elsif line =~ /Loaded suite/ &amp;&amp; @command.test_name
+            htmlize(line.chomp + &quot; --name #{@command.test_name}\n&quot;)
+          elsif line =~ /`yt_|\(eval\)/
+            nil
+          else
+            htmlize(line)
           end
-          &quot;#{indent}&lt;a class='near' href='txmt://open?line=#{line + url}'&gt;&quot; +
-          (method ? &quot;method #{CGI::escapeHTML method}&quot; : '&lt;em&gt;at top level&lt;/em&gt;') +
-          &quot;&lt;/a&gt; in &lt;strong&gt;#{CGI::escapeHTML display_name}&lt;/strong&gt; at line #{line}&lt;br/&gt;&quot;
-        elsif line =~ /(\[[^\]]+\]\([^)]+\))\s+\[([\w\_\/\.]+)\:(\d+)\]/
-          spec, file, line = $1, $2, $3, $4
-          &quot;&lt;span&gt;&lt;a style=\&quot;color: blue;\&quot; href=\&quot;txmt://open?url=file://#{e_url(file)}&amp;amp;line=#{line}\&quot;&gt;#{spec}&lt;/span&gt;:#{line}&lt;br/&gt;&quot;
-        elsif line =~ /([\w\_]+).*\[([\w\_\/\.]+)\:(\d+)\]/
-          method, file, line = $1, $2, $3
-          &quot;&lt;span&gt;&lt;a style=\&quot;color: blue;\&quot; href=\&quot;txmt://open?url=file://#{e_url(file)}&amp;amp;line=#{line}\&quot;&gt;#{method}&lt;/span&gt;:#{line}&lt;br/&gt;&quot;
-        elsif line =~ /^\d+ tests, \d+ assertions, (\d+) failures, (\d+) errors\b.*/
-          &quot;&lt;span style=\&quot;color: #{$1 + $2 == &quot;00&quot; ? &quot;green&quot; : &quot;red&quot;}\&quot;&gt;#{$&amp;}&lt;/span&gt;&lt;br/&gt;&quot;
-        else
-          htmlize(line)
-        end
-      end.join
+        end.compact.join
+      else
+        htmlize(str)
+      end
     end
   end
 end
-$file_contents = {}
-$file_contents[ENV['TM_FILEPATH']] = STDIN.read
-script = TrivialScript.new($file_content)
-RubyMate.new(script).emit_html
\ No newline at end of file
+
+script = RubyScript.new(STDIN.read)
+RubyMate.new(script).emit_html</diff>
      <filename>vendor/TextMate/Zena.tmbundle/Support/RubyMate/run_script.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@
 &lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
 &lt;plist version=&quot;1.0&quot;&gt;
 &lt;dict&gt;
+	&lt;key&gt;deleted&lt;/key&gt;
+	&lt;array/&gt;
 	&lt;key&gt;name&lt;/key&gt;
 	&lt;string&gt;Zena&lt;/string&gt;
 	&lt;key&gt;ordering&lt;/key&gt;</diff>
      <filename>vendor/TextMate/Zena.tmbundle/info.plist</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8b5ab6263a59beadf96092e06823c1e37e64f82b</id>
    </parent>
  </parents>
  <author>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </author>
  <url>http://github.com/zena/zena/commit/2c5354237f33d6948ec2c326145c55a79d1c9172</url>
  <id>2c5354237f33d6948ec2c326145c55a79d1c9172</id>
  <committed-date>2009-11-10T01:12:18-08:00</committed-date>
  <authored-date>2009-11-10T01:12:18-08:00</authored-date>
  <message>Added 'run focused yaml test' to Zena bundle for TextMate.</message>
  <tree>b171c0c9f92e8648a959c3fab8f82c1b217f1d8b</tree>
  <committer>
    <name>Gaspard Bucher</name>
    <email>gaspard@teti.ch</email>
  </committer>
</commit>
