Use Bakeware to create standalone binary

This commit is contained in:
2024-05-11 10:37:52 +02:00
parent 4e84fcd52f
commit 0d8d09d392
4 changed files with 35 additions and 35 deletions

View File

@@ -1,21 +1,13 @@
# FindOldMp3s
**TODO: Add description**
This project creates a CLI tool which will find MP3 files with bad bitrate. Bakeware will produce a standalone binary
file - this is NO escript release!
## Installation
## Setup
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `find_old_mp3s` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:find_old_mp3s, "~> 0.1.0"}
]
end
```shell
mix deps.get
MIX_ENV=prod mix release
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/find_old_mp3s>.
The built binary will be in `_build/prod/rel/bakeware/find_old_mp3s`

View File

@@ -1,18 +1,9 @@
defmodule FindOldMp3s do
@moduledoc """
Documentation for `FindOldMp3s`.
"""
defmodule FindOldMp3s.Main do
use Bakeware.Script
@doc """
Hello world.
## Examples
iex> FindOldMp3s.hello()
:world
"""
def hello do
:world
@impl Bakeware.Script
def main(_args) do
IO.puts "Hello, World!"
0
end
end

23
mix.exs
View File

@@ -1,28 +1,41 @@
defmodule FindOldMp3s.MixProject do
use Mix.Project
@app :find_old_mp3s
def project do
[
app: :find_old_mp3s,
app: @app,
version: "0.1.0",
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
deps: deps()
deps: deps(),
releases: [{@app, release()}],
preferred_cli_env: [release: :prod]
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
extra_applications: [:logger],
mod: {FindOldMp3s.Main, []}
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
{:bakeware, "~> 0.2.4"}
]
end
defp release do
[
overwrite: true,
quiet: true,
steps: [:assemble, &Bakeware.assemble/1],
strip_beams: Mix.env() == :prod
]
end
end

4
mix.lock Normal file
View File

@@ -0,0 +1,4 @@
%{
"bakeware": {:hex, :bakeware, "0.2.4", "0aaf49b34f4bab2aa433f9ff1485d9401e421603160abd6d269c469fc7b65212", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "7b97bcf6fbeee53bb32441d6c495bf478d26f9575633cfef6831e421e86ada6d"},
"elixir_make": {:hex, :elixir_make, "0.8.3", "d38d7ee1578d722d89b4d452a3e36bcfdc644c618f0d063b874661876e708683", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "5c99a18571a756d4af7a4d89ca75c28ac899e6103af6f223982f09ce44942cc9"},
}