   """
   defmacro current_version(app) do
     quote do
-      unless is_atom(unquote(app)) do
-        raise "current_version argument must be an atom! got #{inspect(unquote(app))}"
-      end
-
-      Application.load(unquote(app))
-
-      case Application.spec(unquote(app)) do
-        nil -> raise "could not get current version of #{unquote(app)}, app could not be loaded"
-        spec -> "#{Keyword.get(spec, :vsn)}"
+      app = unquote(app)
+
+      unless is_atom(app) do
+        raise "current_version argument must be an atom! got #{inspect(app)}"
+      end
+
+      Application.load(app)
+
+      case Application.spec(app) do
+        nil ->
+          raise "could not get current version of #{app}, app could not be loaded"
+
+        spec ->
+          "#{Keyword.get(spec, :vsn)}"
       end
     end
   end

    raise ArgumentError, "expected release config to be a struct, instead got: #{inspect(config)}"
  end

  defp get_config_and_stop_agent(agent) do
    config = Mix.Config.Agent.get(agent)
    Mix.Config.Agent.stop(agent)
    config
  end

  defp to_struct(config) when is_list(config) do
    case Keyword.keyword?(config) do
      false ->
        raise LoadError, message: "invalid config term, expected keyword list: #{inspect(config)}"

      true ->
        default_env = Keyword.get(config, :default_environment)
        default_release = Keyword.get(config, :default_release)

        %__MODULE__{default_environment: default_env, default_release: default_release}
        |> to_struct(:environments, Keyword.get(config, :environments, []))
        |> to_struct(:releases, Keyword.get(config, :releases, []))
    end
  end

  defp to_struct(config, :environments, []) do

  """
  defmacro environment(name, do: block) do
    quote do
      name = unquote(name)

      unless is_atom(name) do
        raise "environment name must be an atom! got #{inspect(name)}"
      end

      env = Environment.new(name)
      conf = var!(config, Mix.Releases.Config)
      var!(config, Mix.Releases.Config) = put_in(conf, [:environments, name], env)
      var!(current_env, Mix.Releases.Config) = name
      unquote(block)
      var!(current_env, Mix.Releases.Config) = nil
    end
