Packages
exrm
0.19.1
1.0.8
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc8
1.0.0-rc7
1.0.0-rc6
1.0.0-rc5
1.0.0-rc4
1.0.0-rc3
0.19.9
0.19.8
0.19.7
0.19.6
0.19.5
0.19.4
0.19.3
0.19.2
0.19.1
0.19.0
0.18.8
0.18.7
0.18.6
0.18.5
0.18.4
0.18.3
0.18.2
0.18.1
0.18.0
0.17.3
0.17.2
0.17.1
0.17.0
0.16.0
0.15.3
0.15.2
0.15.1
0.15.0
0.14.17
0.14.16
0.14.15
0.14.14
0.14.13
0.14.12
0.14.11
0.14.10
0.14.9
0.14.8
0.14.7
0.14.6
0.14.5
0.14.3
0.14.2
0.14.1
0.14.0
0.12.12
0.12.11
0.12.10
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.3
0.10.1
0.10.0
0.9.2
0.9.1
0.8.1
0.8.0
0.7.3
0.7.2
0.7.1
0.7.0
0.6.15
0.6.14
0.6.13
0.6.12
0.6.11
0.6.10
0.6.9
0.6.8
0.6.7
0.6.6
0.6.5
0.6.4
0.6.3
0.6.2
0.6.1
0.6.0
0.5.0
0.4.7
Exrm, or Elixir Release Manager, provides mix tasks for building, upgrading, and controlling release packages for your application.
Current section
Files
Jump to
Current section
Files
lib/exrm/plugins/appups.ex
defmodule ReleaseManager.Plugin.Appups do
@name "appup"
@shortdoc "Generates a .appup for each dependency in your project"
@moduledoc """
Generates a .appup for each dependency in your project
"""
use ReleaseManager.Plugin
alias ReleaseManager.Config
alias ReleaseManager.Utils
alias ReleaseManager.Appups
def before_release(%Config{upgrade?: true} = config) do
debug "Generating appups for dependencies..."
deps = Mix.Dep.children([])
do_appup(config, deps)
end
def before_release(_), do: nil
def do_appup(_config, []), do: info "All dependencies have appups ready for release!"
def do_appup(config, [%Mix.Dep{app: :exrm}|deps]), do: do_appup(config, deps)
def do_appup(%Config{name: project} = config, [%Mix.Dep{app: app, opts: opts}|deps]) do
debug "Checking #{app}.."
last_release = Utils.get_last_release(project)
last_release_definition = Utils.rel_dest_path [project, "releases", last_release, "#{project}.rel"]
[{:release, _app, _erts, apps}] = Utils.read_terms(last_release_definition)
case List.keyfind(apps, app, 0) do
nil ->
debug "No appup required for #{app}."
app_info ->
last_app_version = "#{elem(app_info, 1)}"
v1_path = Utils.rel_dest_path [project, "lib", "#{app}-#{last_app_version}"]
v2_path = Keyword.get(opts, :build)
v2_ebin_path = Path.join(v2_path, "ebin")
[{:application, _app, info}] = Path.join(v2_ebin_path, "#{app}.app") |> Utils.read_terms
current_app_version = "#{Keyword.get(info, :vsn)}"
appup_path = Path.join(v2_ebin_path, "#{app}.appup")
appup_exists? = File.exists?(appup_path)
cond do
current_app_version == last_app_version ->
debug "No appup required for #{app}."
appup_exists? ->
debug "#{app} already has an appup, skipping generation."
true ->
debug "Generating appup for #{app}"
case Appups.make(app, last_app_version, current_app_version, v1_path, v2_path) do
{:error, reason} ->
error "Failed to generate appup for #{app}: #{reason}"
{:ok, _appup} ->
info "Generated .appup for #{app} #{last_app_version} -> #{current_app_version}"
end
end
end
do_appup(config, deps)
end
def after_release(_), do: nil
def after_package(_), do: nil
def after_cleanup(_), do: nil
end