EzDevInfo.com

Rebar

Rebar makes responsive development more efficient and keeps CSS organised. Rebar Grid Framework rebar is a sass / stylus grid framework and makes responsive development more efficient and keep css organised.

Is there a way to tell rebar not to run eunit tests for the dependencies?

When running:

./rebar eunit

the tests are run also for the external dependencies. Is there a way to change this behaviour? Maybe through the rebar.config file?


Source: (StackOverflow)

Easy way of loading project's Rebar dependencies in Erlang shell

I've got a project that uses Rebar as build tool. When developing, I would like all my app dependencies that are specified in Rebar.config be compiled & loaded in the shell as easy as possible. I'm using the Erlang shell in Emacs. What's a quick way to do this?


Source: (StackOverflow)

Advertisements

How to handle deps while using rebar to release?

I'm using rebar generate to handle release, but when I start the application, the deps I use will not be found.`

I can start the application manually using erl -pa ./ebin ./deps/*/ebin -s myapp.

I'm wonder how to config rebar.config and reltool.config to handle dependencies? Thanks.


Source: (StackOverflow)

Yaws as Rebar dependency

How can I install Yaws as a Rebar dependency in my Erlang application?

Thanks,

LRP


Source: (StackOverflow)

start erlang application from command line

I have an erlang application, compiled with rebar.

Normally I start it with like this:

application:start(myapp).

from inside the erl shell.

Could anyone tell me how to start it like a normal command line program?


Source: (StackOverflow)

rebar: Missing application directory

I'm testing rebar on

  • Windows 8 64Bis
  • Erlang 64bits R15B02

I've compiled rebar from github code and created a basic app

$ mkdir testapp; cd testapp
$ mkdir rel
$ rebar create-app appid=testapp
$ echo "{sub_dirs, ["rel"]}." > rebar.config
$ cd rel
$ rebar create-node nodeid=testnode
$ cd -
$ rebar compile
$ rebar generate    
ERROR: generate failed while processing testapp/rel: {'EXIT',{{badmatch,{error,"testapp: : Missing application directory."}
...

I'm reading the reltool documentation but i cant found anything about application dir the only relevant option is incl_cond but is defined by default by rebar command

src/testapp.app.src

{application, testapp,
 [
  {description, ""},
  {vsn, "1"},
  {registered, []},
  {applications, [
                  kernel,
                  stdlib
                 ]},
  {mod, { testapp_app, []}},
  {env, []}
 ]}.

rel/reltool.config

{sys, [
       {lib_dirs, []},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "testapp", "1",
        [
         kernel,
         stdlib,
         sasl,
         testapp
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "testapp"},
       {profile, embedded},
       {incl_cond, derived},
       {mod_cond, derived},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
                           "^erts.*/(doc|info|include|lib|man|src)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, testapp, [{mod_cond, app}, {incl_cond, include}]}
      ]}.

