Skip to content

Commit

Permalink
if no .git directory, change into "builds" on server for: dwyl/learn-…
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Jul 29, 2017
1 parent 03ef4e2 commit 37c755b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ defmodule HelloWorldEdeliver.PageController do
use HelloWorldEdeliver.Web, :controller

def index(conn, _params) do
IO.inspect(System.cmd("pwd", []))
{rev, _} = System.cmd("git", ["rev-parse", "HEAD"])
IO.puts(String.replace(rev, "\n", ""))
render conn, "index.html"
end

def git_revision_hash(conn, _params) do
{cwd, _} = IO.inspect(System.cmd("pwd", []))
{ls, _} = IO.inspect(System.cmd("ls", ["-a"]))
ls = String.split(ls, "\n")
if Enum.member?(ls, ".git"), do: IO.inspect(System.cmd("pwd", [])), else: IO.inspect(System.cmd("cd", ["./builds"]))
{rev, _} = System.cmd("git", ["rev-parse", "HEAD"])
IO.puts(String.replace(rev, "\n", ""))
text conn, String.replace(rev, "\n", "")
end
end

0 comments on commit 37c755b

Please sign in to comment.