Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-1421: --env support pulled from colormaps-modis-c6 branch

Mike McGannfe6e05c4cd9e
diff --git a/Gruntfile.js b/Gruntfile.js
index 22c34bc1d..5b27c58b3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -21,6 +21,8 @@ var buildNumber = moment.utc().format("YYMMDDHHmmss");
module.exports = function(grunt) {
+ var env = grunt.option("env") || "release";
+
var options = {
version: 0,
release: 0
@@ -40,14 +42,14 @@ module.exports = function(grunt) {
// Copyright notice to place at the top of the minified JavaScript and
// CSS files
var banner = grunt.file.read("deploy/banner.txt");
-
+
//Platform specific command for find
var findCmd;
if(process.platform === 'win32')
findCmd = ";" //cygwin find doesn't really work in Windows compared to CentOS
else
findCmd = "find build -type d -empty -delete";
-
+
grunt.initConfig({
pkg: pkg,
@@ -253,7 +255,7 @@ module.exports = function(grunt) {
exec: {
config: {
- command: "PATH=python/bin:${PATH} bin/wv-options-build"
+ command: "PATH=python/bin:${PATH} bin/wv-options-build " + env
},
// After removing JavaScript and CSS files that are no longer
@@ -264,7 +266,7 @@ module.exports = function(grunt) {
},
fetch: {
- command: "PATH=python/bin:${PATH} FETCH_GC=1 bin/wv-options-build"
+ command: "PATH=python/bin:${PATH} FETCH_GC=1 bin/wv-options-build " + env
},
rpmbuild: {
@@ -602,7 +604,7 @@ module.exports = function(grunt) {
]);
grunt.registerTask("fetch", ["exec:fetch"])
-
+
grunt.registerTask("site", [
"load_branding",
"remove:build_site",
diff --git a/bin/wv-options-build b/bin/wv-options-build
index 808a07eac..2c9db6c22 100755
--- a/bin/wv-options-build
+++ b/bin/wv-options-build
@@ -26,33 +26,39 @@ die() {
exit 1
}
+ENV=$1
+
[ -d "$SRC_DIR" ] || die "Options directory does not exist"
if [ "$FETCH_GC" ] ; then
- rm -rf "$OPT_DIR/gc/*"
- rm -rf "$OPT_DIR/colormaps/gc/*"
- "$BIN_DIR/wv-options-fetch" "$OPT_DIR/config.json" "$OPT_DIR/gc"
+ rm -rf "$OPT_DIR/$ENV/gc/*"
+ rm -rf "$OPT_DIR/$ENV/colormaps/gc/*"
+ "$BIN_DIR/wv-options-fetch" "$OPT_DIR/$ENV/config.json" "$OPT_DIR/$ENV/gc"
exit 0
fi
rm -rf "$BUILD_DIR" "$DEST_DIR"
mkdir -p "$BUILD_DIR" "$DEST_DIR"
-cp -r "$SRC_DIR"/* "$BUILD_DIR"
+cp -r "$SRC_DIR"/common/* "$BUILD_DIR"
+rsync -a "$SRC_DIR/$ENV"/* "$BUILD_DIR"
mkdir -p "$DEST_DIR/config"
mkdir -p "$BUILD_DIR/colormaps"
if [ -e "$BUILD_DIR/features.json" ] ; then
- cp "$BUILD_DIR/features.json" "$BUILD_DIR/config/wv.json/_features"
+ cp "$BUILD_DIR/features.json" "$BUILD_DIR/config/wv.json/_features.json"
fi
if [ -e "$BUILD_DIR/config.json" ] ; then
- "$BIN_DIR/wv-options-wmts" "$BUILD_DIR/config.json" "$OPT_DIR/gc" \
+ "$BIN_DIR/wv-options-wmts" "$BUILD_DIR/config.json" "$BUILD_DIR/gc" \
"$BUILD_DIR/config/wv.json/_wmts" "$BUILD_DIR/colormaps"
fi
if [ -e "$BUILD_DIR/colormaps" ] ; then
mkdir -p "$BUILD_DIR"/config/palettes
+ if [ -d "$BUILD_DIR"/gc/colormaps ] ; then
+ cp -r "$BUILD_DIR"/gc/colormaps "$BUILD_DIR"/colormaps/gc
+ fi
"$BIN_DIR/wv-options-colormap" "$BUILD_DIR/colormaps" \
"$BUILD_DIR/config/palettes"
fi
@@ -71,6 +77,7 @@ for config in $configs; do
done
cp -r "$BUILD_DIR/brand" "$DEST_DIR"
+cp "$BUILD_DIR/brand.json" "$DEST_DIR"
"$BIN_DIR"/wv-options-validate "$BUILD_DIR/config.json" "$DEST_DIR/config"
diff --git a/bin/wv-options-fetch b/bin/wv-options-fetch
index 6e0ac97ce..4f5772e58 100755
--- a/bin/wv-options-fetch
+++ b/bin/wv-options-fetch
@@ -36,7 +36,7 @@ if len(args) != 2:
config_file = args[0]
output_dir = args[1]
colormaps = {}
-colormaps_dir = os.path.join("options", "colormaps", "gc")
+colormaps_dir = os.path.join(output_dir, "colormaps", "gc")
remote_count = 0
error_count = 0
warning_count = 0
diff --git a/bin/wv-options-merge b/bin/wv-options-merge
index 8eb94de8b..53d9090fc 100755
--- a/bin/wv-options-merge
+++ b/bin/wv-options-merge
@@ -61,6 +61,8 @@ file_count = 0
for root, dirs, files in os.walk(input_dir):
for file in sorted(files):
try:
+ if not file.endswith(".json"):
+ continue
file_count += 1
with open(os.path.join(root, file)) as fp:
data = json.load(fp)