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.

157 line
4.6 KiB

10 年之前
10 年之前
  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://secure.travis-ci.org/rebar/rebar.png?branch=master)](http://travis-ci.org/rebar/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. | do |
  20. | update <dep> | Update dep source |
  21. | shell | Run shell with project apps in path |
  22. | escriptize | Create escript from project |
  23. | release | Build release of project |
  24. | tar | Package release into tarball |
  25. | new | |
  26. | eunit | |
  27. | ct | |
  28. ### Missing
  29. * Pre and post hooks
  30. * Compilers besides erlc
  31. ### Changes
  32. * Fetches and builds deps if missing when running any command that relies on them
  33. * Automatically recognizes `apps` and `libs` directory structure
  34. * `escriptize` requires `escript_top_level_app` set in `rebar.config`
  35. * Relx for releases
  36. ### Gone
  37. * Reltool integeration
  38. ### Providers
  39. Providers are the modules that do the work to fulfill a user's command.
  40. Example:
  41. ```erlang
  42. -module(rebar_prv_something).
  43. -behaviour(rebar_provider).
  44. -export([init/1,
  45. do/1]).
  46. -include("rebar.hrl").
  47. -define(PROVIDER, something).
  48. -define(DEPS, []).
  49. %% ===================================================================
  50. %% Public API
  51. %% ===================================================================
  52. -spec init(rebar_config:config()) -> {ok, rebar_config:config()}.
  53. init(State) ->
  54. State1 = rebar_config:add_provider(State, #provider{name = ?PROVIDER,
  55. provider_impl = ?MODULE,
  56. bare = false,
  57. deps = ?DEPS,
  58. example = "rebar something",
  59. short_desc = "",
  60. desc = "",
  61. opts = []}),
  62. {ok, State1}.
  63. -spec do(rebar_config:config()) -> {ok, rebar_config:config()} | relx:error().
  64. do(Config) ->
  65. %% Do something
  66. {ok, Config}.
  67. ```
  68. Building
  69. --------
  70. Information on building and installing [Erlang/OTP](http://www.erlang.org) can
  71. be found [here](https://github.com/erlang/otp/wiki/Installation) ([more
  72. info](https://github.com/erlang/otp/blob/master/INSTALL.md)).
  73. ### Dependencies
  74. To build rebar you will need a working installation of Erlang R13B03 (or later).
  75. Should you want to clone the rebar repository, you will also require git.
  76. #### Downloading
  77. You can download a pre-built binary version of rebar from:
  78. https://github.com/rebar/rebar/wiki/rebar
  79. #### Building rebar
  80. ```sh
  81. $ git clone git://github.com/rebar/rebar.git
  82. $ cd rebar
  83. $ ./bootstrap/bootstrap
  84. Recompile: src/getopt
  85. ...
  86. Recompile: src/rebar_utils
  87. ==> rebar (compile)
  88. Congratulations! You now have a self-contained script called "rebar" in
  89. your current working directory. Place this script anywhere in your path
  90. and you can use rebar to build OTP-compliant apps.
  91. ```
  92. Contributing to rebar
  93. =====================
  94. Please refer to [CONTRIBUTING](CONTRIBUTING.md).
  95. Community and Resources
  96. -----------------------
  97. In case of problems that cannot be solved through documentation or examples, you
  98. may want to try to contact members of the community for help. The community is
  99. also where you want to go for questions about how to extend rebar, fill in bug
  100. reports, and so on.
  101. The main place to go for questions is the [rebar mailing
  102. list](http://lists.basho.com/pipermail/rebar_lists.basho.com/). If you need
  103. quick feedback, you can try the #rebar channel on
  104. [irc.freenode.net](http://freenode.net). Be sure to check the
  105. [wiki](https://github.com/rebar/rebar/wiki) first, just to be sure you're not
  106. asking about things with well known answers.
  107. For bug reports, roadmaps, and issues, visit the [github issues
  108. page](https://github.com/rebar/rebar/issues).
  109. General rebar community resources and links:
  110. - [Rebar Mailing List](http://lists.basho.com/pipermail/rebar_lists.basho.com/)
  111. - #rebar on [irc.freenode.net](http://freenode.net/)
  112. - [wiki](https://github.com/rebar/rebar/wiki)
  113. - [issues](https://github.com/rebar/rebar/issues)