defmodule Mix.Tasks.Compile.Phoenix do
  use Mix.Task
  @recursive true

  @moduledoc """
  Compiles Phoenix source files that support code reloading.
  """

  @doc false
  def run(_args) do
    {:ok, _} = Application.ensure_all_started(:phoenix)

    case touch() do
      [] -> :noop
      _  -> :ok
    end
  end

  @doc false
  def touch do
    Mix.Phoenix.modules
    |> modules_for_recompilation
    |> modules_to_file_paths
    |> Stream.each(&touch_if_exists(&1))
    |> Stream.filter(&(&1 == :ok))
    |> Enum.to_list()
  end
  defp touch_if_exists(path) do
    :file.change_time(path, :calendar.local_time())
  end

  defp modules_for_recompilation(modules) do
    modules
    |> Stream.filter fn mod ->
      Code.ensure_loaded?(mod) and
        function_exported?(mod, :__phoenix_recompile__?, 0) and
        mod.__phoenix_recompile__?
    end
  end

  defp modules_to_file_paths(modules) do
    Stream.map(modules, fn mod -> mod.__info__(:compile)[:source] end)
  end
end

defmodule Mix.Tasks.Compile.Phoenix do
  use Mix.Task
  @recursive true

  @moduledoc """
  Compiles Phoenix source files that support code reloading.
  """

  @doc false
  def run(_args) do
    {:ok, _} = Application.ensure_all_started(:phoenix)

    case touch() do
      [] -> :noop
      _  -> :ok
    end
  end

  @doc false
  def touch do
    Mix.Phoenix.modules
    |> modules_for_recompilation
    |> modules_to_file_paths
    |> Stream.map(&touch_if_exists(&1))
    |> Stream.filter(&(&1 == :ok))
    |> Enum.to_list()
  end
  defp touch_if_exists(path) do
    :file.change_time(path, :calendar.local_time())
  end

  defp modules_for_recompilation(modules) do
    modules
    |> Stream.filter fn mod ->
      Code.ensure_loaded?(mod) and
        function_exported?(mod, :__phoenix_recompile__?, 0) and
        mod.__phoenix_recompile__?
    end
  end

  defp modules_to_file_paths(modules) do
    Stream.map(modules, fn mod -> mod.__info__(:compile)[:source] end)
  end
end

Use map instead of each
Use map instead of each

rodrigues/phoenix,paulcsmith/phoenix,Gazler/phoenix,javimolla/phoenix,KazuCocoa/phoenix,kevinold/phoenix,switchflip/phoenix,marcioj/phoenix,ephe-meral/phoenix,cas27/phoenix,mitchellhenke/phoenix,keathley/phoenix,cas27/phoenix,michalmuskala/phoenix,nickgartmann/phoenix,mschae/phoenix,Gazler/phoenix,nshafer/phoenix,lancehalvorsen/phoenix,CultivateHQ/phoenix,dmarkow/phoenix,eksperimental/phoenix,hotvulcan/phoenix,CD1212/phoenix,stevedomin/phoenix,pap/phoenix,omotenko/phoenix_auth,Rumel/phoenix,andrewvy/phoenix,safi/phoenix,andrewvy/phoenix,mvidaurre/phoenix,DavidAlphaFox/phoenix,seejee/phoenix,VictorZeng/phoenix,iguberman/phoenix,jeffkreeftmeijer/phoenix,rafbgarcia/phoenix,hsavit1/phoenix,mvidaurre/phoenix,begleynk/phoenix,nshafer/phoenix,0x00evil/phoenix,FND/phoenix,mobileoverlord/phoenix,nshafer/phoenix,evax/phoenix,foxnewsnetwork/phoenix,milafrerichs/phoenix,lancehalvorsen/phoenix,jamilabreu/phoenix,optikfluffel/phoenix,wsmoak/phoenix,rodrigues/phoenix,maxnordlund/phoenix,sdnorm/phoenix,phoenixframework/phoenix,y-yagi/phoenix,trarbr/phoenix,eksperimental/phoenix,rafbgarcia/phoenix,lono-devices/phoenix,bsmr-erlang/phoenix,Smulligan85/phoenix,jwarwick/phoenix,wicliff/phoenix,linearregression/phoenix,Rumel/phoenix,manukall/phoenix,bsmr-erlang/phoenix,phoenixframework/phoenix,0x00evil/phoenix,yonglehou/phoenix,mobileoverlord/phoenix,Eventacular/phoenix,Kosmas/phoenix,romul/phoenix,keathley/phoenix,dmarkow/phoenix,Joe-noh/phoenix,Fluxuous/phoenix,michalmuskala/phoenix,stefania11/phoenix,thegrubbsian/phoenix,jeffweiss/phoenix,mschae/phoenix,korobkov/phoenix,vic/phoenix,elliotcm/phoenix,StevenNunez/phoenix,yoavlt/phoenix,gjaldon/phoenix,greyhwndz/phoenix,Ben-Evolently/phoenix,tony612/phoenix,beni55/phoenix,kidaa/phoenix,CultivateHQ/phoenix,lono-devices/phoenix,optikfluffel/phoenix,Dahoon/phoenix,trarbr/phoenix,GabrielNicolasAvellaneda/phoenix,jasond-s/phoenix,gjaldon/phoenix,sadiqmmm/phoenix,bdtomlin/phoenix,pap/phoenix,0x00evil/phoenix,ybur-yug/phoenix,ybur-yug/phoenix,evax/phoenix,arthurcolle/phoenix,doron2402/phoenix,DavidAlphaFox/phoenix,Smulligan85/phoenix,seejee/phoenix,bsodmike/phoenix,mitchellhenke/phoenix,Joe-noh/phoenix,robhurring/phoenix,optikfluffel/phoenix,ephe-meral/phoenix,stevedomin/phoenix,jwarwick/phoenix,iStefo/phoenix,JHKennedy4/phoenix,nicrioux/phoenix,rafbgarcia/phoenix,phoenixframework/phoenix,daytonn/phoenix,ericmj/phoenix,brucify/phoenix,esbullington/phoenix-1,jamilabreu/phoenix,vic/phoenix,kyledecot/phoenix,korobkov/phoenix,iStefo/phoenix,manukall/phoenix,Kosmas/phoenix,kholbekj/phoenix,fbjork/phoenix,wsmoak/phoenix,ericmj/phoenix,omotenko/phoenix_auth,robomc/phoenix