-
-
Save ngw/49e41802cfb7170754da1b6155791236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Pince.Site do | |
@moduledoc """ | |
Coordinates website creation | |
""" | |
def process(options) do | |
options |> check | |
end | |
defp check(options) do | |
check_existence([ | |
Path.expand(options[:from]), | |
Path.join(Path.expand(options[:from]), "_site") ]) | |
end | |
defp check_existence([]) do | |
[] | |
end | |
defp check_existence([head | tail]) do | |
if !File.exists?(head), do: raise(RuntimeError, "#{head} does not exist") | |
check_existence(tail) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment