added install command, also now saves class/ref opening settings when SC closes

This commit is contained in:
Rob Watson 2009-01-17 15:07:08 +00:00
parent 067f4cb869
commit 0add10c6a4
4 changed files with 74 additions and 2 deletions

View File

@ -0,0 +1,52 @@
<?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>nop</string>
<key>command</key>
<string>#!/usr/bin/env ruby
def could_not_locate
puts "&lt;span style='color:red'&gt;There was a problem&lt;/span&gt;&lt;br/&gt;"
puts "Probably, you do not have SuperCollider installed, or you are using a non-standard user support directory.&lt;br/&gt;&lt;br/&gt;"
puts "You will need to manually copy &lt;code&gt;supercollider-tmbundle/Support/classes/TextMate.sc&lt;/code&gt; into your SC class path"
end
puts "=======================================&lt;br/&gt;"
puts "Textmate SuperCollider bundle&lt;br/&gt;"
puts "by &lt;a href='http://rfwatson.github.com'&gt;R.Watson&lt;/a&gt;.&lt;br/&gt;"
puts "=======================================&lt;br/&gt;&lt;br/&gt;"
if File.exists?(File.expand_path("~/Library/Application Support/SuperCollider/Extensions/TextMate.sc"))
puts "&lt;span style='color:green'&gt;SuperCollider bundle already installed&lt;/span&gt;.&lt;br/&gt;"
else
if not File.directory?(File.expand_path("~/Library/Application Support/SuperCollider/Extensions"))
could_not_locate
else
if system %Q{ln -s '#{ENV['TM_BUNDLE_SUPPORT']}/classes/TextMate.sc' '#{File.expand_path("~/Library/Application Support/SuperCollider/Extensions/TextMate.sc")}'}
puts "&lt;span style='color:green'&gt;Successfully installed TextMate class&lt;/span&gt;.&lt;br/&gt;&lt;br/&gt;"
puts "Relaunch SuperCollider to complete installation."
else
puts "There was an error installing the class file.&lt;br/&gt;&lt;br/&gt;"
could_not_locate
end
end
end
</string>
<key>fallbackInput</key>
<string>document</string>
<key>input</key>
<string>selection</string>
<key>keyEquivalent</key>
<string>$@</string>
<key>name</key>
<string>Install</string>
<key>output</key>
<string>showAsHTML</string>
<key>scope</key>
<string>source.supercollider</string>
<key>uuid</key>
<string>BB37ACE9-8262-4AF6-B3C6-43DC0AF2B370</string>
</dict>
</plist>

View File

@ -1,8 +1,17 @@
TextMate {
classvar menu, <openClassInTextMate, <openReferencesInTextMate;
*saveState {
(
classfiles: openClassInTextMate.state,
references: openReferencesInTextMate.state
).writeArchive("%/.textmate-settings".format(Platform.userAppSupportDir));
}
*initClass {
var opt;
var settings = Object.readArchive("%/.textmate-settings".format(Platform.userAppSupportDir));
try {
menu = CocoaMenuItem(nil, 7, "TextMate", true);
@ -17,13 +26,24 @@ TextMate {
openClassInTextMate = CocoaMenuItem(menu, 1, "Open class files in TextMate", false) { |item|
item.state = item.state.not;
this.saveState;
};
openClassInTextMate.state = true;
openClassInTextMate.state = settings.classfiles;
openReferencesInTextMate = CocoaMenuItem(menu, 2, "Open references in TextMate", false) { |item|
item.state = item.state.not;
this.saveState;
};
openReferencesInTextMate.state = settings.references;
CocoaMenuItem(menu, 3, "About SuperCollider bundle", false) { |item|
Document.new.string = "TextMate-SuperCollider bundle
by R.Watson
For documentation and source code,
http://rfwatson.github.com"
};
openReferencesInTextMate.state = true;
} {
"TextMate found a problem installing CocoaMenuItems - you may be running SC 3.2 or older, or booting from command-line.".warn
}