Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Clean up project structure and simplify build scripts

Jo Spraguec4bf89bd9ebb
diff --git a/Gruntfile.js b/Gruntfile.js
index 927f7eccf..9770d9adc 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -15,7 +15,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean'); // Used to remove build artifacts
grunt.loadNpmTasks('grunt-contrib-copy'); // Used to move build artifacts around
grunt.loadNpmTasks('grunt-exec'); // Used to run bash scripts
- grunt.loadNpmTasks('grunt-git-rev-parse'); // Used to get commit hashes
grunt.loadNpmTasks('grunt-markdown'); // Used to convert md files to html
grunt.loadNpmTasks('grunt-mkdir'); // Used to make build directories
grunt.loadNpmTasks('grunt-text-replace'); // Used to replace token strings
@@ -23,25 +22,12 @@ module.exports = function(grunt) {
var hasCustomOptions = fs.existsSync('options');
var optionsPath = hasCustomOptions ? 'options' : 'node_modules/worldview-options-eosdis';
- // 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,
optionsPath: optionsPath,
- apache_version: grunt.option('apache-version') || '22',
copy: {
- apache: {
- src: 'etc/dev/worldview-dev.httpd<%=apache_version%>.conf',
- dest: 'dist/<%=grunt.option("packageName")%>.conf'
- },
brand_info: {
files: [
@@ -68,29 +54,6 @@ module.exports = function(grunt) {
]
},
- rpm_sources: {
- files: [
- {
- expand: true,
- cwd: 'deploy/sources',
- src: ['**'],
- dest: 'build/rpmbuild/SOURCES'
- }, {
- expand: true,
- cwd: 'deploy',
- src: ['worldview.spec'],
- dest: 'build/rpmbuild/SPECS'
- }, {
- expand: true,
- cwd: 'dist',
- src: [
- 'site-<%=grunt.option("packageName")%>.tar.bz2', 'site-<%=grunt.option("packageName")%>-debug.tar.bz2', 'worldview-config.tar.bz2'
- ],
- dest: 'build/rpmbuild/SOURCES'
- }
- ]
- },
-
// Copies the source files to the build directory
source: {
files: [
@@ -132,63 +95,6 @@ module.exports = function(grunt) {
}
},
- dist_config_versioned: {
- files: [
- {
- src: 'dist/worldview-config.tar.bz2',
- dest: 'dist/worldview-config.git<%= grunt.config.get("config-revision") %>.tar.bz2'
- }
- ]
- },
-
- dist_site_debug_versioned: {
- files: [
- {
- src: 'dist/site-<%=grunt.option("packageName")%>-debug.tar.bz2',
- dest: 'dist/site-<%=grunt.option("packageName")%>-debug' + '-<%=pkg.version%>' + '-<%=pkg.release%>' + '.tar.bz2'
- }
- ]
- },
-
- dist_site_release_versioned: {
- files: [
- {
- src: 'dist/site-<%=grunt.option("packageName")%>.tar.bz2',
- dest: 'dist/site-<%=grunt.option("packageName")%>' + '-<%=pkg.version%>' + '-<%=pkg.release%>' + '.tar.bz2'
- }
- ]
- },
-
- dist_source_debug_versioned: {
- files: [
- {
- src: 'dist/worldview-debug.tar.bz2',
- dest: 'dist/worldview-debug' + '-<%=pkg.version%>' + '-<%=pkg.release%>' + '.git<%= grunt.config.get("source-revision") %>' + '.tar.bz2'
- }
- ]
- },
-
- dist_source_release_versioned: {
- files: [
- {
- src: 'dist/worldview.tar.bz2',
- dest: 'dist/worldview' + '-<%=pkg.version%>' + '-<%=pkg.release%>' + '.git<%= grunt.config.get("source-revision") %>' + '.tar.bz2'
- }
- ]
- },
-
- rpm: {
- files: [
- {
- expand: true,
- flatten: true,
- cwd: 'build/rpmbuild',
- src: ['**/*.rpm'],
- dest: 'dist'
- }
- ]
- },
-
site: {
files: [
{
@@ -231,51 +137,24 @@ module.exports = function(grunt) {
exec: {
- // After removing JavaScript and CSS files that are no longer
- // need in a release build, there are a lot of empty directories.
- // Remove all of them.
- empty: {
- command: findCmd
- },
-
- rpmbuild: {
- command: 'rpmbuild --define "_topdir $PWD/build/rpmbuild" ' + '-ba build/rpmbuild/SPECS/worldview.spec'
- },
-
tar_config: {
- command: 'tar -C build -cjf dist/worldview-config.tar.bz2 ' + 'options'
+ command: 'tar -C build -cjf dist/worldview-config.tar.bz2 options'
},
tar_site_debug: {
- command: 'tar cjCf build dist/site-<%=grunt.option("packageName")%>-debug.tar.bz2 ' + 'site-<%=grunt.option("packageName")%>-debug'
+ command: 'tar cjCf build dist/site-<%=grunt.option("packageName")%>-debug.tar.bz2 site-<%=grunt.option("packageName")%>-debug'
},
tar_site_release: {
- command: 'tar cjCf build dist/site-<%=grunt.option("packageName")%>.tar.bz2 ' + 'site-<%=grunt.option("packageName")%>'
+ command: 'tar cjCf build dist/site-<%=grunt.option("packageName")%>.tar.bz2 site-<%=grunt.option("packageName")%>'
},
tar_source_debug: {
- command: 'tar cjCf build dist/worldview-debug.tar.bz2 ' + 'worldview-debug'
+ command: 'tar cjCf build dist/worldview-debug.tar.bz2 worldview-debug'
},
tar_source_release: {
- command: 'tar cjCf build dist/worldview.tar.bz2 ' + 'worldview'
- }
- },
-
- 'git-rev-parse': {
- source: {
- options: {
- prop: 'source-revision',
- number: 6
- }
- },
- config: {
- options: {
- prop: 'config-revision',
- cwd: '<%= optionsPath %>',
- number: 6
- }
+ command: 'tar cjCf build dist/worldview.tar.bz2 worldview'
}
},
@@ -291,7 +170,7 @@ module.exports = function(grunt) {
}
],
options: {
- template: 'deploy/metadata.template.html'
+ template: 'templates/metadata.html'
}
},
new: {
@@ -305,7 +184,7 @@ module.exports = function(grunt) {
}
],
options: {
- template: 'deploy/new.template.html'
+ template: 'templates/new.html'
}
}
},
@@ -315,11 +194,6 @@ module.exports = function(grunt) {
options: {
create: ['dist']
}
- },
- rpmbuild: {
- options: {
- create: ['build/rpmbuild']
- }
}
},
@@ -348,30 +222,13 @@ module.exports = function(grunt) {
],
build_site: [
'build/site-<%=grunt.option("packageName")%>-debug', 'build/site-<%=grunt.option("packageName")%>'
- ],
- dist_rpm: ['dist/*.rpm'],
- rpmbuild: ['build/rpmbuild']
+ ]
},
replace: {
- apache: {
- src: ['dist/<%=grunt.option("packageName")%>.conf'],
- overwrite: true,
- replacements: [
- {
- from: '@WORLDVIEW@',
- to: '<%=grunt.option("packageName")%>'
- }, {
- from: '@ROOT@',
- to: process.cwd()
- }
- ]
- },
- rpm_sources: {
- src: [
- 'build/rpmbuild/SOURCES/*', 'build/rpmbuild/SPECS/*', '!**/*.tar.bz2'
- ],
+ rpm_placeholders: {
+ src: ['build/rpm/SPECS/worldview.spec'],
overwrite: true,
replacements: [
{
@@ -440,27 +297,20 @@ module.exports = function(grunt) {
});
grunt.registerTask('build', [
- 'clean:build_source', // Clear some directories
- 'git-rev-parse:source', // Get commit hash
'copy:source', // Copy source files into build/worldview-debug
'clean:source', // Removes unneccesary assets from build directory
- 'exec:empty', // Delete empty directories in the build
'copy:release', // Copy build/worldview-debug into build/worldview
'mkdir:dist', // Make dist directory
'exec:tar_source_debug', // Make worldview-debug tar from /build
- 'copy:dist_source_debug_versioned', // Add version number and hash to copy of tar
- 'exec:tar_source_release', // Make worldview-debug tar from /build
- 'copy:dist_source_release_versioned' // Add version number and hash to copy of tar
+ 'exec:tar_source_release' // Make worldview-debug tar from /build
]);
grunt.registerTask('config', [
- 'git-rev-parse:config', // Get commit hash
'markdown', // Parse metadata and pages md files into html
'copy:config_src', // Copy build results to web/config and web/brand
'copy:brand_info', // Copy brand config file to build directory
'mkdir:dist', // Make dist directory
- 'exec:tar_config', // Create worldview-config tar from options directory
- 'copy:dist_config_versioned' // Create copy of tar with version number
+ 'exec:tar_config' // Create worldview-config tar from options directory
]);
grunt.registerTask('site', [
@@ -469,26 +319,14 @@ module.exports = function(grunt) {
'copy:site', // Copy /worldview and /worldview-config builds to /build/site
'replace:tokens', // Replace string placeholders in JS and HTML (no CSS)
'exec:tar_site_debug', // Create debug tar
- 'copy:dist_site_debug_versioned', // Create debug tar with version number
- 'exec:tar_site_release', // Create release tar
- 'copy:dist_site_release_versioned' // Create release tar with version number
+ 'exec:tar_site_release' // Create release tar
]);
- grunt.registerTask('rpm-only', [
+ grunt.registerTask('rpm-placeholders', [
'load_branding', // Set grunt variables from built options file
- 'git-rev-parse:source', // Get commit hash
- 'clean:rpmbuild', // Remove build/rpmbuild directory
- 'mkdir:rpmbuild', // Create build/rpmbuild directory
- 'copy:rpm_sources', // Copy sources needed to build/rpmbuild
- 'replace:rpm_sources', // Replace name, version, release and build numbers in rpm
- 'clean:dist_rpm', // Remove any existing .rpm files
- 'exec:rpmbuild', // Run the command to build the rpm
- 'copy:rpm' // Copy rpm files to /dist
+ 'replace:rpm_placeholders' // Replace strings in rpm sources
]);
- // Set grunt variables, move .conf file to /dist and replace @WORLDVIEW@ and @ROOT@
- grunt.registerTask('apache-config', ['load_branding', 'copy:apache', 'replace:apache']);
-
grunt.registerTask('default', [
'build', // Copy assets to build directories and generate tar files
'config', // Build options artifacts and put them in build, dist, web
diff --git a/app.js b/app.js
deleted file mode 100644
index cb1dac38e..000000000
--- a/app.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var express = require('express');
-var path = require('path');
-var app = express();
-app.use(express.static(path.join(__dirname, 'web')));
-module.exports = app;
diff --git a/bin/act2wv b/bin/act2wv
deleted file mode 100755
index 0c43aa475..000000000
--- a/bin/act2wv
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env python
-
-import os
-from optparse import OptionParser
-import sys
-import json
-
-prog = os.path.basename(__file__)
-basedir = os.path.dirname(__file__)
-version = "1.2.0"
-help_description = """\
-Using a json index file, this converts ACT (Adobe Color Table) files into
-paletttes suitable for Worldview. Each color table is written out to
-a separate file.
-"""
-
-default_index = os.path.join(basedir, "act", "index.json")
-default_act_dir = os.path.join(basedir, "act")
-
-parser = OptionParser(usage="Usage: %s [options] <output_dir>" % prog,
- version="%s version %s" % (prog, version),
- epilog=help_description)
-parser.add_option("-a", "--act-dir", default=default_act_dir,
- help="use this as the base directory for ACT files "
- "instead of %s" % default_act_dir)
-parser.add_option("-i", "--index", default=default_index,
- help="use this index file instead of %s" % default_index)
-parser.add_option("-v", "--verbose", action="store_true",
- help="prints information about tasks being performed")
-
-(options, args) = parser.parse_args()
-
-def notify(message):
- if options.verbose:
- print "%s: %s" % (prog, message)
-
-def error(message):
- sys.stderr.write("%s: ERROR: %s\n" % (prog, message))
-
-def fatal(message):
- error(message)
- sys.exit(1)
-
-
-if len(args) != 1:
- parser.error("Invalid number of arguments")
-output_dir = args[0]
-
-if not os.path.exists(options.index):
- fatal("Index file %s does not exist" % options.index)
-if not os.path.exists(options.act_dir):
- fatal("ACT base directory %s does not exist" % options.act_dir)
-if not os.path.exists(output_dir):
- fatal("Output directory %s does not exist" % output_dir)
-
-notify("Index file: %s" % options.index)
-notify("ACT base directory: %s" % options.act_dir)
-notify("Output directory: %s" % output_dir)
-
-try:
- with open(options.index) as fp:
- index = json.load(fp)
-except Exception as e:
- sys.stderr.write("%s: Unable to load index %s\n%s" % (prog, options.index,
- str(e)))
- sys.exit(1)
-
-return_code = 0
-for act in index:
- act_file = os.path.join(options.act_dir, act["input"])
- notify("Reading ACT: %s" % act_file)
- try:
- with open(act_file) as fp:
- data = fp.read()
- except Exception as e:
- sys.stderr.write("%s: Unable to load %s\n%s" % (prog, act_file,
- str(e)))
- return_code = 1
- stops = []
- for i in xrange(0, 255 * 3, 3):
- entry = {
- "at": str(i / 3.0 / 256.0),
- "r": ord(data[i]),
- "g": ord(data[i+1]),
- "b": ord(data[i+2]),
- "a": 255
- }
- stops += [entry]
- palette = {
- act["id"]: {
- "id": act["id"],
- "name": act["name"],
- "stops": stops
- }
- }
- palette_file = os.path.join(output_dir, "%s.json" % act["id"])
- notify("Writing palette: %s" % palette_file)
- with open(palette_file, "w") as fp:
- json.dump(palette, fp, sort_keys=True, indent=4,
- separators=(',', ': '))
-
-
-sys.exit(return_code)
diff --git a/bin/eventsGeoRssParser.py b/bin/eventsGeoRssParser.py
deleted file mode 100755
index cd7390c46..000000000
--- a/bin/eventsGeoRssParser.py
+++ /dev/null
@@ -1,341 +0,0 @@
-#!/usr/bin/python
-
-import feedparser, logging, logging.config
-import urllib2, urllib, shutil, urlparse, os, zipfile, os.path, re, json
-# CentOS uses 2.6, argparse starts with 2.7
-from optparse import OptionParser
-import sys
-from zipfile import ZipFile as zip
-from zipfile import BadZipfile
-from bs4 import BeautifulSoup
-from osgeo import gdal
-
-baseDir = os.path.join(os.path.dirname(__file__), '..')
-
-parser = OptionParser()
-parser.add_option("-d", "--development", action="store_true",
- help="Use the source tree instead of the system directories")
-parser.add_option("-f", "--feed",
- help="Use file as feed instead of Earth Observatory")
-(options, args) = parser.parse_args()
-
-mockFeed = None
-imgURI = "var/images"
-if options.feed:
- # Read in the entire feed before changing directories
- with open(options.feed) as fp:
- mockFeed = fp.read()
-if options.development:
- print 'Development mode'
- # Log configuration assume working from this directory
- os.chdir(baseDir)
- confDir = 'etc/config'
- libDir = 'src/var'
- imgDir = 'src/var/images'
-else:
- confDir = '/etc/worldview'
- libDir = '/var/lib/worldview'
- imgDir = '/var/lib/worldview/images'
- os.chdir('/tmp')
-
-# ===================================================================
-# Log Configuration
-# ===================================================================
-logConfFile = os.path.join(confDir, 'events_log.conf')
-if not os.path.exists(logConfFile):
- sys.stderr.write('No such file: %s\n' % logConfFile)
- sys.exit(1)
-logging.config.fileConfig(logConfFile)
-accessLog = logging.getLogger('eventsAccess')
-errorLog = logging.getLogger('eventsErrors')
-debugLog = logging.getLogger('eventsDebug')
-
-# ===================================================================
-# GeoRSS Processing
-# ===================================================================
-
-# Pulls the GeoRSS feed and returns a list of entries.
-# @param url - the URL of the GeoRSS feed
-# @return - an array of GeoRSS entries
-def pullRss(url):
- feed = feedparser.parse(url)
- if feed:
- accessLog.info('Successful pull: %s', url)
- return feed["items"]
- else:
- accessLog.info('Failed pull: %s', url)
- return None
-
-# Find the link to the first tif image (if present).
-# @param soup - the content of the entry's story
-# @return - the link to the GeoTif image (if present)
-def findTiff(soup):
- t = soup.find(href=re.compile("tif"))
- if t:
- return t.get("href")
- else:
- return None
-
-# Find the link to the first kmz image (if present).
-# @param soup - the content of the entry's story
-# @return - the link to the KMZ image (if present)
-def findKmz(soup):
- k = soup.find(href=re.compile("kmz"))
- if k:
- return k.get("href")
- else:
- return None
-
-# Extract the KMZ file with the given file name.
-# @param zipname - the name of the zip file
-# @return - the relative path to the KML file
-def extractKmz(zipname):
- try:
- z = zip(zipname)
- f = z.namelist()[0]
- if f.endswith('/'):
- os.makedirs(f)
- else:
- z.extract(f)
- return f
- except BadZipfile as e:
- errorLog.error('(extractKmz) Bad Zipfile: %s', zipname)
- return None
- except OSError as e:
- errorLog.error('(extractKmz) %s: %s', e.strerror, e.filename)
- return None
- except IOError as e:
- errorLog.error('(extractKmz) %s: %s', e.strerror, e.filename)
- return None
-
-# Download a file from the given link.
-# @param url - the link to the file (KMZ or GeoTiff)
-# @param fileName - the filename
-# @return - the filename
-def download(url, fileName=None):
- def getFileName(url, openUrl):
- if 'Content-Disposition' in openUrl.info():
- # If the response has Content-Disposition, try to get the
- # filename from it
- cd = dict(map(
- lambda x: x.strip().split('=') if '=' in x else (x.strip(),''),
- openUrl.info()['Content-Disposition'].split(';')))
- if 'filename' in cd:
- filename = cd['filename'].strip("\"'")
- if filename: return filename
-
- # if no filename was found above, parse it out of the final URL
- filename = os.path.basename(urlparse.urlsplit(openUrl.url)[2])
- return filename
-
- r = urllib2.urlopen(urllib2.Request(url))
- try:
- fileName = fileName or getFileName(url, r)
- with open(fileName, 'wb') as f:
- shutil.copyfileobj(r,f)
-
- finally:
- r.close()
-
-
-# Parse the entry and return a JSON representation
-# @param entry - a GeoRSS entry
-# @return - a JSON description of the GeoRss entry
-def processEntry(entry):
-
- title = entry["title"]
-
- # check satellite/instrument - if not MODIS, skip
- if not any("tags" in n for n in entry):
- debugLog.debug('skipping because no tags')
- return None
-
- tags = entry["tags"]
- if len(tags) < 2:
- debugLog.debug('skipping because too few tags: %s' % title)
- return None
-
- parts = tags[1].term.split("/")
- sat = parts[0]
- instrument = parts[1]
- if instrument != "MODIS":
- debugLog.debug('skipping because of instrument')
- return None
-
- coords = True
-
- # check for KMZ or GeoTiff - if not present, skip
- story = entry["link"]
- page = urllib2.urlopen(story)
- # Use external parser because the default one doesn't seem to work
- # with Python on OS X.
- content = BeautifulSoup(page, "lxml")
- north = ""
- south = ""
- east = ""
- west = ""
-
- # check for KMZ
- kmzLink = findKmz(content)
- kmzSuccess = True
- if kmzLink:
- temp_kmz = "temp_kmz"
- download(kmzLink, temp_kmz)
- kmlFileName = extractKmz(temp_kmz)
- if kmlFileName:
- kmlFile = open(kmlFileName, 'r')
- content = BeautifulSoup(kmlFile)
- box = content.find('latlonbox')
- north = box.find('north').getText()
- south = box.find('south').getText()
- east = box.find('east').getText()
- west = box.find('west').getText()
-
- # cleanup temp directory
- try:
- kmlDir = kmlFileName.rpartition('/')[0]
- os.remove(kmlFileName)
- os.removedirs(kmlDir)
- except OSError as e:
- errorLog.error('(processEntry) %s: %s', e.strerror, e.filename)
-
- else:
- kmzSuccess = False
-
- try:
- os.remove(temp_kmz)
- except OSError as e:
- errorLog.error('(processEntry) %s: %s', e.strerror, e.filename)
-
- else:
- kmzSuccess = False
-
- # check for GeoTiff
- if kmzSuccess == False:
- tiffLink = findTiff(content)
- if tiffLink:
- temp_tiff = "temp_tiff"
- download(tiffLink, temp_tiff)
- ds = gdal.Open(temp_tiff)
- width = ds.RasterXSize
- height = ds.RasterYSize
- gt = ds.GetGeoTransform()
- west = gt[0]
- south = gt[3] + width*gt[4] + height*gt[5]
- east = gt[0] + width*gt[1] + height*gt[2]
- north = gt[3]
-
- # cleanup temp file
- try:
- os.remove(temp_tiff)
- except OSError as e:
- errorLog.error('(processEntry) %s: %s', e.strerror, e.filename)
-
- else:
- coords = False
-
- # if the entry is kept, parse the rest of the fields
- date = entry["date"].split("T")[0]
- title = entry["title"]
- description = entry["summary_detail"].value
-
- # save the thumbnail
- thumbnailLink = entry["media_thumbnail"][0].get("url")
- thumbnailName = thumbnailLink.split('/')[-1]
- if not os.path.exists(imgDir):
- os.mkdir(imgDir)
- thumbnail = os.path.join(imgDir, thumbnailName)
- worldviewThumbnailURI = os.path.join(imgURI, thumbnailName)
- urllib.urlretrieve(thumbnailLink, thumbnail)
-
- pubData = entry["published"]
- point = entry["georss_point"]
- keyword = ''
-
- # if the category is a fire or flood, look for keywords
- # about the base layer and overlay
- category = entry["tags"][0].term
- lowerContent = content.getText().lower()
- if category == 'Floods':
- if lowerContent.count('natural-color') > 0:
- keyword = 'natural-color'
- if lowerContent.count('natural color') > 0:
- keyword = 'natural-color'
- if category == 'Fires':
- if lowerContent.count('red outlines') > 0:
- keyword = 'outlines'
-
- retobj = {
- 'title':title,
- 'date':date,
- 'description':description,
- 'category':category,
- 'satellite':sat,
- 'instrument':instrument,
- 'thumbnail':worldviewThumbnailURI,
- 'link':story,
- 'north':north,
- 'south':south,
- 'east':east,
- 'west':west,
- 'keyword':keyword,
- 'pubDate':pubData,
- 'point':point,
- 'coords':coords}
-
- return retobj
-
-# Driver
-def main():
- if not mockFeed:
- entries = pullRss("http://www.earthobservatory.nasa.gov/Feeds/rss/nh.rss")
- else:
- entries = pullRss(mockFeed)
- num = 0
- recent_titles = []
- data = []
-
- outFileName = os.path.join(libDir, 'events_data.json')
- # get existing data to make sure we aren't adding duplicates
- if os.path.exists(outFileName):
- outfile = open(outFileName, 'r+w')
- try:
- data = json.load(outfile)
- last_len = 0
- if len(data) < len(entries):
- last_len = len(data) * -1
- else:
- last_len = len(entries) * -1
- recent_entries = data[last_len:]
-
- for r in recent_entries:
- recent_titles.append(r["title"])
-
- except ValueError:
- pass
-
- else:
- outfile = open(outFileName, 'w+');
-
- for e in entries:
- obj = processEntry(e)
- if obj:
- if not obj["title"] in recent_titles:
- debugLog.debug("selected: %s" % obj["title"])
- data.append(obj)
- num = num + 1
- else:
- debugLog.debug("already seen: %s" % obj["title"])
-
- outfile.seek(0)
- if len(data) < 100:
- json.dump(data, outfile)
- else:
- json.dump(data[-100:], outfile)
- outfile.truncate()
- outfile.close()
-
-try:
- main()
-except Exception as e:
- errorLog.error("Unhandled exception: %s" % str(e))
diff --git a/bin/filter-test-report b/bin/filter-test-report
deleted file mode 100755
index 1970bfab0..000000000
--- a/bin/filter-test-report
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-
-filtered = True
-for line in sys.stdin:
- if line.startswith("<?xml"):
- filtered = False
- if not filtered:
- sys.stdout.write(line)
- if line.startswith("</testsuites>") or line.startswith("</checkstyle>"):
- filtered = True
diff --git a/config.sh b/config.sh
deleted file mode 100644
index 53de597b4..000000000
--- a/config.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-# Reset build and dist directories
-rm -rf build
-rm -rf dist
-
-echo "Installing Dependencies"
-if ! npm install ; then
- echo "ERROR: \"npm install\" failed" &>2
- exit 1
-fi
-echo "Building Options Repo"
-if ! npm run updateconfig ; then
- echo "ERROR: \"npm run updateconfig\" failed" &>2
- exit 1
-fi
diff --git a/deploy/mock_install.sh b/deploy/mock_install.sh
deleted file mode 100755
index 46ac40530..000000000
--- a/deploy/mock_install.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-BASEDIR=$(dirname "$0")/../..
-
-sudo /etc/init.d/httpd stop
-mock --init
-mock --install yum
-mock --copyin $BASEDIR/dist/worldview-*.noarch.rpm /
-mock --shell 'yum install *.rpm'
-mock --shell '/etc/init.d/httpd start'
diff --git a/deploy/mock_uninstall.sh b/deploy/mock_uninstall.sh
deleted file mode 100755
index e2f2d38ff..000000000
--- a/deploy/mock_uninstall.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-mock --shell '/etc/init.d/httpd stop'
-mock --clean
diff --git a/deploy/sources/cron.worldview b/deploy/sources/cron.worldview
deleted file mode 100644
index ecced583d..000000000
--- a/deploy/sources/cron.worldview
+++ /dev/null
@@ -1 +0,0 @@
-0 * * * * apache /usr/share/@WORLDVIEW@/bin/eventsGeoRssParser.py 2>&1 >/dev/null
diff --git a/deploy/sources/cron.worldview-debug b/deploy/sources/cron.worldview-debug
deleted file mode 100644
index ccb793c8e..000000000
--- a/deploy/sources/cron.worldview-debug
+++ /dev/null
@@ -1 +0,0 @@
-0 * * * * apache /usr/share/@WORLDVIEW@-debug/bin/eventsGeoRssParser.py 2>&1 >/dev/null
diff --git a/deploy/sources/events_log-debug.conf b/deploy/sources/events_log-debug.conf
deleted file mode 100644
index 35aa82c40..000000000
--- a/deploy/sources/events_log-debug.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-[loggers]
-keys=root,access,error,debug
-
-[handlers]
-keys=access,error,debug
-
-[formatters]
-keys=basicFormatter
-
-[logger_root]
-level=DEBUG
-handlers=""
-
-[logger_access]
-level=DEBUG
-handlers=access
-qualname=eventsAccess
-propagate=0
-
-[logger_error]
-level=DEBUG
-handlers=error
-qualname=eventsErrors
-propagate=0
-
-[logger_debug]
-level=DEBUG
-handlers=debug
-qualname=eventsDebug
-propagate=0
-
-[handler_access]
-class=FileHandler
-level=DEBUG
-formatter=basicFormatter
-args=('/var/log/@WORLDVIEW@-debug/events_access.log','a+')
-
-[handler_error]
-class=FileHandler
-level=DEBUG
-formatter=basicFormatter
-args=('/var/log/@WORLDVIEW@-debug/events_errors.log', 'a+')
-
-[handler_debug]
-class=FileHandler
-level=DEBUG
-formatter=basicFormatter
-args=('/var/log/@WORLDVIEW@-debug/events_messages.log', 'a+')
-
-[formatter_basicFormatter]
-format=%(asctime)s %(message)s
diff --git a/deploy/sources/events_log.conf b/deploy/sources/events_log.conf
deleted file mode 100644
index 0564ee697..000000000
--- a/deploy/sources/events_log.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-[loggers]
-keys=root,access,error,debug
-
-[handlers]
-keys=access,error,debug
-
-[formatters]
-keys=basicFormatter
-
-[logger_root]
-level=DEBUG
-handlers=""
-
-[logger_access]
-level=DEBUG
-handlers=access
-qualname=eventsAccess
-propagate=0
-
-[logger_error]
-level=DEBUG
-handlers=error
-qualname=eventsErrors
-propagate=0
-
-[logger_debug]
-level=DEBUG
-handlers=debug
-qualname=eventsDebug
-propagate=0
-
-[handler_access]
-class=FileHandler
-level=DEBUG
-formatter=basicFormatter
-args=('/var/log/@WORLDVIEW@/events_access.log','a+')
-
-[handler_error]
-class=FileHandler
-level=DEBUG
-formatter=basicFormatter
-args=('/var/log/@WORLDVIEW@/events_errors.log', 'a+')
-
-[handler_debug]
-class=FileHandler
-level=DEBUG
-formatter=basicFormatter
-args=('/var/log/@WORLDVIEW@/events_messages.log', 'a+')
-
-[formatter_basicFormatter]
-format=%(asctime)s %(message)s
diff --git a/deploy/sources/logrotate.worldview b/deploy/sources/logrotate.worldview
deleted file mode 100644
index 7929e63bb..000000000
--- a/deploy/sources/logrotate.worldview
+++ /dev/null
@@ -1,8 +0,0 @@
-/var/log/@WORLDVIEW@/*.log {
- copytruncate
- weekly
- rotate 4
- compress
- missingok
- create 0664 apache apache
-}
diff --git a/deploy/sources/logrotate.worldview-debug b/deploy/sources/logrotate.worldview-debug
deleted file mode 100644
index 14f5de4f1..000000000
--- a/deploy/sources/logrotate.worldview-debug
+++ /dev/null
@@ -1,8 +0,0 @@
-/var/log/@WORLDVIEW@-debug/*.log {
- copytruncate
- weekly
- rotate 4
- compress
- missingok
- create 0664 apache apache
-}
diff --git a/deploy/system_purge.sh b/deploy/system_purge.sh
deleted file mode 100755
index 8c28848e8..000000000
--- a/deploy/system_purge.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-sudo rm -rf /var/lib/worldview
-sudo rm -rf /var/log/worldview
diff --git a/deploy/worldview.spec b/deploy/worldview.spec
deleted file mode 100644
index 0d5273e76..000000000
--- a/deploy/worldview.spec
+++ /dev/null
@@ -1,183 +0,0 @@
-# Note: This does not do a "proper" build. It is assumed that the distribution
-# package has already been made.
-
-# Turn off the brp-python-bytecompile script
-%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
-
-Name: @WORLDVIEW@
-Version: @BUILD_VERSION@
-Release: @BUILD_RELEASE@.@BUILD_NUMBER@%{?dist}
-Summary: Browse full-resolution, near real-time satellite imagery.
-
-License: Copyright NASA
-URL: http://earthdata.nasa.gov
-Source0: site-@[email protected]
-Source1: site-@[email protected]
-Source3: httpd.conf
-Source4: httpd-debug.conf
-#Source4: events_log.conf
-#Source4: events_log-debug.conf
-#Source5: cron.worldview
-#Source6: cron.worldview-debug
-#Source7: logrotate.worldview
-#Source8: logrotate.worldview-debug
-
-BuildArch: noarch
-Requires: httpd
-#Requires: python-feedparser
-#Requires: python-beautifulsoup4
-#Requires: gdal
-#Requires: gdal-python
-
-%description
-In essence, Worldview shows the entire Earth as it looks "right now",
-or at least as it has looked within the past few hours. Worldview
-supports time-critical application areas such as wildfire management,
-air quality measurements, and weather forecasting.
-
-The imagery is generally available within three hours of observation
-and can easily be compared to observations from the past - just click
-or drag the time sliders at the bottom of the page. Imagery is
-available from May 2012 onward and we are working to provide access to
-earlier dates. Arctic and Antarctic polar stereographic views of
-several products are also available for a "full globe" perspective.
-
-
-%package debug
-Summary: Non-minified version of Worldview for debugging
-
-
-%description debug
-Non-minified version of Worldview for debugging
-
-
-%global httpdconfdir %{_sysconfdir}/httpd/conf.d
-
-%prep
-%setup -c -T
-tar xf %{SOURCE0}
-tar xf %{SOURCE1}
-cp %{SOURCE3} .
-cp %{SOURCE4} .
-#cp %{SOURCE4} .
-#cp %{SOURCE5} .
-#cp %{SOURCE6} .
-#cp %{SOURCE7} .
-#cp %{SOURCE8} .
-
-
-%build
-
-
-%install
-rm -rf %{buildroot}
-
-#chmod 755 @WORLDVIEW@/bin/*
-#chmod 755 @WORLDVIEW@-debug/bin/*
-
-# Apache configuration for release
-install -m 755 -d %{buildroot}/%{httpdconfdir}
-install -m 644 httpd.conf \
- %{buildroot}/%{httpdconfdir}/@[email protected]
-rm httpd.conf
-
-# Apache configuration for debug
-install -m 644 httpd-debug.conf \
- %{buildroot}/%{httpdconfdir}/@[email protected]
-rm httpd-debug.conf
-
-# Release application
-install -m 755 -d %{buildroot}/%{_datadir}/@WORLDVIEW@
-cp -r site-@WORLDVIEW@/* %{buildroot}/%{_datadir}/@WORLDVIEW@
-
-# Debug application
-install -m 755 -d %{buildroot}/%{_datadir}/@WORLDVIEW@-debug
-cp -r site-@WORLDVIEW@-debug/* %{buildroot}/%{_datadir}/@WORLDVIEW@-debug
-
-#install -m 755 -d %{buildroot}/%{_sysconfdir}/@WORLDVIEW@
-#install -m 644 events_log.conf \
-# %{buildroot}/%{_sysconfdir}/@WORLDVIEW@/events_log.conf
-#install -m 755 -d %{buildroot}/%{_sysconfdir}/@WORLDVIEW@-debug
-#install -m 644 events_log-debug.conf \
-# %{buildroot}/%{_sysconfdir}/@WORLDVIEW@-debug/events_log-debug.conf
-
-#install -m 755 -d %{buildroot}/%{_sharedstatedir}/@WORLDVIEW@
-#install -m 755 -d %{buildroot}/%{_sharedstatedir}/@WORLDVIEW@-debug
-#install -m 755 -d %{buildroot}/%{_localstatedir}/log/@WORLDVIEW@
-#install -m 755 -d %{buildroot}/%{_localstatedir}/log/@WORLDVIEW@-debug
-
-#install -m 755 -d %{buildroot}/%{_sysconfdir}/cron.d
-#install -m 600 cron.worldview %{buildroot}/%{_sysconfdir}/cron.d/@WORLDVIEW@
-#install -m 600 cron.worldview-debug %{buildroot}/%{_sysconfdir}/cron.d/@WORLDVIEW@-debug
-
-#install -m 755 -d %{buildroot}/%{_sysconfdir}/logrotate.d
-#install -m 600 logrotate.worldview \
-# %{buildroot}/%{_sysconfdir}/logrotate.d/@WORLDVIEW@
-#install -m 600 logrotate.worldview-debug \
-# %{buildroot}/%{_sysconfdir}/logrotate.d/@WORLDVIEW@-debug
-
-
-%clean
-rm -rf %{buildroot}
-
-
-%files
-%defattr(-,root,root,-)
-%{_datadir}/@WORLDVIEW@
-%config(noreplace) %{httpdconfdir}/@[email protected]
-#%config(noreplace) %{_sysconfdir}/@WORLDVIEW@/events_log.conf
-#%config(noreplace) %{_sysconfdir}/cron.d/@WORLDVIEW@
-#%config(noreplace) %{_sysconfdir}/logrotate.d/@WORLDVIEW@
-
-#%defattr(600,apache,apache,700)
-#%dir %{_sharedstatedir}/@WORLDVIEW@
-#%dir %{_localstatedir}/log/@WORLDVIEW@
-
-
-%files debug
-%{_datadir}/@WORLDVIEW@-debug
-%config(noreplace) %{httpdconfdir}/@[email protected]
-#%config(noreplace) %{_sysconfdir}/@WORLDVIEW@-debug/events_log-debug.conf
-#%config(noreplace) %{_sysconfdir}/cron.d/@WORLDVIEW@-debug
-#%config(noreplace) %{_sysconfdir}/logrotate.d/@WORLDVIEW@-debug
-
-#%defattr(600,apache,apache,700)
-#%dir %{_sharedstatedir}/@WORLDVIEW@-debug
-#%dir %{_localstatedir}/log/@WORLDVIEW@-debug
-
-
-%post
-if [ $1 -gt 0 ] ; then
- if /sbin/service httpd status >/dev/null ; then
- /sbin/service httpd reload
- fi
-fi
-
-%post debug
-if [ $1 -gt 0 ] ; then
- if /sbin/service httpd status >/dev/null ; then
- /sbin/service httpd reload
- fi
-fi
-
-%postun
-if [ $1 -eq 0 ] ; then
- if /sbin/service httpd status >/dev/null ; then
- /sbin/service httpd reload
- fi
-fi
-
-%postun debug
-if [ $1 -eq 0 ] ; then
- if /sbin/service httpd status >/dev/null ; then
- /sbin/service httpd reload
- fi
-fi
-
-
-%changelog
-* Wed Oct 30 2013 Mike McGann <[email protected]> - 0.6.0-1
-- Worldview 0.6.0 release
-
-* Thu May 9 2013 Mike McGann <[email protected]> - 0.4.5-1
-- Initial package
diff --git a/doc/build.md b/doc/build.md
index 715105948..3f8b2cf13 100644
--- a/doc/build.md
+++ b/doc/build.md
@@ -1,15 +1,3 @@
# Build
-There are three build major processes involved prior to deployment.
-
-## Worldview Master
-
-Master build is run on updates to the worldview master codebase. The core tasks that are run during this build can be found/edited in `master.sh`
-
-## Worldview Options
-
-The Worldview Options build is run when updates to the worldview options repository have been made. The core tasks that are run during this build can be found/edited in `config.sh`
-
-## Site Build
-
-The Site-Build build is run after either the completion of the Worldview Options or Master builds. The core tasks that are run during this build can be found/edited in `site_build.sh`
+To build the app for deployment, run the included `tasks/buildAll.sh`. This will build the app and generate `.tar.bz2` files and an `.rpm` file which can be used to deploy the app.
diff --git a/doc/developing.md b/doc/developing.md
index 53fb97736..c516db66b 100644
--- a/doc/developing.md
+++ b/doc/developing.md
@@ -48,6 +48,6 @@ We're in the process of replacing our Grunt tasks with npm scripts, but here are
`grunt site`* : Combines the results of `grunt config` and `grunt build` into final `/build` and `/dist` directories and generates `tar` files of the final build.
-`grunt rpm-only`: Creates an RPM on CentOS 6 and places it in the `/dist` directory.
+`grunt rpm-placeholders`: Replaces placeholder strings in rpm source files.
`grunt apache-config`* : Moves `worldview.conf` to the `/dist` directory for deployment to an Apache server.
diff --git a/etc/dev/worldview-dev.httpd22.conf b/etc/dev/worldview-dev.httpd22.conf
deleted file mode 100644
index 56ba20a25..000000000
--- a/etc/dev/worldview-dev.httpd22.conf
+++ /dev/null
@@ -1,10 +0,0 @@
-Alias /@WORLDVIEW@ @ROOT@/web
-Alias /@WORLDVIEW@-release @ROOT@/build/@WORLDVIEW@/web
-Alias /@WORLDVIEW@-debug @ROOT@/build/@WORLDVIEW@-debug/web
-
-<Directory @ROOT@>
- Options Indexes FollowSymLinks ExecCGI
- AllowOverride All
- Order allow,deny
- Allow from all
-</Directory>
diff --git a/etc/dev/worldview-dev.httpd24.conf b/etc/dev/worldview-dev.httpd24.conf
deleted file mode 100644
index f382155c3..000000000
--- a/etc/dev/worldview-dev.httpd24.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-Alias /@WORLDVIEW@ @ROOT@/web
-Alias /@WORLDVIEW@-release @ROOT@/build/site-@WORLDVIEW@/web
-Alias /@WORLDVIEW@-debug @ROOT@/build/site-@WORLDVIEW@-debug/web
-
-<Directory @ROOT@>
- Options Indexes FollowSymLinks ExecCGI
- AllowOverride All
- Require all granted
-</Directory>
diff --git a/deploy/sources/httpd-debug.conf b/httpd-debug.conf
similarity index 100%
rename from deploy/sources/httpd-debug.conf
rename to httpd-debug.conf
diff --git a/deploy/sources/httpd.conf b/httpd.conf
similarity index 100%
rename from deploy/sources/httpd.conf
rename to httpd.conf
diff --git a/master.sh b/master.sh
deleted file mode 100644
index b10bdabf1..000000000
--- a/master.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-
-# Reset build and dist directories
-rm -rf build
-rm -rf dist
-
-echo "Installing Dependencies"
-if ! npm install ; then
- echo "ERROR: \"npm install\" failed" &>2
- exit 1
-fi
-
-echo "Building Worldview CSS"
-if ! npm run build:css ; then
- echo "ERROR: \"npm run build:css\" failed" &>2
- exit 1
-fi
-
-echo "Building Worldview JavaScript"
-if ! npm run build:js ; then
- echo "ERROR: \"npm run build:js\" failed" &>2
- exit 1
-fi
-
-echo "Building Worldview Repo and generating tar files"
-if ! grunt build ; then
- echo "ERROR: \"grunt build\" failed" &>2
- exit 1
-fi
diff --git a/package-lock.json b/package-lock.json
index 1415f1e4a..4d74a6210 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5948,12 +5948,6 @@
"integrity": "sha1-QAUf+k6wyWV+BTuV6I1ENSocLCU=",
"dev": true
},
- "grunt-git-rev-parse": {
- "version": "0.1.5",
- "resolved": "https://registry.npmjs.org/grunt-git-rev-parse/-/grunt-git-rev-parse-0.1.5.tgz",
- "integrity": "sha1-ntSngs7jCa9DHiKXGX6vyTOQa80=",
- "dev": true
- },
"grunt-legacy-log": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/grunt-legacy-log/-/grunt-legacy-log-0.1.3.tgz",
diff --git a/package.json b/package.json
index 07ead2a08..3929341cd 100644
--- a/package.json
+++ b/package.json
@@ -17,24 +17,24 @@
"build": "run-s \"getcapabilities -- {1}\" \"build:config -- {1}\" --",
"postbuild": "run-p build:css build:js build:tests && grunt build site",
"build:css": "node ./tasks/buildCSS",
- "build:config": "bash -c 'bin/wv-options-build ${1}' 0",
+ "build:config": "bash -c 'tasks/buildOptions.sh ${1}' 0",
"postbuild:config": "grunt config",
"build:js": "node ./tasks/buildJS",
"build:tests": "node ./tasks/buildJS --tests",
"e2e": "run-s --continue-on-error --silent e2e:*",
"e2e:chrome": "nightwatch -e chrome",
"e2e:firefox": "nightwatch -e firefox --skiptags wip",
- "getcapabilities": "bash -c 'FETCH_GC=1 bin/wv-options-build ${1}' 0",
+ "getcapabilities": "bash -c 'FETCH_GC=1 tasks/buildOptions.sh ${1}' 0",
"lint": "run-s lint:*",
"lint:css": "stylelint ./web/css/**/*.css",
"lint:js": "eslint .",
- "preinstall": "node version-check.js",
+ "preinstall": "node tasks/checkNodeVersion.js",
"postinstall": "npm run python",
"python": "virtualenv .python && run-script-os",
"python:darwin:linux": "PATH=.python/bin:${PATH} pip install -r requirements.txt",
"python:win32": "bash -c 'PATH=.python/Scripts:${PATH} pip install -r requirements.txt'",
"report": "node e2e/create-report.js",
- "start": "node ./bin/www",
+ "start": "node ./tasks/start.js",
"test": "npm run lint && run-p test:server test:run",
"test:server": "buster-server -c",
"test:run": "sleep 2 && buster-test && npm run test:end",
@@ -82,7 +82,6 @@
"grunt-contrib-clean": "1.0.x",
"grunt-contrib-copy": "1.0.x",
"grunt-exec": "0.4.x",
- "grunt-git-rev-parse": "0.1.x",
"grunt-markdown": "0.7.x",
"grunt-mkdir": "0.1.x",
"grunt-text-replace": "0.4.x",
diff --git a/site_build.sh b/site_build.sh
deleted file mode 100644
index 8e252177c..000000000
--- a/site_build.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/bash
-
-echo "Copying Config Artifacts to dist"
-mkdir -p dist
-cp build/worldview-config* dist
-echo "Unpacking Build Artifacts"
-( cd build && \
- tar xf worldview.tar.bz2 && \
- tar xf worldview-debug.tar.bz2 && \
- tar xf worldview-config.tar.bz2
-)
-echo "Installing Dependencies"
-if ! npm install ; then
- echo "ERROR: \"npm install\" failed" &>2
- exit 1
-fi
-echo "Combining build results from options and Worldview repos"
-if ! grunt site ; then
- echo "ERROR: \"grunt site\" failed" &>2
- exit 1
-fi
-echo "Generating an RPM of Worldview"
-if ! grunt rpm-only ; then
- echo "ERROR: \"grunt rpm-only\" failed" &>2
- exit 1
-fi
diff --git a/tasks/buildAll.sh b/tasks/buildAll.sh
new file mode 100755
index 000000000..997731e6a
--- /dev/null
+++ b/tasks/buildAll.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Bash commands to run in Bamboo to prepare an rpm for deployment
+
+# Reset directories that have build or install artifacts
+rm -rf build dist node_modules .python web/build
+
+npm install # Install dependencies
+npm run build # Build the app
+
+# Prepare rpm sources
+mkdir -p build/rpm/{SOURCES,SPECS}
+cp worldview.spec build/rpm/SPECS
+cp dist/*.tar.bz2 build/rpm/SOURCES
+cp *.conf build/rpm/SOURCES
+
+# Replace placeholders in rpm spec
+grunt rpm-placeholders
+
+# Build rpm
+rpmbuild -ba build/rpm/SPECS/worldview.spec
diff --git a/bin/wv-options-build b/tasks/buildOptions.sh
similarity index 77%
rename from bin/wv-options-build
rename to tasks/buildOptions.sh
index 75a23068e..0c97bf030 100755
--- a/bin/wv-options-build
+++ b/tasks/buildOptions.sh
@@ -3,7 +3,7 @@
PROG=$(basename "$0")
BASE=$(dirname "$0")/..
-BIN_DIR="$BASE/bin"
+TASKS_DIR="$BASE/tasks"
SRC_DIR="$BASE/node_modules/worldview-options-eosdis"
BUILD_DIR="$BASE/build/options-build"
DEST_DIR="$BASE/build/options"
@@ -32,11 +32,11 @@ OPT_SUBDIR="${1-release}"
# Activate virtual Python environment
PATH=.python/bin:.python/Scripts:${PATH}
-# If $FETCH_GC is set fetch GetCapabilities
+# If $FETCH_GC is set, make request to GIBS GetCapabilities API
if [ "$FETCH_GC" ] ; then
rm -rf "$OPT_DIR/$OPT_SUBDIR/gc/*"
rm -rf "$OPT_DIR/$OPT_SUBDIR/colormaps/gc/*"
- "$BIN_DIR/wv-options-fetch" "$OPT_DIR/$OPT_SUBDIR/config.json" "$OPT_DIR/$OPT_SUBDIR/gc"
+ "$TASKS_DIR/getCapabilities.py" "$OPT_DIR/$OPT_SUBDIR/config.json" "$OPT_DIR/$OPT_SUBDIR/gc"
exit 0
fi
@@ -59,29 +59,29 @@ if [ -e "$BUILD_DIR/features.json" ] ; then
cp "$BUILD_DIR/features.json" "$BUILD_DIR/config/wv.json/_features.json"
fi
-# Run wv-options-wmts script with config.json
+# Run extractConfigFromWMTS.py script with config.json
if [ -e "$BUILD_DIR/config.json" ] ; then
- "$BIN_DIR/wv-options-wmts" "$BUILD_DIR/config.json" "$BUILD_DIR/gc" \
+ "$TASKS_DIR/extractConfigFromWMTS.py" "$BUILD_DIR/config.json" "$BUILD_DIR/gc" \
"$BUILD_DIR/config/wv.json/_wmts" "$BUILD_DIR/colormaps"
fi
-# Run wv-options-colormap and move colormaps where we want them
+# Run processColormap.py and move colormaps where we want them
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" "$OPT_DIR/$OPT_SUBDIR/config.json" \
+ "$TASKS_DIR/processColormap.py" "$OPT_DIR/$OPT_SUBDIR/config.json" \
"$BUILD_DIR/colormaps" \
"$BUILD_DIR/config/palettes"
fi
-# Run wv-options-merge on all directories in /config
+# Run mergeConfig.py on all directories in /config
configs=$(ls "$BUILD_DIR/config")
for config in $configs; do
case $config in
*.json)
- "$BIN_DIR/wv-options-merge" "$BUILD_DIR/config/$config" \
+ "$TASKS_DIR/mergeConfig.py" "$BUILD_DIR/config/$config" \
"$DEST_DIR/config/$config"
;;
*)
@@ -95,6 +95,6 @@ cp -r "$BUILD_DIR/brand" "$DEST_DIR"
cp "$BUILD_DIR/brand.json" "$DEST_DIR"
# Validate the options build
-"$BIN_DIR"/wv-options-validate "$BUILD_DIR/config.json" "$DEST_DIR/config"
+"$TASKS_DIR/validateOptions.py" "$BUILD_DIR/config.json" "$DEST_DIR/config"
exit 0
diff --git a/version-check.js b/tasks/checkNodeVersion.js
similarity index 85%
rename from version-check.js
rename to tasks/checkNodeVersion.js
index 83bc51925..32b4a5322 100644
--- a/version-check.js
+++ b/tasks/checkNodeVersion.js
@@ -1,6 +1,6 @@
/* eslint no-console: "off" */
-var packageJson = require('./package.json');
-var requiredVersion = 'v' + packageJson.engines.node;
+var pkg = require('../package.json');
+var requiredVersion = 'v' + pkg.engines.node;
var nodeBeingUsed = process.version;
if (requiredVersion !== nodeBeingUsed) {
diff --git a/bin/wv-options-wmts b/tasks/extractConfigFromWMTS.py
similarity index 99%
rename from bin/wv-options-wmts
rename to tasks/extractConfigFromWMTS.py
index 08e528044..0bcbd235c 100755
--- a/bin/wv-options-wmts
+++ b/tasks/extractConfigFromWMTS.py
@@ -8,7 +8,7 @@ import sys
import urllib2 as urllib
import xmltodict
import isodate
-from process_temporal_layer import process_temporal
+from processTemporalLayer import process_temporal
prog = os.path.basename(__file__)
base_dir = os.path.join(os.path.dirname(__file__), "..")
diff --git a/bin/wv-options-fetch b/tasks/getCapabilities.py
similarity index 100%
rename from bin/wv-options-fetch
rename to tasks/getCapabilities.py
diff --git a/bin/wv-options-merge b/tasks/mergeConfig.py
similarity index 100%
rename from bin/wv-options-merge
rename to tasks/mergeConfig.py
diff --git a/bin/wv-options-colormap b/tasks/processColormap.py
similarity index 100%
rename from bin/wv-options-colormap
rename to tasks/processColormap.py
diff --git a/bin/process_temporal_layer.py b/tasks/processTemporalLayer.py
similarity index 100%
rename from bin/process_temporal_layer.py
rename to tasks/processTemporalLayer.py
diff --git a/bin/www b/tasks/start.js
similarity index 53%
rename from bin/www
rename to tasks/start.js
index 83a12026f..1aafc0144 100644
--- a/bin/www
+++ b/tasks/start.js
@@ -1,6 +1,10 @@
-#!/usr/bin/env node
-var app = require('../app');
+var express = require('express');
+var path = require('path');
var port = process.env.PORT || 3000;
+
+var app = express();
+
+app.use(express.static(path.join(__dirname, '../web')));
app.set('port', port);
app.listen(port, function () {
console.log('Worldview is available at http://localhost:' + port);
diff --git a/bin/wv-options-validate b/tasks/validateOptions.py
similarity index 99%
rename from bin/wv-options-validate
rename to tasks/validateOptions.py
index 797d20f9c..d8baa634d 100755
--- a/bin/wv-options-validate
+++ b/tasks/validateOptions.py
@@ -5,7 +5,7 @@ import json
from optparse import OptionParser
import os
import sys
-from process_temporal_layer import process_temporal
+from processTemporalLayer import process_temporal
prog = os.path.basename(__file__)
base_dir = os.path.join(os.path.dirname(__file__), "..")
diff --git a/deploy/metadata.template.html b/templates/metadata.html
similarity index 100%
rename from deploy/metadata.template.html
rename to templates/metadata.html
diff --git a/deploy/new.template.html b/templates/new.html
similarity index 100%
rename from deploy/new.template.html
rename to templates/new.html
diff --git a/worldview.spec b/worldview.spec
new file mode 100644
index 000000000..e9f7e9230
--- /dev/null
+++ b/worldview.spec
@@ -0,0 +1,95 @@
+Name: @WORLDVIEW@
+Version: @BUILD_VERSION@
+Release: @BUILD_RELEASE@.@BUILD_NUMBER@%{?dist}
+Summary: Browse full-resolution, near real-time satellite imagery.
+License: NASA-1.3
+URL: http://earthdata.nasa.gov
+Source0: site-@[email protected]
+Source1: site-@[email protected]
+Source3: httpd.conf
+Source4: httpd-debug.conf
+BuildArch: noarch
+Requires: httpd
+
+# Turn off the brp-python-bytecompile script
+%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
+
+# Set httpd configuration
+%global httpdconfdir %{_sysconfdir}/httpd/conf.d
+
+%description
+%{summary}
+
+%package debug
+Summary: Non-minified version of Worldview for debugging
+
+%description debug
+%{summary}
+
+%prep
+%setup -c -T
+tar xf %{SOURCE0}
+tar xf %{SOURCE1}
+cp %{SOURCE3} .
+cp %{SOURCE4} .
+
+%install
+rm -rf %{buildroot}
+
+# Install Apache configuration for release
+install -m 755 -d %{buildroot}/%{httpdconfdir}
+install -m 644 httpd.conf %{buildroot}/%{httpdconfdir}/@[email protected]
+rm httpd.conf
+
+# Install Apache configuration for debug
+install -m 644 httpd-debug.conf %{buildroot}/%{httpdconfdir}/@[email protected]
+rm httpd-debug.conf
+
+# Install release application
+install -m 755 -d %{buildroot}/%{_datadir}/@WORLDVIEW@
+cp -r site-@WORLDVIEW@/* %{buildroot}/%{_datadir}/@WORLDVIEW@
+
+# Install debug application
+install -m 755 -d %{buildroot}/%{_datadir}/@WORLDVIEW@-debug
+cp -r site-@WORLDVIEW@-debug/* %{buildroot}/%{_datadir}/@WORLDVIEW@-debug
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{_datadir}/@WORLDVIEW@
+%config(noreplace) %{httpdconfdir}/@[email protected]
+
+
+%files debug
+%{_datadir}/@WORLDVIEW@-debug
+%config(noreplace) %{httpdconfdir}/@[email protected]
+
+%post
+if [ $1 -gt 0 ] ; then
+ if /sbin/service httpd status >/dev/null ; then
+ /sbin/service httpd reload
+ fi
+fi
+
+%post debug
+if [ $1 -gt 0 ] ; then
+ if /sbin/service httpd status >/dev/null ; then
+ /sbin/service httpd reload
+ fi
+fi
+
+%postun
+if [ $1 -eq 0 ] ; then
+ if /sbin/service httpd status >/dev/null ; then
+ /sbin/service httpd reload
+ fi
+fi
+
+%postun debug
+if [ $1 -eq 0 ] ; then
+ if /sbin/service httpd status >/dev/null ; then
+ /sbin/service httpd reload
+ fi
+fi
diff --git a/wv-dist-clean b/wv-dist-clean
deleted file mode 100755
index bc1d3c43a..000000000
--- a/wv-dist-clean
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-set -e
-
-PROG=$(basename "$0")
-BASE_DIR=$(dirname "$0")
-
-echo -n "$PROG: Removing node_modules... "
-rm -rf "$BASE_DIR/node_modules"
-echo "done."
-
-echo -n "$PROG: Removing python virtualenv... "
-rm -rf "$BASE_DIR"/python
-echo "done."
-
-echo -n "$PROG: Removing build directory... "
-rm -rf "$BASE_DIR"/build
-echo "done."
-
-echo -n "$PROG: Removing dist directory... "
-rm -rf "$BASE_DIR"/dist
-echo "done."
-
-echo -n "$PROG: Removing any other non-source files... "
-rm -f npm-debug.log
-rm -rf src/conf/*
-rm -rf src/config/*
-echo "done."
diff --git a/wv-setup b/wv-setup
deleted file mode 100755
index 5ad4e6cfd..000000000
--- a/wv-setup
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/bash
-
-set -e
-
-BASE_DIR=$(dirname "$0")
-PROG=$(basename "$0")
-
-usage() {
- cat << EOF
-Usage: $PROG [options]
-
-Options:
- -d Install apache configuration files and restart the web server
- -h Prints this usage
- -w Worldview EOSIS options
-EOF
-}
-
-while getopts dhw flag; do
- case "$flag" in
- d)
- DEVELOP=1
- shift
- ;;
- h)
- usage
- exit 0
- ;;
- w)
- WORLDVIEW=1
- shift;
- ;;
- ?)
- usage
- exit 1
- ;;
- esac
-done
-shift $(( OPTIND - 1 ));
-
-cd "$BASE_DIR"
-
-if [ ! -e /usr/local/bin/grunt ] ; then
- echo "$PROG: ***** Installing a global version of grunt."
- echo "You may be prompted for the root password to execute this command:"
- echo " sudo npm install --global grunt-cli"
- sudo npm install --global grunt-cli
- echo "$PROG: ***** Clearing npm cache"
- sudo rm -rf "${HOME}"/.npm/*
-fi
-
-if [ ! -d "$BASE_DIR/node_modules" ] ; then
- echo "***** Installing node.js dependencies"
- npm install
-fi
-
-if [ ! -e "/usr/local/bin/virtualenv" ] ; then
- echo "$PROG: ***** Installing a global version of virtualenv"
- echo "You may be prompted for the root password to execute this command:"
- echo " sudo easy_install virtualenv==1.10.1"
- sudo easy_install virtualenv==1.10.1
-fi
-
-if [ ! -d "$BASE_DIR/options" ] ; then
- echo "$PROG: ***** Fetching options"
- if [ "$WORLDVIEW" ] ; then
- git clone https://github.com/nasa-gibs/worldview-options-eosdis options
- else
- git clone https://github.com/nasa-gibs/worldview-options-template options
- mkdir -p "$BASE_DIR/build"
- git clone https://github.com/nasa-gibs/worldview-options-eosdis \
- "$BASE_DIR/build/options-eosdis"
- cp "$BASE_DIR/build/options-eosdis/config.json" "$BASE_DIR/options"
- cp -r "$BASE_DIR/build/options-eosdis/config" "$BASE_DIR/options"
- cp -r "$BASE_DIR/build/options-eosdis/colormaps" "$BASE_DIR/options"
- fi
-fi
-
-if [ ! -d "$BASE_DIR/dist" ] ; then
- echo "$PROG: ***** First time build"
- grunt build
-fi
-
-if [ "$DEVELOP" ] ; then
- echo "$PROG: ***** Creating apache configuration"
- rm -f dist/*.httpd.conf
- grunt apache-config
-
- # OS X
- if [ -d /etc/apache2/other ] ; then
- echo "$PROG: ***** Installing configuration and restarting server"
- echo "You may be prompted for the root password to execute these"
- echo "commands:"
- echo " sudo cp dist/*.httpd.conf /etc/apache2/other"
- echo " sudo apachectl restart"
- sudo cp dist/*.httpd.conf /etc/apache2/other
- sudo apachectl restart
- else
- echo "This only works on OS X at the moment"
- exit 1
- fi
-
- echo -e "\nApplication is now available at:\n"
- grep Alias dist/*.httpd.conf | cut -f 2 -d" " | sed s_.*_http://localhost\&_g
- echo
- echo "Please check to make sure apache can access this directory"
- echo
-fi