Is there plugin path customizations available for rebar3? - erlang

I am looking to add my custom projects as plugins in rebar3.config. is it possible to fetch plugins locally or does it have to be from hex.pm?

Can be also used path from GitHub:
{plugins, [
{your_plugin,
{git, "https://github.com/path-to/your_plagin.git",
{branch, "your-branch"}}
}
]}.

Related

How to override "ignore" part of bower.json file of dependency?

I would like to use https://github.com/MrRio/jsPDF in my ember project.
I wanted to import jsPDF as dependency, therefore I started this way:
bower install git#github.com:MrRio/jsPDF.git --save
Unfortunately, I cannot install files from plugins directory, because "plugins/*" directory is ignored in bower.json file.
I have tried overriding it this way, but without success.
"overrides": {
"jspdf": {
"ignore": [
"**/.*",
"libs",
"CNAME",
"jspdf.js",
"examples/jspdf.PLUGINTEMPLATE.js",
"todo.txt",
"wscript.py",
"build.sh",
"test",
"tools"
]
}
}
Could you please help me?
I just added a jsPDF plugins package to bower.
You can add all the plugins via
bower install jsPDF-plugins --save

How to install erlydtl to make it usable in nitrogen?

I found, that erlydtl may be used with nitrogen.
Unfortunately, author hasn't described how he installed erlydtl to make it usable
from nitrogen.
Probably somebody has ever faced with the same issue, I'm facing with. If so,
please share your experience.
Thank you in advance.
You should be able to just add ErlyDTL to your app's rebar.config:
{erlydtl, ".*", {git, "git://github.com/erlydtl/erlydtl", {branch, master}}}
Then run ./rebar get-deps compile to install it in lib/ directory of your app and recompile.
Here's the step-by-step instructions
Create a new folder to hold Nitrogen repo:
$ mkdir nitrogen-dtl
$ cd nitrodgen-dtl
Clone Nitrogen from GitHub:
git clone https://github.com/nitrogen/nitrogen.git
cd nitrogen
Build a slim (1) or a full (2) release called "dtltest" locateed in nitrogen-dtl folder:
make slim_inets PROJECT=dtltest (1)
make rel_inets PROJECT=dtltest (2)
Edit rebar.config in dtltest folder:
cd ../dtltest
vi rebar.config
add the ErlyDTL as a dependency (and a comma to the line before it):
{simple_bridge, ".*", {git, "git://github.com/nitrogen/simple_bridge",{branch, master}}},
{nprocreg, ".*", {git, "git://github.com/nitrogen/nprocreg", {branch, master}}},
{nitrogen_core, ".*", {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}},
{sync, ".*", {git, "git://github.com/rustyio/sync", {branch, master}}},
{erlydtl, ".*", {git, "git://github.com/erlydtl/erlydtl", {branch, master}}}
Download and compile dependencies with rebar:
./rebar get-deps compile
Start Nitrogen console, verify that application is running and try compiling an ErlyDTL template:
(dtltest#127.0.0.1)1> erlydtl:compile_template("<html>{{ greeting }}</html>", dtltest_template).
(dtltest#127.0.0.1)2> dtltest_template:render([{greeting, "Hallo Welt!"}]).
You should get a rendered template:
{ok,[<<"<html>">>,"Hallo Welt!",<<"</html>">>]}
If the template compiles, then ErlyDTL is installed correctly and you can use the code similar to the Gist you referenced in your application.
Cheers!
In n2o you don't need to do anything. DTL is already included.
All you need is using #dtl element:
main() ->
#dtl{file = "index",
app = review,
bindings = [{body,"Hello"},{title,"Index"}]}.
Also n2o can be run natively on 17.0

Which paths does Bower ignore by default?

bower.json can specify which files should be ignored:
ignore [array]: An array of paths not needed in production that you want Bower to ignore when installing your package.
Which paths are ignored by default?
From the source:
json.ignore = mout.array.combine(json.ignore || [], [
'**/.*',
'node_modules',
'bower_components',
config.directory,
'test',
'tests'
]);
Apparently all dotfiles are ignored, as are the bower_components, node_modules, test, and tests directories. I don't know what config.directory is.
Update: I just published a package, and the test directory was not ignored. Apparently I've misunderstood the source code. I'd love clarification from a Bower contributor.
Files which are listed in ignore property will not be installed by bower.
So, if you have a this kind of structure:
style.css
index.html
bower.json
script.js
and a bower.json file:
{
"ignore": [ "./script.js" ]
}
script.js will not be installed within this component.

Always got undef error of lager_transform when using lager log framework

I want to use lager as my log utility and I have orgnazied my proj as below:
proj\
|
|--lager\
| |--src\
| |--ebin\
| |--...
|
|--logserver\
| |--src\
| |--ebin\
| |--rebar.config
| |--...
|
|--rebar
|
However, when I try to compile logserver, I always got the following error:
D:\proj\logserver>..\rebar compile
==> logserver (compile)
src/logserver_app.erl:none: error in parse transform 'lager_transform': {undef,
[{lager_transform,
parse_transform,
[[{attribute,1,file,
{"src/logserver_app.erl",1}},
...
Can anyone know the reason? Thanks!
These is some additional information:
I am using Windows OS and using latest version of Erlang and rebar
and lager.
lager itself has already been compiled. We can find the D:\proj\logserver>dir ..\lager\ebin\lager_transform.beam (This will
succeed)
rebar's config file(D:\proj\logserver\rebar.config):
...
{erl_opts, [{parse_transform, lager_transform}, debug_info,{d,'TEST'}, {i, "include"}, {src_dirs, ["src"]}]}.
{lib_dirs, ["..\lager\ebin"]}.
...
If you already have lager in your deps then make sure that you move lager dependency first in rebar.config so that way it will compile first. Like so:
{deps,[
lager,
..
]}.
Did you add lager as a dependency in your rebar.config? I guess lager is not in the path.
From the rebar wiki:
To use lager in your application, you need to define it as a rebar dep
or have some other way of including it in erlang’s path. You can then
add the following option to the erlang compiler flags:
{parse_transform, lager_transform}
You can add 'lager' as a dependency by editing your rebar.config:
%% == Dependencies ==
%% Where to put any downloaded dependencies. Default is "deps"
{deps_dir, "deps"}.
%% What dependencies we have, dependencies can be of 3 forms, an application
%% name as an atom, eg. mochiweb, a name and a version (from the .app file), or
%% an application name, a version and the SCM details on how to fetch it (SCM
%% type, location and revision). Rebar currently supports git, hg, bzr and svn.
{deps, [application_name,
{application_name, "1.0.*"},
{application_name, "1.0.*",
{git, "git://github.com/basho/rebar.git", {branch, "master"}}}]}.
In your case, that should be something like:
{deps, [{lager, ".*", {git, "git://github.com/basho/lager.git", "HEAD"}}]}.
More info about the rebar dependency manager here:
https://github.com/basho/rebar/wiki/Dependency-management

Command 'generate' not understood or not applicable

I am trying to run rebar generate to generate a release for an erlang rebar project and getting the following error. Any ideas what I am doing wrong?
./rebar generate
Command 'generate' not understood or not applicable
I am on OSX with erlang version Erlang R14B03 and below is my rebar.conf
{lib_dirs, ["deps"]}.
{sub_dirs, ["rel"]}.
{deps, [
{folsom, ".*", {git, "git://github.com/boundary/folsom", "master"}}
]}.
{require_otp_vsn, "R14|R15"}.
{erl_opts, [
fail_on_warning,
debug_info,
warn_missing_spec
]}.
{clean_files, ["*.eunit", "ebin/*.beam", "rel/graphsom"]}.
{cover_enabled, true}.
{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
You are getting this error because rebar is unable to find a release. You should check if you have reltool.config somewhere and rebar knows about it.
If no release exists, you can create a new one:
mkdir rel
cd rel
../rebar create-node nodeid=YOUR_NODE_ID
Lastly, you need to tell rebar about the release. In your case, you already have the following added to rebar.config:
{sub_dirs, ["rel"]}.
This should allow the generate command to build a new release.

Resources