{target_dir, "testapp"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/testapp", "bin/testapp"},
           {copy, "files/testapp.cmd", "bin/testapp.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.

Source: (StackOverflow)

What is the standard build tool in Erlang?

I am very new to Erlang programming language. Is there a standard build tool in Erlang?

I have googled out these, not sure which one I should use.


Source: (StackOverflow)

How to get rebar to run 'make' for a dependency?

One of my dependencies doesn't use rebar -- it uses a Makefile. How do I get rebar to run this Makefile, rather than attempting to compile the source itself?

Note that I'd like to continue using rebar for everything else.


Source: (StackOverflow)

Where should you put application properties in a rebar erlang application?

A newbie question: I wrote my first rebar based erlang application. I want to configure some basic properites like server host etc. Where is the best place to put them and how should I load them into the app?


Source: (StackOverflow)

Erlang detach shell from node / Quit shell without killing node

I feel like I'm missing something stupid obvious, but I've looked all over and can't find the answer to my question.

Suppose I have an application release that I've built with rebar and I start it a la

rel/my_app/bin/my_app start

I let it happily go about its business for a while, and then I want to attach a console to check on things, so I do

rel/my_app/bin/my_app attach

and get a shell. I muck around, and then when I'm done I want to quit the shell but leave the application running. If I do ^G q or q()., it brings down the entire application.

I've also played with starting the app with +Bi to stop it from allowing someone to accidentally close it, but then how does one even exit an attached shell at all?


Source: (StackOverflow)

Rebar: compiling only project files (without dependencies)

I'm new to Erlang and Rebar and just created my first rebar project.

My development cycle looks like that:

  1. Edit project files
  2. Invoke rebar compile to recompile project
  3. Run my start.bat file to run and test my application
  4. Go to step 1 :-)

The problem is that rebar compile seem to always compile both project files and all the dependencies. And I already have quite a bit of dependencies so compilation takes quite long and slows me down.

So the question is: is there a way to tell rebar to compile only my project files during rebar compile (but still have dependencies visible for my compiled files)? My dependencies never change so why do I need to recompile them every time?

Or maybe my whole process is utterly wrong and I should take different approach to my development cycle?


Source: (StackOverflow)

How set Erlang node name, when run an Erlang application by basho rebar from command line

I have compiled my Erlang application by using basho rebar which makes an stand-alone escript executable file. I run it from command line like: ./myapp myconfig.config

My questio is that how can I determine the Erlang node name that run my application. When in my application I run 'node()' command, it returns by default "nonode@nohost" but I want to give my name to that node (e.g. mynode@domain.com), so when I run 'node()' in my application, I like to see 'mynode@domain.com' instead of 'nonode@nohost'

I know about "erlang -name 'mynode@domain.com'" but please consider I run the application from command line. I think an Erlang VM is run and terminate during the application life-time automatically.


Source: (StackOverflow)

Erlang EUnit test module that depends on a library application

I have a medium-sized release with a handful of applications. I recently refactored some common functionality out into a library application within the release. This made my EUnit tests fail with undef messages whenever testing anything that required the library application.

The set up is something like this:

% In apps/utils/src/utils.erl
-module(utils).

-export([foo/0]).

foo() -> "OH HAI".

Then

% In apps/some_app/src/some_app.erl
-module(some_app).

-export([bar/0]).

bar() -> io:format("foo: ~s~n", [utils:foo()]).

% unit tests for bar()

Then the unit tests for some_app:bar() fail. I'm running them with rebar eunit skip_deps=true. I'm using skip_deps=true because my release uses some 3rd party applications (SQL, etc).

I assume that the tests start failing because EUnit is invoking the app under test without its dependencies? Is there any way to fix this? I have configured the .app file to explicitly declare the dependency. It works fine in the release, and it's been deployed for about a day now with no problem, but I'll feel a lot better if I can get the tests to pass again :)

(I could use a mocking app to stub out utils:foo/0, and I can see where that would be ideal idiomatically, but that seems like overkill in this case because utils:foo/0 (read: it's real-world counterpart) does some really simple stuff.)


Source: (StackOverflow)

Handling external libs with rebar

I want to use some libs in my application, like https://github.com/Panmind/erlang-ruby-marshal. That repo holds an src dir, but has no .app file (because it's not an application), so I can't use get-deps.

I tried another approach, adding a libs dir in sub_dirs and added the repo as a git submodule, but rebar won't compile any of its files. I guess that rebar only compiles otp applications, but not just .erl files that aren't tied to an application.

How do you manage those kind of dependencies? I would like to avoid copying the files to my app dir, because I don't think they belong there, and I kind of like the git submodule approach, that allows me to keep track of the lib version I am using.


Source: (StackOverflow)

Meaning of elements in Rebar deps configuration

We're using rebar to pull dependencies for our project, many of them from github. Our config looks something like:

{deps, [
        {cowboy, "", {git, "git://github.com/extend/cowboy.git", {branch, "master"}}}
       ]}.

I understand enough to get by, and I've learned a couple things by trial and error (for example, how to specify tags and changesets rather than branches), but my google-fu is unable to find any sort of comprehensive documentation on what options are available or what they do.

I'm specifically wondering about the purpose of the second value is (often empty string, but I occasionally see version numbers and wildcards in it), but more info about source control options, or just documentation in general would be helpful.


Source: (StackOverflow)