Skip to content

Commit

Permalink
Use /tmp/hugo-public as build path.
Browse files Browse the repository at this point in the history
  • Loading branch information
aladagemre committed Jan 21, 2016
1 parent 8d8770b commit 1b47282
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions build.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ require "http"
require "logger"
require "colorize"

log = Logger.new(STDOUT)
log.level = Logger::INFO

APP_LOCATION = __DIR__
APP_PUBLIC = APP_LOCATION + "/public"
APP_PUBLIC = File.join(APP_LOCATION, "/public")
BUILT_PUBLIC = "/tmp/hugo-public"
PRIVATE_KEY_URL = ENV["PRIVTE_KEY_URL"]? ? ENV["PRIVTE_KEY_URL"] as String : ""
PUBLIC_KEY_URL = ENV["PUBLIC_KEY_URL"]? ? ENV["PUBLIC_KEY_URL"] as String : ""
ENV_GIT_REPO = ENV["GIT_REPO"]?

log = Logger.new(STDOUT)
log.level = Logger::INFO
log.info("App location: #{APP_LOCATION}")

unless ENV_GIT_REPO
Expand Down Expand Up @@ -44,15 +45,15 @@ if File.exists?(gitdir_path)
Process.run("git", ["pull"], chdir: gitdir_path)
Process.run("make", ["html"], chdir: gitdir_path)
Process.run("rm", ["-rf", APP_PUBLIC])
Process.run("cp", ["-rf", "public", APP_PUBLIC], chdir: gitdir_path)
Process.run("cp", ["-rf", BUILT_PUBLIC, APP_PUBLIC], chdir: gitdir_path)
Process.run("cp", ["-rf", "config", File.join(APP_LOCATION, "config")], chdir: gitdir_path)
log.info("Update complete.".colorize(:green))
else
log.info("Repo not found, cloning...")
Process.run("git", ["clone", git_repo as String, gitdir_path as String])
Process.run("make", ["html"], chdir: gitdir_path)
Process.run("rm", ["-rf", APP_PUBLIC])
Process.run("cp", ["-rf", "public", APP_PUBLIC], chdir: gitdir_path)
Process.run("cp", ["-rf", BUILT_PUBLIC, APP_PUBLIC], chdir: gitdir_path)
Process.run("cp", ["-rf", "config", File.join(APP_LOCATION, "config")], chdir: gitdir_path)

log.info("Build complete...".colorize(:green))
Expand Down

0 comments on commit 1b47282

Please sign in to comment.