From 381adec9007556081d45d58016c348b441774c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 25 May 2017 12:07:43 +0200 Subject: Edit the previous doc addition --- doc/src/guide/releases.asciidoc | 42 +++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'doc') diff --git a/doc/src/guide/releases.asciidoc b/doc/src/guide/releases.asciidoc index e571992..b4fc5a2 100644 --- a/doc/src/guide/releases.asciidoc +++ b/doc/src/guide/releases.asciidoc @@ -119,57 +119,63 @@ $ bin/example_release.cmd upgrade "2/example_release" Your release was upgraded! -=== Getting relx semver value +=== Getting Relx semver value -There is a *workaround* to get the semver version value which is -generated by relx based on VCS history. +There is a *workaround* to get the semver value which is +generated by Relx based on VCS history. -Create `rel/version` file with only one line inside: +Create a file 'rel/version' with only one line inside: [source,erlang] {{ release_version }} -Add/Update `overlay` section of your `relx.config` +Add/Update the `overlay` section of your `relx.config`: [source,erlang] {overlay, [ - {template, rel/version, version} + {template, "rel/version", "version"} ]}. -So when you run `mare rel` it creates file like `_rel/app/version` which -would contain the version value generated by relx +When you run `mare rel` it creates the file '$(RELX_OUTPUT_DIR)/example/version' +which contains the version value generated by Relx. [source,bash] $ cat _rel/app/release 1.0.0+build.11.ref5612aa0 -In your `Makefile` you can use this simple snippet to get the version. -But please keep in mind that this should depend on `rel` target +In your `Makefile` you can use this simple snippet to get the version, +but please keep in mind that this should depend on the `rel` target: [source,make] $(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version) -Here is an example of the `Makefile`: +For example: + [source,make] +---- include erlang.mk -#--------------------------- Custom targets ----------------------------------- + APP_VERSION = $(shell cat $(RELX_OUTPUT_DIR)/$(RELX_REL_NAME)/version) myrecipe: all echo APP_VERSION = $(APP_VERSION) +---- + +Would output: -The output would be like: [source,bash] +---- $ make myrecipe ... ===> Starting relx build process ... ===> Resolving OTP Applications from directories: - /home/username/myapp/apps - /home/username/myapp/deps + /home/username/example/apps + /home/username/example/deps /usr/lib/erlang/lib - /home/username/myapp/_rel -===> Resolved myapp-0.3.10+build.11.ref5612aa0 + /home/username/example/_rel +===> Resolved example-0.3.10+build.11.ref5612aa0 ===> Including Erts from /usr/lib/erlang ===> release successfully created! -===> tarball /home/username/myapp/_rel/myapp/myapp-0.3.10+build.11.ref5612aa0.tar.gz successfully created! +===> tarball /home/username/example/_rel/example/example-0.3.10+build.11.ref5612aa0.tar.gz successfully created! echo APP_VERSION = 0.3.10+build.11.ref5612aa0 APP_VERSION = 0.3.10+build.11.ref5612aa0 +---- -- cgit v1.2.3