     apps =
       cond do
         Mix.Project.umbrella?(config) ->
-          for %Mix.Dep{app: app} <- Mix.Dep.Umbrella.cached, do: app
+          for %Mix.Dep{app: app} <- Mix.Dep.Umbrella.cached(), do: app
+
         app = config[:app] ->
           [app]
+
         true ->
           []
       end
 
     type = type(config, opts)
-    Enum.each apps, &ensure_all_started(&1, type)
+    Enum.each(apps, &ensure_all_started(&1, type))
 
     # If there is a build path, we will let the application
     # that owns the build path do the actual check

  end

  defp check_configured() do
    configured = Mix.ProjectStack.configured_applications
    loaded = for {app, _, _} <- Application.loaded_applications(), do: app
    _ = for app <- configured -- loaded,
           :code.lib_dir(app) == {:error, :bad_name} do
      Mix.shell.error """
      You have configured application #{inspect app} in your configuration
      file, but the application is not available.

      This usually means one of:

      1. You have not added the application as a dependency in a mix.exs file.

      2. You are configuring an application that does not really exist.

      Please ensure #{inspect app} exists or remove the configuration.
      """
    end
    :ok
  end

  defp load_protocol(file) do
    case file do
      "Elixir." <> _ ->
        module = file |> Path.rootname |> String.to_atom
        :code.purge(module)
        :code.delete(module)
      _ ->
        :ok
    end


  defp ensure_all_started(app, type) do
    case Application.ensure_all_started(app, type) do
      {:ok, _} ->
        :ok

      {:error, {app, reason}} ->
        Mix.raise("Could not start application #{app}: " <> Application.format_error(reason))
    end
  end

