Skip to content

Instantly share code, notes, and snippets.

@dch
Created October 24, 2012 13:13
Show Gist options
  • Save dch/3945979 to your computer and use it in GitHub Desktop.
Save dch/3945979 to your computer and use it in GitHub Desktop.
build a stand-alone erlang rebar.cmd script with no dependencies

Pre-requisites

  • install MSYSGIT and add <gitdir>/bin/cmd to path
  • install Erlang/OTP minimum R15B02 (fixes escript swallowing stdout on exit, and adds line numbers to errors)
  • add Erlang/OTP to path

get fresh rebar

git clone git://github.com/basho/rebar.git
cd rebar
bootstrap

hack rebar.cmd

  • open an editor capable of editing binary / hex without fudging line endings like http://textpad.com/
  • remove the first line #!/usr/bin/env escript
  • replace with @echo off & setlocal & path=%~dp0;%path%; & escript.exe "%~dpn0.cmd" %* & goto :eof
  • save & you're done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment