Sha256: a6cf674e36c025be1df99c33b398c2c8f40c69f9475627e4c5979d63d76b7094

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

#!/bin/bash

#/ NAME
#/     run-noop -- Run noop chef in separate workarea
#/
#/ SYNOPSIS
#/     
#/     run-noop DIR VERSION DNA


# figure out the project root under which bin, lib live
shome="$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)"

# load a meat library
source "$shome/libexec/_jason" "$@"

DEFINE_boolean make "$FLAGS_FALSE" "Run make"

# entry point
function main {
  case "$#" in
    0)
      logger_fatal "missing DIR VERSION DNA"
      exit 1
      ;;
    1)
      logger_fatal "missing VERSION DNA"
      exit 1
      ;;
    2)
      logger_fatal "missing DNA"
      exit 1
      ;;
    3)
      true
      ;;
    *)
      logger_fatal "too many args"
      exit 1
      ;;
  esac

  local pth_workarea="$1"; shift
  local ver_repo="$1"; shift

  rm -f "$pth_workarea"/chef.{log,json}
  
  local pth_rna="rna/output/base.json"
  if [[ "$#" > 0 ]]; then
    pth_rna="$1"; shift
  fi

  if [[ ! -d "$pth_workarea/.git" ]]; then
    git clone . "$pth_workarea"
    FLAGS_make="$FLAGS_TRUE"
  fi

  cd "$pth_workarea"
  git fetch
  git fetch --tags
  git reset --hard "$ver_repo"
  if [[ "$FLAGS_make" = "$FLAGS_TRUE" ]]; then
    make
  fi

  rm -rf var/chef/reports
  mkdir -p var/chef/reports
  bundle exec chef-local --noop -c etc/chef/solo.rb -j $pth_rna > "var/chef/reports/chef.log"
  (set +f; $shome/libexec/sanitize node "var/chef/reports/"chef*.json > "chef.json")
  $shome/libexec/sanitize log "var/chef/reports/chef.log" > "chef.log"
}

require sub "$BASH_SOURCE" "$@"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tvdinner-0.0.6 libexec/run-noop