public
Description: A mirror of the TextMate repository munged to windows-legal filenames (imported from Google Code)
Clone URL: git://github.com/gtcaz/tmbundles4win.git
Sync at Thu Jul 24 15:36:20 +0000 2008
Geoff Cheshire (author)
Thu Jul 24 08:36:20 -0700 2008
commit  f62577ae4e8203e74389e7ce96d9b47d84c5885b
tree    37f93c258818dc5a22f23a11901157e7938a4814
parent  f5bfaa565e9670bfcb8029edbba85947afc3461f
...
3
4
5
6
 
7
8
9
...
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
50
51
52
...
3
4
5
 
6
7
8
9
...
11
12
13
 
 
 
14
15
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
18
19
20
0
@@ -3,7 +3,7 @@
0
 <plist version="1.0">
0
 <dict>
0
   <key>beforeRunningCommand</key>
0
- <string>saveActiveFile</string>
0
+ <string>nop</string>
0
   <key>captureFormatString</key>
0
   <string>$0</string>
0
   <key>capturePattern</key>
0
@@ -11,42 +11,10 @@
0
   <key>command</key>
0
   <string>#!/bin/sh
0
 
0
-# Assumes the current file is a unittest file
0
-# Runs with the currently-focused method as the test name
0
-
0
 export RUBYLIB="$TM_BUNDLE_SUPPORT/RubyMate${RUBYLIB:+:$RUBYLIB}"
0
 export TM_RUBY=$(type -p "${TM_RUBY:-ruby}")
0
 
0
-args=$(${TM_RUBY} &lt;&lt;"EOF"
0
-
0
-n = ENV['TM_LINE_NUMBER'].to_i
0
-
0
-spec, context, name = nil, nil, nil
0
-
0
-File.open(ENV['TM_FILEPATH']) do |f|
0
-# test/unit
0
-lines = f.read.split("\n")[0...n].reverse
0
-name = lines.find { |line| line =~ /^\s*def test[_a-z0-9]*[\?!]?/i }.to_s.sub(/^\s*def (.*?)\s*$/) { $1 }
0
-# test/spec.
0
-spec = $3 || $4 if lines.find { |line| line =~ /^\s*(specify|it)\s+('(.*)'|"(.*)")+\s*(\{|do)/ }
0
-context = $3 || $4 if lines.find { |line| line =~ /^\s*(context|describe)\s+('(.*)'|"(.*)")+\s*(\{|do)/ }
0
-end
0
-
0
-# puts [name, spec, context].inspect
0
-
0
-if name and !name.empty?
0
-print "--name=#{name}"
0
-elsif spec and !spec.empty? and context and !context.empty?
0
-print "--name=\"/test_spec \\{.*#{context}\\} \\d{3} \\[#{spec}\\]/\""
0
-end
0
-EOF)
0
-
0
-if [[ -z "$args" ]]; then
0
-echo -n "This doesn't appear to be a TestCase or spec."
0
-exit 205
0
-fi
0
-
0
-"${TM_RUBY}" -- "$TM_BUNDLE_SUPPORT/RubyMate/run_script.rb" $args
0
+"${TM_RUBY}" -- "$TM_BUNDLE_SUPPORT/RubyMate/run_script.rb" --name=
0
 </string>
0
   <key>fileCaptureRegister</key>
0
   <string>1</string>
...
5
6
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
9
10
...
28
29
30
31
 
 
32
33
34
...
65
66
67
68
 
69
70
71
...
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
...
54
55
56
 
57
58
59
60
61
...
92
93
94
 
95
96
97
98
0
@@ -5,6 +5,32 @@ require 'pathname'
0
 
0
 TextMate.save_current_document
0
 
0
+# For Run focused unit test, find the name of the test the user wishes to run.
0
+args = [ ]
0
+if ARGV.first == "--name="
0
+ n = ENV['TM_LINE_NUMBER'].to_i
0
+
0
+ spec, context, name = nil, nil, nil
0
+
0
+ File.open(ENV['TM_FILEPATH']) do |f|
0
+ # test/unit
0
+ lines = f.read.split("\n")[0...n].reverse
0
+ name = lines.find { |line| line =~ /^\s*def test[_a-z0-9]*[\?!]?/i }.to_s.sub(/^\s*def (.*?)\s*$/) { $1 }
0
+ # test/spec.
0
+ spec = $3 || $4 if lines.find { |line| line =~ /^\s*(specify|it)\s+('(.*)'|"(.*)")+\s*(\{|do)/ }
0
+ context = $3 || $4 if lines.find { |line| line =~ /^\s*(context|describe)\s+('(.*)'|"(.*)")+\s*(\{|do)/ }
0
+ end
0
+
0
+ if name and !name.empty?
0
+ args << "--name=#{name}"
0
+ elsif spec and !spec.empty? and context and !context.empty?
0
+ args << %Q{--name="/test_spec \\{.*#{context}\\} \\d{3} \\[#{spec}\\]/"}
0
+ else
0
+ puts "Error: This doesn't appear to be a TestCase or spec."
0
+ exit
0
+ end
0
+end
0
+
0
 is_test_script = ENV["TM_FILEPATH"] =~ /(?:\b|_)(?:tc|ts|test)(?:\b|_)/ or
0
   File.read(ENV["TM_FILEPATH"]) =~ /\brequire\b.+(?:test\/unit|test_helper)/
0
 
0
@@ -28,7 +54,8 @@ end
0
 cmd << ENV["TM_FILEPATH"]
0
 
0
 TextMate::Executor.run( cmd, :version_args => ["--version"],
0
- :script_args => ARGV ) do |str, type|
0
+ :script_args => args ) do |str, type|
0
+ str.gsub!(ENV["TM_FILEPATH"], "untitled") if ENV["TM_FILE_IS_UNTITLED"]
0
   case type
0
   when :out
0
     if is_test_script and str =~ /\A[.EF]+\Z/
0
@@ -65,7 +92,7 @@ TextMate::Executor.run( cmd, :version_args => ["--version"],
0
       out.join()
0
     else
0
       htmlize(str)
0
- end
0
+ end
0
   when :err
0
     "<span style=\"color: red\">#{htmlize str}</span>"
0
   end

Comments

    No one has commented yet.