-
Notifications
You must be signed in to change notification settings - Fork 53
/
Validate and Save.tmCommand
48 lines (40 loc) · 1.23 KB
/
Validate and Save.tmCommand
1
2
3
4
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
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>saveActiveFile</string>
<key>command</key>
<string>#!/usr/bin/env ruby
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
compiler_ruby = `which rbx`.strip
if compiler_ruby.length == 0
compiler_ruby = ENV['TM_RUBY'] || `which ruby`.strip
end
result = `#{compiler_ruby} -wc "$TM_FILEPATH" 2>&1`
scopes = ENV['TM_SCOPE'].split
if scopes.include? 'source.ruby.rspec'
result.gsub!(/^.+warning: possibly useless use of == in void context$/, '')
end
if scopes.include? 'source.ruby.rspec.cucumber.steps'
result.gsub!(/^.+warning: ambiguous first argument; put parentheses or even spaces$/, '')
end
if result =~ /:(\d+):/
print result
TextMate.go_to :line => $1
end
</string>
<key>input</key>
<string>document</string>
<key>keyEquivalent</key>
<string>@s</string>
<key>name</key>
<string>Validate and Save</string>
<key>output</key>
<string>showAsTooltip</string>
<key>scope</key>
<string>source.ruby - text source.ruby</string>
<key>uuid</key>
<string>E0E058FC-0DC3-4872-A1C2-0B1A322A0CF5</string>
</dict>
</plist>