Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ngw

ngw/site.ex Secret

Created July 10, 2016 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngw/49e41802cfb7170754da1b6155791236 to your computer and use it in GitHub Desktop.
Save ngw/49e41802cfb7170754da1b6155791236 to your computer and use it in GitHub Desktop.
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