   template using the `@` macro.
 
   For more information, check `EEx.SmartEngine`.
+
+  ## Examples
+
+      defmodule Mix.Tasks.MyTask do
+        require Mix.Generator
+        Mix.Generator.embed_template(:log, "Log: <%= @log %>")
+      end
+
+      Mix.Tasks.MyTask.log_template(log: "creating directory")
+      #=> "Log: creating directory"
+
   """
   defmacro embed_template(name, contents) do
     quote bind_quoted: binding do

  Embeds a text given by `contents` into the current module.

  It will define a private function with the `name` followed by
  `_text` that expects no argument.
  """
  defmacro embed_text(name, contents) do
    quote bind_quoted: binding do


  @doc """
  Creates a directory if one does not exist yet.

  This function does nothing if the given directory already exists; in this
  case, it still logs the directory creation.

  ## Examples

      iex> Mix.Generator.create_directory "path/to/dir"
      * creating path/to/dir
      :ok

  """
  @spec create_directory(Path.t) :: any
  def create_directory(path) when is_binary(path) do
    Mix.shell.info [:green, "* creating ", :reset, Path.relative_to_cwd(path)]
    File.mkdir_p! path
