diff --git a/.bashrc b/.bashrc index 91df2c0..ff1de33 100755 --- a/.bashrc +++ b/.bashrc @@ -15,6 +15,10 @@ if [ -d "${HOME}/tools/vim" ] ; then PATH=${HOME}/tools/vim:${PATH} fi +if [ -d "${HOME}/.bin" ] ; then + PATH=${HOME}/.bin:${PATH} +fi + # # Dircolors # diff --git a/.bin/rebar b/.bin/rebar new file mode 100755 index 0000000..1f8c245 Binary files /dev/null and b/.bin/rebar differ diff --git a/.bin/rebar.config b/.bin/rebar.config new file mode 100644 index 0000000..bf4ef4f --- /dev/null +++ b/.bin/rebar.config @@ -0,0 +1,25 @@ +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ts=4 sw=4 ft=erlang et + +%% escript_incl_extra is for internal rebar-private use only. +%% Do not use outside rebar. Config interface is not stable. +{escript_incl_extra, [{"priv/templates/*", "."}]}. +%% Types dict:dict() and digraph:digraph() have been introduced in Erlang 17. +%% At the same time, their counterparts dict() and digraph() are to be deprecated +%% in Erlang 18. namespaced_types option is used to select proper type name +%% depending of the OTP version used. +{erl_opts, [{platform_define, "^[0-9]+", namespaced_types}, warnings_as_errors]}. +{xref_checks, []}. +{xref_queries, + [{"(XC - UC) || (XU - X - B + - (\"escript\":\"foldl\"/\"3\") + - (\"eunit_test\":\"function_wrapper\"/\"2\") + - (\"abnfc\":\"file\"/\"2\") + - (\"erlydtl\":\"compile\"/\"3\") + - (\"lfe_comp\":\"file\"/\"2\") + - (\"neotoma\":\"file\"/\"2\") + - (\"protobuffs_compile\":\"scan_file\"/\"2\") + - (\"diameter_codegen\":\"from_dict\"/\"4\") + - (\"diameter_dict_util\":\"format_error\"/\"1\") + - (\"diameter_dict_util\":\"parse\"/\"2\"))", + []}]}. diff --git a/.bin/rebar.config.sample b/.bin/rebar.config.sample new file mode 100644 index 0000000..d154ac1 --- /dev/null +++ b/.bin/rebar.config.sample @@ -0,0 +1,245 @@ +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ts=4 sw=4 ft=erlang et +%% This is a sample rebar.conf file that shows examples of some of rebar's +%% options. + +%% == Core == + +%% Extend list of always recursive commands +{recursive_cmds, []}. + +%% Check required ERTS or OTP release version +{require_erts_vsn, ".*"}. +{require_otp_vsn, ".*"}. +{require_min_otp_vsn, ".*"}. + +%% Additional library directories to add to the code path +{lib_dirs, []}. + +%% == Erlang Compiler == + +%% Erlang files to compile before the rest. Rebar automatically compiles +%% parse_transforms and custom behaviours before anything other than the files +%% in this list. +{erl_first_files, ["src/mymib1.erl", "src/mymib2.erl"]}. + +%% Erlang compiler options +{erl_opts, [no_debug_info, + {i, "myinclude"}, + {src_dirs, ["src", "src2", "src3"]}, + {platform_define, + "(linux|solaris|freebsd|darwin)", 'HAVE_SENDFILE'}, + {platform_define, "(linux|freebsd)", 'BACKLOG', 128}, + {platform_define, "R13", 'old_inets'}]}. + +%% MIB Options? +{mib_opts, []}. + +%% SNMP mibs to compile first? +{mib_first_files, []}. + +%% leex options +{xrl_opts, []}. + +%% leex files to compile first +{xrl_first_files, []}. + +%% yecc options +{yrl_opts, []}. + +%% yecc files to compile first +{yrl_first_files, []}. + +%% == EDoc == + +%% EDoc options +{edoc_opts, []}. + +%% == Port Compiler == + +%% Port compilation environment variables. See rebar_port_compiler.erl for +%% more info. Default is `[]' +{port_env, [{"CFLAGS", "$CFLAGS -Ifoo"}, + {"freebsd", "LDFLAGS", "$LDFLAGS -lfoo"}]}. + +%% port_specs +%% List of filenames or wildcards to be compiled. May also contain a tuple +%% consisting of a regular expression to be applied against the system +%% architecture as a filter. +{port_specs, [{"priv/so_name.so", ["c_src/*.c"]}, + {"linux", "priv/hello_linux", ["c_src/hello_linux.c"]}, + {"linux", "priv/hello_linux", ["c_src/*.c"], [{env, []}]}]}. + +%% == escriptize == +{escript_name, "application"}. +{escript_incl_apps, []}. +{escript_shebang, "#!/usr/bin/env escript\n"}. +{escript_comment, "%%\n"}. +{escript_emu_args, "%%! -pa application/application/ebin\n"}. + +%% == LFE Compiler == + +%% LFE files to compile before the rest +{lfe_first_files, []}. + +%% Options for the LFE compiler: reuse {erl_opts, []} + +%% == ErlyDTL Compiler == + +%% Options for the ErlyDTL compiler +{erlydtl_opts, []}. + +%% == EUnit == + +%% Options for eunit:test() +{eunit_opts, []}. + +%% Additional compile options for eunit. erl_opts is also used +{eunit_compile_opts, []}. + +%% Same as erl_first_files, but used only when running 'eunit' +{eunit_first_files, []}. + +%% == Cover == + +%% Whether to enable coverage reporting. Default is `false' +{cover_enabled, false}. + +%% Whether to print coverage report to console. Default is `false' +{cover_print_enabled, false}. + +%% Whether to export coverage report to file. Default is `false' +{cover_export_enabled, false}. + +%% == Common Test == + +%% Override the default "test" directory in which SUITEs are located +{ct_dir, "itest"}. + +%% Override the default "logs" directory in which SUITEs are logged +{ct_log_dir, "test/logs"}. + +%% Option to pass extra parameters when launching Common Test +{ct_extra_params, "-boot start_sasl -s myapp"}. + +%% Option to use short names (i.e., -sname test) when starting ct +{ct_use_short_names, true}. + +%% == QuickCheck == + +%% If qc_mod is unspecified, rebar tries to detect Triq or EQC +{qc_opts, [{qc_mod, module()}, Options]}. + +%% Additional compile options for qc. erl_opts is also used +{qc_compile_opts, []}. + +%% Same as erl_first_files, but used only when running 'qc' +{qc_first_files, []}. + +%% == Cleanup == + +%% Which files to cleanup +{clean_files, ["file", "file2"]}. + +%% == OTP Applications == + +%% Enable validation of the OTP app module list. Default is 'true' +{validate_app_modules, true}. + +%% == 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, svn, rsync, fossil, and p4. +{deps, [app_name, + {rebar, "1.0.*"}, + {rebar, ".*", + {git, "git://github.com/rebar/rebar.git"}}, + {rebar, ".*", + {git, "git://github.com/rebar/rebar.git", "Rev"}}, + {rebar, "1.0.*", + {git, "git://github.com/rebar/rebar.git", {branch, "master"}}}, + {rebar, "1.0.0", + {git, "git://github.com/rebar/rebar.git", {tag, "1.0.0"}}}, + %% Dependencies can be marked as 'raw'. Rebar does not require + %% such dependencies to have a standard Erlang/OTP layout + %% which assumes the presence of either + %% "src/dependency_name.app.src" or "ebin/dependency_name.app" + %% files. + %% + %% 'raw' dependencies can still contain 'rebar.config' and + %% even can have the proper OTP directory layout, but they + %% won't be compiled. + %% + %% Only a subset of rebar commands will be executed on the + %% 'raw' subdirectories: get-deps, update-deps, check-deps, + %% list-deps and delete-deps. + {rebar, "", + {git, "git://github.com/rebar/rebar.git", {branch, "master"}}, + [raw]}, + {app_name, ".*", {hg, "https://www.example.org/url"}}, + {app_name, ".*", {rsync, "Url"}}, + {app_name, ".*", {svn, "https://www.example.org/url"}}, + {app_name, ".*", {svn, "svn://svn.example.org/url"}}, + {app_name, ".*", {bzr, "https://www.example.org/url", "Rev"}}, + {app_name, ".*", {fossil, "https://www.example.org/url"}}, + {app_name, ".*", {fossil, "https://www.example.org/url", "Vsn"}}, + {app_name, ".*", {p4, "//depot/subdir/app_dir"}}]}. + +%% == Subdirectories == + +%% Subdirectories? +{sub_dirs, ["dir1", "dir2"]}. + +%% == Plugins == + +%% Plugins you wish to include. +%% These can include any module on the code path, including deps. +%% Alternatively, plugins can be placed as source files in the plugin_dir, in +%% which case they will be compiled and loaded dynamically at runtime. +{plugins, [plugin1, plugin2]}. + +%% Override the directory in which plugin sources can be found. +%% Defaults to ./plugins +{plugin_dir, "some_other_directory"}. + + +%% == Pre/Post Command Hooks == + +{pre_hooks, [{clean, "./prepare_package_files.sh"}, + {"linux", compile, "c_src/build_linux.sh"}, + {compile, "escript generate_headers"}, + {compile, "escript check_headers"}]}. + +{post_hooks, [{clean, "touch file1.out"}, + {"freebsd", compile, "c_src/freebsd_tweaks.sh"}, + {eunit, "touch file2.out"}, + {compile, "touch postcompile.out"}]}. + +%% == xref == + +{xref_warnings, false}. + +%% optional extra paths to include in xref:set_library_path/2. +%% specified relative location of rebar.config. +%% e.g. {xref_extra_paths,["../gtknode/src"]} +{xref_extra_paths,[]}. + +%% xref checks to run +{xref_checks, [undefined_function_calls, undefined_functions, + locals_not_used, exports_not_used, + deprecated_function_calls, deprecated_functions]}. + +%% Optional custom xref queries (xref manual has details) specified as +%% {xref_queries, [{query_string(), expected_query_result()},...]} +%% The following for example removes all references to mod:*foo/4 +%% functions from undefined external function calls as those are in a +%% generated module +{xref_queries, + [{"(XC - UC) || (XU - X - B" + " - (\"mod\":\".*foo\"/\"4\"))",[]}]}. diff --git a/.bin/rebar.config.script b/.bin/rebar.config.script new file mode 100644 index 0000000..6735645 --- /dev/null +++ b/.bin/rebar.config.script @@ -0,0 +1,17 @@ +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ts=4 sw=4 ft=erlang et + +ExtraDeps = [{retest, ".*", {git, "git://github.com/dizzyd/retest.git"}}], + +case os:getenv("REBAR_EXTRA_DEPS") of + false -> + CONFIG; + _ -> + case lists:keysearch(deps, 1, CONFIG) of + {value, {deps, Deps}} -> + NDeps = Deps ++ ExtraDeps, + lists:keyreplace(deps, 1, CONFIG, {deps, NDeps}); + false -> + CONFIG ++ [{deps, ExtraDeps}] + end +end.