Sha256: c927143f7d39dd2e240776f25378dcaf360b7df908f09a9d3a9afeb871aa1743

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env bash

# Usage:
#  1. npm install
#  1. ./update_assets.sh
#  1. review any changes manually, ignoring where where the engine adds configurations
DIST_PATH="node_modules/redoc/dist"
ASSETS_PATH="app/assets"
npm install
command -v beautify >/dev/null || npm install -g beautify

strip_trailing_whitespace() {
  git ls-files app/assets/**/*{erb,css,html,js} | while read -r file ; do sed -i '' -e's/[[:space:]]*$//' "$file"; done
}

# node_modules/redoc/dist/
# ├── redoc.min.js
# └── redoc.min.map

# javascript
mkdir -p "${ASSETS_PATH}/javascripts/api_doc_server/"
cp "${DIST_PATH}/redoc.min.map" "${ASSETS_PATH}/javascripts/api_doc_server/"
cp "${DIST_PATH}/redoc.min.js" "${ASSETS_PATH}/javascripts/api_doc_server/redoc.min.js"
cp "${DIST_PATH}/redoc.min.js" "${ASSETS_PATH}/javascripts/api_doc_server/redoc.js"

# beautify to more easily see diff
beautify -o "${ASSETS_PATH}/javascripts/api_doc_server/redoc.js" -f js "${ASSETS_PATH}/javascripts/api_doc_server/redoc.js"

# Strip trailing whitespace
strip_trailing_whitespace

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
api_doc_server-1.0.1 update_assets.sh
api_doc_server-1.0.0 update_assets.sh