You can send questions to erlware-questions@googlegroups.com, there's
also an #erlware IRC channel on irc.freenode.net.
Sinan is our flagship 100% erlang build system. OTP Base is a make based build system. We encourage most people to use Sinan. There are those that need make, or simply like make, OTP Base is for them.
There are other differences as well. OTP Base does not do any fetching of apps, dependency checking, or the like. It relies on the applications found on the system, in the faxien repo most significantly to find all its dependencies. There are a few other differences but in general OTP Base is less full featured than Sinan though it does have its own flair. OTP Base is still quite easy to use, it generates applications and releases for you, it handles all fundamental aspects of building OTP software. I personally use Sinan for most of my projects but I use OTP Base for about 1/4th of them. They are two different takes on the same thing - OTP compliant Erlang build systems.
erl or erlc command to run; how I install an erlang shell and compiler?Erlware is designed around making erlang releases. Releases are full fledged software stacks that are designed to run on their own in much the same way that Apache or Sendmail run. While this is the best way to write software in erlang, it can be very useful to pull up an erlang shell for experimentation and learning.
To install the scripts to launch the erlang shell or run erlc, run the following command:
faxien install-release erl
You should now be able to run erl to start the erlang shell and erlc
to run the compiler.
Additionally, sinan has a sinan shell command, which will also setup
the path for the applications in your current project.
Faxien separates packages based on the erts vsn that they are compiled for. If you want to target a different erts vsn you can tell Faxien this by running:
faxien set-target-erts-vsn <erts-vsn>
this will tell Faxien to seek to pull packages compiled for the target version and all lower compatible versions. For example setting the target erts vsn to 5.5.3 would tell Faxien to pull for 5.5.3, 5.5.2, 5.5.1, and 5.0 preferring of course the exact verison you specified.
The easiest way to do this is to create a build directory which
contains a stock _build.cfg and symlinks to the applications you
wish to co-develop.
For instance, I might be working on crary_dav, and at the same time by adding features to expat to immediately be consumed by crary_dav. By creating the build directory with symlinks to the co-developed applications, I can be improving expat and immediately take advantage of the new features and/or bug fixes without having to push out a new version of expat for each and every one. Once things stabilize, i can then work on cleaning up both sets of patches, send them out for review, and release new versions of these applications
Sinan gives you easy access to eunit. While you should ultimately read the eunit documentation, minimally you can add the following line to each erlang source file you wish to test:
-include("eunit.hrl").
Next add functions with _test suffixes:
my_add_test() ->
?assertMatch(5, my_add(2, 3)),
?assertMatch(1, my_add(3, -2)).
Finally, to run the tests:
$ sinan test
You should see something like the following if your tests pass:
Running tests for my_math.
All 1 tests successful.
And the following if your tests don't pass:
Running tests for my_math.
my_math:my_add...*failed*
::{error,{assertMatch_failed,[{module,my_add},
{line,8},
{expression,"my_add ( 2, 3 )"},
{expected,"5"},
{value,"6"}]},
[{my_math,'-my_add_test/0-fun-0-',0},
{eunit_test,'-function_wrapper/2-fun-0-',2}]}
=======================================================
Failed: 1. Aborted: 0. Skipped: 0. Succeeded: 9.
Note that the output that you see above is reported separately for each source file, so if you have multiple source file be sure you check that each one prints success, not just the final one.
Static files can be placed in a priv directory, which will sinan
will copy automatically into a priv directory in the built
application. The suggested way to locate the path to these files is
to use the following idiom:
FilePath = code:priv_dir(my_application_name) ++ "/my-file.txt".
Note that code:priv_dir/1 will only work after your application has been started. If you're running under an erlware release this should be done automatically for you. This may not be done automatically in the context of eunit, or in an erlang shell. You can start your application by doing the following:
application:start(my_application_name).
Sinan redirects its output to its log file in
_build/development/log/build.log, although at the moment even that
appears to be broken. You'd be better off using the
error_logger to display
output during unit tests as well as during the run time of your application.
Example:
error_logger:info_msg("val = ~p~n", [Val]).