A journey to find those pieces of software or technology that facilitate productive and maintainable software development

Monday, April 7, 2008

TextMate: Erlang Build Dialog

Goals for Erlang Builder:
  • Compile all Erlang sources in same dir as saved file
  • Show HTML output of errors and warnings if any is provided
  • Link HTML output to lines in Erlang source files
  • Generate BEAM files in $TM_PROJECT_DIRECTORY/ebin
  1. Set ERLANG_HOME in Preferences>Advanced>Shell Variables
  2. Get/Update the Erlang bundle:
    mkdir -p ~/Library/Application\ Support/TextMate/Bundles
    cd ~/Library/Application\ Support/TextMate/Bundles/
    svn co http://macromates.com/svn/Bundles/trunk/Bundles/Erlang.tmbundle
    osascript -e 'tell app "TextMate" to reload bundles'
  3. Grab Warning/Error icons for the Erlang bundle from the ADC Reference Library:
    cd ~/Library/Application\ Support/TextMate/Bundles/Erlang.tmbundle/
    mkdir Resources
    cd Resources
    srcdir="/Developer/Documentation/DocSets"
    srcdir="$srcdir/com.apple.ADC_Reference_Library.DeveloperTools.docset"
    srcdir="$srcdir/Contents/Resources/Documents/documentation"
    srcdir="$srcdir/DeveloperTools/Conceptual/iSyncPluginMakerUserGuide/art"
    for icon in tr_warn_error.jpg tr_warn_alert.jpg
        do cp $srcdir/$icon .
    done
  4. Create a Command called Compile in the Erlang bundle
    1. Set Save to 'Current File'
    2. Paste the following Ruby script into Command(s):
    3. Set Input to 'None'
    4. Set Output to 'Discard'
    5. Set Activation to 'Key Equivalent' and type Command-S in the key-binding field
    6. Set Scope to 'source.erlang'
  5. Save an Erlang source file with a deliberate error and see the output
  6. Post your feedback as a comment
You now have an immediate indication of errors each time you save. If no compile errors or warnings are present no output will be shown. If you have commit access to the TextMate Bundle Repository, please commit this change.

4 comments:

Ruben said...

Starting to play around with Erlang ( Hello World on Steroids ) and new to TextMate I certainly appreciate your posts on Erlang development in TextMate. Keep up the good work!

Unknown said...

Thank you very much for your kind remarks Ruben. I am glad that my posts have been interesting and useful for you.

chrisfarms said...

This is certainly a major missing cmd from the bundle - thanks!

for anyone else who is having trouble viewing the contents of the iframe.... I found the script in google's cache

Djui said...

I cannot get the ruby script, neither on this site nor in the google's cache :-(

SyntaxHighlighter