Skip to content

Commit

Permalink
Update release_docs task
Browse files Browse the repository at this point in the history
From dynamo/dynamo
  • Loading branch information
ericmj committed Feb 25, 2014
1 parent 342476e commit a371153
Showing 1 changed file with 8 additions and 28 deletions.
36 changes: 8 additions & 28 deletions release_docs.exs
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit a371153

Please sign in to comment.