From a37115334ee848d6f545ab7dbbfb3c6d17810c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Meadows-Jo=CC=88nsson?= Date: Tue, 25 Feb 2014 11:22:20 +0100 Subject: [PATCH] Update release_docs task From dynamo/dynamo --- release_docs.exs | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/release_docs.exs b/release_docs.exs index 95e501a..a7fd8d5 100644 --- a/release_docs.exs +++ b/release_docs.exs @@ -1,34 +1,14 @@ -# Run with mix run release_docs.exs - -# Uncommited changes will not be included! - -# Files that will be included in addition to the -# ex_doc generated files -additional_files = [ - "README.html" -] - -System.cmd "git stash -u" +System.cmd "git clone --branch gh-pages `git config --get remote.origin.url` docs" Mix.Task.run "docs" -files = Path.wildcard("docs/**") |> Enum.map(&Path.relative_to(&1, "docs")) -files = files ++ additional_files +# Enum.each(additional_files, &File.cp!(&1, Path.join("docs", &1))) -IO.puts System.cmd "git checkout gh-pages" +File.cd! "docs", fn -> + System.cmd "git add -A ." + System.cmd "git commit -m \"Updated docs\"" + System.cmd "git push origin gh-pages" +end -System.cmd "git reset" - -old_files = System.cmd("git ls-files") |> String.split("\n") -old_files = old_files -- additional_files -IO.puts System.cmd "git rm " <> Enum.join(old_files, " ") - -File.cp_r "docs/.", "./" File.rm_rf! "docs" -IO.puts System.cmd "git add " <> Enum.join(files, " ") -IO.puts System.cmd "git commit -m \"Update docs\"" -IO.puts System.cmd "git push" - -Enum.each(files, &File.rm_rf!/1) -IO.puts System.cmd "git checkout master --force" -System.cmd "git stash pop" +IO.puts IO.ANSI.escape("%{green}Updated docs pushed to origin/gh-pages")