aboutsummaryrefslogtreecommitdiff
path: root/pipeline/tools-lib.sh
blob: c7b3b24bcafcf6a75f02cd3b9e5dc7b400e3e8a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#
# Library used to refer to open source tools.

set -o nounset
set -o pipefail
set -o errexit

# NOTE: RAPPOR_SRC defined by the module that sources (cook.sh or ui.sh)

# Caller can override shebang line by setting $DEP_PYTHON.
readonly PYTHON=${DEP_PYTHON:-}

readonly METRIC_STATUS=${DEP_METRIC_STATUS:-}


# These 3 used by cook.sh.

TOOLS-combine-status() {
  if test -n "$PYTHON"; then
    $PYTHON $RAPPOR_SRC/pipeline/combine_status.py "$@"
  else
    $RAPPOR_SRC/pipeline/combine_status.py "$@"
  fi
}

TOOLS-combine-results() {
  if test -n "$PYTHON"; then
    $PYTHON $RAPPOR_SRC/pipeline/combine_results.py "$@"
  else
    $RAPPOR_SRC/pipeline/combine_results.py "$@"
  fi
}

TOOLS-metric-status() {
  if test -n "$METRIC_STATUS"; then
    $METRIC_STATUS "$@"
  else
    $RAPPOR_SRC/pipeline/metric_status.R "$@"
  fi
}

# Used by ui.sh.

TOOLS-csv-to-html() {
  if test -n "$PYTHON"; then
    $PYTHON $RAPPOR_SRC/pipeline/csv_to_html.py "$@"
  else
    $RAPPOR_SRC/pipeline/csv_to_html.py "$@"
  fi
}

#
# Higher level scripts
#

TOOLS-cook() {
  $RAPPOR_SRC/pipeline/cook.sh "$@"
}

# TODO: Rename gen-ui.sh.
TOOLS-gen-ui() {
  $RAPPOR_SRC/pipeline/ui.sh "$@"
}