| %% -*- mode: erlang -*- |
| %% |
| %% This doesn't change CONFIG. If couch isn't accessible to the code server, |
| %% it adds paths from couch-config. This is equivalent to: |
| %% |
| %% ERL_LIBS=$(couch-config --erl-libs-dir):$ERL_LIBS rebar compile |
| %% |
| case code:which(couch) of |
| non_existing -> |
| try |
| Cfg = os:cmd("couch-config --erl-libs-dir"), |
| [LibDir] = string:tokens(Cfg, "\n"), |
| true = filelib:is_dir(LibDir), |
| code:add_pathsa( |
| filelib:wildcard(filename:join([LibDir, "*", "ebin"]))), |
| false = (code:which(couch) =:= non_existing) |
| catch _Err:_What -> |
| io:format( |
| "CONFIG ERROR:\n" |
| "Failed to run couch-config --erl-libs-dir\n" |
| "Ensure that couch-config is on the PATH, or set ERL_LIBS " |
| "appropriately\n\n") |
| end; |
| _ -> |
| ok |
| end, |
| CONFIG. |