You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
5.0 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. rebar
  2. =====
  3. rebar 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/tsloughter/rebar.svg?branch=rebar3)](https://travis-ci.org/tsloughter/rebar)
  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
  13. ====
  14. This is an experimental branch.
  15. ### Commands
  16. | Command | Description |
  17. |----------- |------------ |
  18. | compile | Build project |
  19. | clean | Remove project apps beam files |
  20. | ct | Run Common Test suites |
  21. | do | Higher-order provider to run multiple tasks in sequence |
  22. | eunit | Run eunit tests |
  23. | help | Print help for rebar or task |
  24. | new | Create new rebar project from templates |
  25. | pkgs | List available packages |
  26. | release | Build release of project |
  27. | shell | Run shell with project apps in path |
  28. | tar | Package release into tarball |
  29. | update | Update package index |
  30. | upgrade | Fetch latest version of dep |
  31. | version | Print current version of Erlang/OTP and rebar |
  32. ### Changes
  33. * Fetches and builds deps if missing when running any command that relies on them
  34. * Automatically recognizes `apps` and `lib` directory structure
  35. * `escriptize` requires `escript_top_level_app` set in `rebar.config`
  36. * Relx for releases
  37. ### Gone
  38. * Reltool integeration
  39. ### Providers
  40. Providers are the modules that do the work to fulfill a user's command.
  41. Example:
  42. ```erlang
  43. -module(rebar_prv_something).
  44. -behaviour(rebar_provider).
  45. -export([init/1,
  46. do/1]).
  47. -define(PROVIDER, something).
  48. -define(DEPS, []).
  49. %% ===================================================================
  50. %% Public API
  51. %% ===================================================================
  52. -spec init(rebar_state:state()) -> {ok, rebar_state:state()}.
  53. init(State) ->
  54. State1 = rebar_state:add_provider(State, rebar_provider:create([{name, ?PROVIDER},
  55. {module, ?MODULE},
  56. {bare, false},
  57. {deps, ?DEPS},
  58. {example, "rebar dummy"},
  59. {short_desc, "dummy plugin."},
  60. {desc, ""},
  61. {opts, []}])),
  62. {ok, State1}.
  63. -spec do(rebar_state:state()) -> {ok, rebar_state:state()}.
  64. do(State) ->
  65. %% Do something
  66. {ok, State}.
  67. ```
  68. Building
  69. --------
  70. Recommended installation of [Erlang/OTP](http://www.erlang.org) is binary packages from [Erlang Solutions](https://www.erlang-solutions.com/downloads/download-erlang-otp). For source it is recommended you use [erln8](http://metadave.github.io/erln8/) or [kerl](https://github.com/yrashk/kerl).
  71. ### Dependencies
  72. To build rebar you will need a working installation of Erlang R15 (or later).
  73. Should you want to clone the rebar repository, you will also require git.
  74. #### Downloading
  75. You can download a pre-built binary version of rebar3 based on the last commit from:
  76. https://s3.amazonaws.com/rebar3/rebar3
  77. #### Building rebar
  78. ```sh
  79. $ git clone git://github.com/tsloughter/rebar.git
  80. $ cd rebar
  81. $ ./bootstrap/bootstrap
  82. ==> rebar (compile)
  83. Congratulations! You now have a self-contained script called "rebar" in
  84. your current working directory. Place this script anywhere in your path
  85. and you can use rebar to build OTP-compliant apps.
  86. ```
  87. Contributing to rebar
  88. =====================
  89. Please refer to [CONTRIBUTING](CONTRIBUTING.md).
  90. Community and Resources
  91. -----------------------
  92. In case of problems that cannot be solved through documentation or examples, you
  93. may want to try to contact members of the community for help. The community is
  94. also where you want to go for questions about how to extend rebar, fill in bug
  95. reports, and so on.
  96. The main place to go for questions is the [rebar mailing
  97. list](http://lists.basho.com/pipermail/rebar_lists.basho.com/). If you need
  98. quick feedback, you can try the #rebar channel on
  99. [irc.freenode.net](http://freenode.net). Be sure to check the
  100. [wiki](https://github.com/rebar/rebar/wiki) first, just to be sure you're not
  101. asking about things with well known answers.
  102. For bug reports, roadmaps, and issues, visit the [github issues
  103. page](https://github.com/rebar/rebar/issues).
  104. General rebar community resources and links:
  105. - [Rebar Mailing List](http://lists.basho.com/pipermail/rebar_lists.basho.com/)
  106. - #rebar on [irc.freenode.net](http://freenode.net/)
  107. - [wiki](https://github.com/rebar/rebar/wiki)
  108. - [issues](https://github.com/rebar/rebar/issues)