Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

176 rader
6.2 KiB

10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
10 år sedan
  1. rebar
  2. =====
  3. rebar [3.0](#30) is an Erlang build tool that makes it easy to compile and test Erlang
  4. applications, port drivers and releases.
  5. [![Build Status](https://travis-ci.org/rebar/rebar3.svg?branch=master)](https://travis-ci.org/rebar/rebar3) [![Windows build status](https://ci.appveyor.com/api/projects/status/yx4oitd9pvd2kab3?svg=true)](https://ci.appveyor.com/project/TristanSloughter/rebar3)
  6. rebar is a self-contained Erlang script, so it's easy to distribute or even
  7. embed directly in a project. Where possible, rebar uses standard Erlang/OTP
  8. conventions for project structures, thus minimizing the amount of build
  9. configuration work. rebar also provides dependency management, enabling
  10. application writers to easily re-use common libraries from a variety of
  11. locations (git, hg, etc).
  12. 3.0 Alpha-6
  13. ====
  14. [DOCUMENTATION](http://www.rebar3.org/v3.0/docs)
  15. This is a preliminary branch, considered to be alpha, and still
  16. very unstable. Use at your own risk, but please do report bugs
  17. and issues encountered and we'll try to resolve problems as
  18. soon as possible.
  19. Compatibility with rebar 2.0 has been broken, and features removed to
  20. limit scope.
  21. ### Commands
  22. | Command | Description |
  23. |----------- |------------ |
  24. | as | Higher-order provider to run multiple tasks in sequence as certain profiles |
  25. | compile | Build project |
  26. | clean | Remove project apps beam files |
  27. | cover | Generate coverage info from data compiled by `eunit --cover` or `ct --cover` |
  28. | ct | Run Common Test suites |
  29. | do | Higher-order provider to run multiple tasks in sequence |
  30. | dialyzer | Run the Dialyzer analyzer on the project |
  31. | edoc | Generate documentation using edoc |
  32. | escriptize | Generate escript of project |
  33. | eunit | Run eunit tests |
  34. | help | Print help for rebar or task |
  35. | new | Create new rebar project from templates |
  36. | pkgs | List available packages |
  37. | plugins | List or upgrade plugins |
  38. | release | Build release of project |
  39. | relup | Creates relup from 2 releases |
  40. | report | Report on environment and versions for bug reports |
  41. | shell | Run shell with project apps in path |
  42. | tar | Package release into tarball |
  43. | unlock | Unlock dependencies |
  44. | update | Update package index |
  45. | upgrade | Fetch latest version of dep |
  46. | version | Print current version of Erlang/OTP and rebar |
  47. | xref | Run cross reference analysis on the project |
  48. ### Changes
  49. * Fetches and builds deps if missing when running any command that relies on them
  50. * Automatically recognizes `apps` and `lib` directory structure
  51. * Relx for releases
  52. ### Gone
  53. * Reltool integeration
  54. ### Providers
  55. Providers are the modules that do the work to fulfill a user's command.
  56. Example:
  57. ```erlang
  58. -module(rebar_prv_something).
  59. -behaviour(rebar_provider).
  60. -export([init/1,
  61. do/1,
  62. format_error/1]).
  63. -define(PROVIDER, something).
  64. -define(DEPS, []).
  65. %% ===================================================================
  66. %% Public API
  67. %% ===================================================================
  68. -spec init(rebar_state:state()) -> {ok, rebar_state:state()}.
  69. init(State) ->
  70. State1 = rebar_state:add_provider(State, rebar_provider:create([{name, ?PROVIDER},
  71. {module, ?MODULE},
  72. {bare, false},
  73. {deps, ?DEPS},
  74. {example, "rebar dummy"},
  75. {short_desc, "dummy plugin."},
  76. {desc, ""},
  77. {opts, []}])),
  78. {ok, State1}.
  79. -spec do(rebar_state:state()) -> {ok, rebar_state:state()}.
  80. do(State) ->
  81. %% Do something
  82. {ok, State}.
  83. -spec format_error(any()) -> iolist().
  84. format_error(Reason) ->
  85. io_lib:format("~p", [Reason]).
  86. ```
  87. Building
  88. --------
  89. Recommended installation of [Erlang/OTP](http://www.erlang.org) is source built using [erln8](http://metadave.github.io/erln8/) or [kerl](https://github.com/yrashk/kerl). For binary packages use those provided by [Erlang Solutions](https://www.erlang-solutions.com/downloads/download-erlang-otp), but be sure to choose the "Standard" download option or you'll have issues building projects.
  90. ### Dependencies
  91. To build rebar you will need a working installation of Erlang R15 (or later).
  92. Should you want to clone the rebar repository, you will also require git.
  93. #### Downloading
  94. You can download a pre-built binary version of rebar3 based on the last commit from:
  95. https://s3.amazonaws.com/rebar3/rebar3
  96. #### Bootstrapping rebar3
  97. ```sh
  98. $ git clone https://github.com/rebar/rebar3
  99. $ cd rebar3
  100. $ ./bootstrap
  101. ```
  102. ### Developing on rebar3
  103. When developing you can simply run `escriptize` to build your changes but the new escript is under `_build/default/bin/rebar3`
  104. ```sh
  105. $ ./rebar3 escriptize
  106. $ _build/default/bin/rebar3
  107. ```
  108. Contributing to rebar
  109. =====================
  110. Please refer to [CONTRIBUTING](CONTRIBUTING.md).
  111. Community and Resources
  112. -----------------------
  113. In case of problems that cannot be solved through documentation or examples, you
  114. may want to try to contact members of the community for help. The community is
  115. also where you want to go for questions about how to extend rebar, fill in bug
  116. reports, and so on.
  117. The main place to go for questions is the [rebar mailing
  118. list](http://lists.basho.com/pipermail/rebar_lists.basho.com/). If you need
  119. quick feedback, you can try the #rebar channel on
  120. [irc.freenode.net](http://freenode.net). Be sure to check the
  121. [wiki](https://github.com/rebar/rebar/wiki) first, just to be sure you're not
  122. asking about things with well known answers.
  123. For bug reports, roadmaps, and issues, visit the [github issues
  124. page](https://github.com/rebar/rebar/issues).
  125. General rebar community resources and links:
  126. - [Rebar Mailing List](http://lists.basho.com/pipermail/rebar_lists.basho.com/)
  127. - #rebar on [irc.freenode.net](http://freenode.net/)
  128. - [wiki](https://github.com/rebar/rebar/wiki)
  129. - [issues](https://github.com/rebar/rebar/issues)