Richard Jonas's

Blog

Rebar on Windows

Leave a Comment
In this short post I will show you how to set up rebar on Windows.

What we need is an Erlang installation which can be downloaded from erlang.org. Then we need to install Git from git-scm.com. During the installation I choose command shell integration in order that it will be placed in the PATH.

The last step is to download rebar from https://github.com/rebar/rebar/wiki/rebar in the current project directory. It should be renamed as rebar.sh since it is a shell script. How can this script be executed if it is a shell script? To execute it on Windows we need to create a rebar.cmd file which invoke the escript interpreter with the rebar shell script.

@echo off
escript.exe rebar.sh %*

We are ready, we can type rebar.cmd to see

D:\Work\ranch-build>rebar.cmd
No command to run specified!
Usage: rebar [-h] [-c] [-v <verbose>] [-V] [-f] [-D <defines>] [-j <jobs>] [-C <config>] [-p] [var=value,...] <command,...>

  -h, --help            Show the program options
  -c, --commands        Show available commands
...

Let us create rebar.config file to see who git dependencies can be resolved.

{deps, [
   {ranch, ".*",
      {git, "git://github.com/extend/ranch", "0.8.5"}}
]}.

Let us run rebar.cmd get-deps

D:\Work\ranch-build>rebar.cmd get-deps
==> Entering directory `d:/Work/ranch-build'
==> ranch-build (get-deps)
Pulling ranch from {git,"git://github.com/extend/ranch","0.8.5"}
Cloning into 'ranch'...
Checking connectivity... done
==> Entering directory `d:/Work/ranch-build/deps/ranch'
==> ranch (get-deps)
==> Leaving directory `d:/Work/ranch-build/deps/ranch'
==> Leaving directory `d:/Work/ranch-build'

Now we are ready to compile the source and go on with the work.
Next PostNewer Post Home

0 comments:

Post a Comment