equal
deleted
inserted
replaced
373 |
373 |
374 if (gnutar_check) bash("tar " + options + args, redirect = redirect) |
374 if (gnutar_check) bash("tar " + options + args, redirect = redirect) |
375 else error("Expected to find GNU tar executable") |
375 else error("Expected to find GNU tar executable") |
376 } |
376 } |
377 |
377 |
|
378 def require_command(cmds: String*) |
|
379 { |
|
380 for (cmd <- cmds) { |
|
381 if (!bash(Bash.string(cmd) + " --version").ok) error("Missing command: " + quote(cmd)) |
|
382 } |
|
383 } |
|
384 |
378 private lazy val curl_check: Unit = |
385 private lazy val curl_check: Unit = |
379 try { bash("curl --version").check } |
386 try { require_command("curl") } |
380 catch { case ERROR(_) => error("Cannot download files: missing curl") } |
387 catch { case ERROR(msg) => error(msg + " --- cannot download files") } |
381 |
388 |
382 def download(url: String, file: Path, progress: Progress = new Progress): Unit = |
389 def download(url: String, file: Path, progress: Progress = new Progress): Unit = |
383 { |
390 { |
384 curl_check |
391 curl_check |
385 progress.echo("Getting " + quote(url)) |
392 progress.echo("Getting " + quote(url)) |