Fl4m3Ph03n1x
How to name the generated tarball from an Elixir release?
Background
I am making an elixir release in tarball format:
defp releases,
do: [
my_app: [
applications: [
web_interface: :permanent,
runtime_tools: :permanent
],
steps: [:assemble, :tar],
include_executables_for: [:windows]
]
]
The release file has all necessary files, but the name generated is $release_name-$version, meaning it will be something like: my_app-2.1.5.
Problem
This means that every time I release, I need to change shortcuts and other files to have the correct name of the tarball.
Question
Is there a way to give a name to the tarball created that wont change with every release?
Marked As Solved
wojtekmach
Hex Core Team
Yeah I meant file rename.
glad it helped!
1
Also Liked
wojtekmach
Hex Core Team
If there’s no built-in way to customise the path note you can always add a custom release step. You can grab name and version from the given %Mix.Release{} struct.
- steps: [:assemble, :tar],
+ steps: [:assemble, :tar, &rename_tar/1],
# ...
defp rename_tar(release) do
# ...
release
end
5
Fl4m3Ph03n1x
For future reference, this is what I ended up with:
defp releases,
do: [
market_manager: [
applications: [
web_interface: :permanent,
runtime_tools: :permanent
],
steps: [:assemble, :tar, &rename_tar/1],
include_executables_for: [:windows]
]
]
defp rename_tar(release) do
tar_folder_path =
release.path
|> Path.join("../../")
|> Path.expand()
tar_path = Path.join(tar_folder_path, "#{release.name}-#{release.version}.tar.gz")
new_tar_path = Path.join(tar_folder_path, "application-data.tar.gz")
case File.rename(tar_path, new_tar_path) do
:ok -> release
err -> err
end
end
It works like a charm ![]()
2
Popular in Questions
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
I am trying to run a deploy with docker and I successfully runned with this command:
docker build -t romenigld/blog-prod .
but when I t...
New
As a follow up to my earlier question:
I have the code compiling and running but not getting a successful login from the rest server. ...
New
Hey,
I have a NanoPi-M3 and try to install Elixir on their Ubuntu image. I followed the Raspberry Pi installation instructions from the ...
New
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Sometimes I want to check if the input into a function is not a blank string.
My first approach:
defmodule Example do
def do_stuff(s...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
In AR this is so simple
@articles = current_user.articles
How to do in Ecto?
def index(conn, _params) do
current_user = conn.assig...
New
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217
Let’s say I have a map with required and optional k...
New
Other popular topics
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I would like to know what is the best IDE for elixir development?
New
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New







