Permalink
Browse files

Added Run command. Now runs compiled Rust files. Also added keyboard …

…shortcuts for commands. See README for more info.
  • Loading branch information...
1 parent 2a567aa commit b2a6187d94bc24b35ed86e755aae574a4aab1967 Tom Ellis committed Jan 27, 2012
@@ -10,6 +10,8 @@
</string>
<key>input</key>
<string>document</string>
+ <key>keyEquivalent</key>
+ <string>@A</string>
<key>name</key>
<string>Compile with tests</string>
<key>output</key>
@@ -6,10 +6,11 @@
<string>saveActiveFile</string>
<key>command</key>
<string>
-/usr/local/bin/rustc $TM_FILEPATH
-</string>
+/usr/local/bin/rustc $TM_FILEPATH</string>
<key>input</key>
<string>document</string>
+ <key>keyEquivalent</key>
+ <string>@C</string>
<key>name</key>
<string>Compile</string>
<key>output</key>
@@ -3,15 +3,42 @@
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
- <string>nop</string>
+ <string>saveActiveFile</string>
<key>command</key>
- <string>#TODO</string>
+ <string>#!/usr/bin/env ruby
+
+filepath = ENV["TM_FILEPATH"];
+
+file = File.basename(filepath, ".rs");
+
+path = File.dirname(filepath);
+
+fullpath = path + "/" + file;
+
+result = '';
+
+if( !File.exist?( fullpath ) )
+ puts "Compiled Rust file doesn't exist, compiling… &lt;br /&gt;\n";
+ result = system("/usr/local/bin/rustc " + filepath);
+ puts "&lt;br /&gt;&lt;br /&gt;";
+
+end
+
+if( File.exist?( fullpath ) )
+ system(fullpath);
+else
+ puts "&lt;br /&gt;Compiled Rust file doesn't exist";
+end</string>
<key>input</key>
- <string>selection</string>
+ <string>document</string>
+ <key>keyEquivalent</key>
+ <string>@r</string>
<key>name</key>
<string>Run</string>
<key>output</key>
- <string>replaceSelectedText</string>
+ <string>showAsHTML</string>
+ <key>scope</key>
+ <string>source.rs</string>
<key>uuid</key>
<string>C6D4863F-A61B-4284-A5D4-C72F8555CC40</string>
</dict>

0 comments on commit b2a6187

Please sign in to comment.