Skip to content

Commit

Permalink
convert ecoengine explore to be a bower package and use the gulp buil…
Browse files Browse the repository at this point in the history
…d process
  • Loading branch information
Eric Gelinas committed Feb 26, 2015
1 parent fb9b987 commit e0727fa
Show file tree
Hide file tree
Showing 14 changed files with 19,363 additions and 1,919 deletions.
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules

# Users Environment Variables
.lock-wscript

bower_components

.sass-cache

public/js
public/css
public/*.html

.env.json
97 changes: 97 additions & 0 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"use strict";

var fs = require("fs");

var copy = require("gulp-copy"),
gulp = require("gulp"),
jshint = require("gulp-jshint"),
rename = require("gulp-rename"),
replace = require("gulp-replace"),
run = require("gulp-run"),
sourcemaps = require("gulp-sourcemaps"),
uglify = require("gulp-uglify"),
env = require('gulp-env'),
webserver = require("gulp-webserver"),
concat = require('gulp-concat'),
mainBowerFiles = require('main-bower-files'),
wrap = require("gulp-wrap");

// Gulp mix-ins

require("gulp-autopolyfiller");
require("gulp-watch");

var paths = {
js: "./js/*.js",
publicJs: "./static/js/stamen"
};

//
// Run all default tasks
//
gulp.task("default",function() {
gulp.start("lint");
gulp.start("uglify");
});

//
// Check quality of Javascript
// warn if errors or style problems are found
//
gulp.task("lint", function() {
gulp
.src(paths.js)
.pipe(jshint({
predef: [
"document",
"location",
"navigator",
"window",
"L"
],
expr: true
}))
.pipe(jshint.reporter("jshint-stylish"));
});

gulp.task("uglify", function() {
gulp
.src(mainBowerFiles("**/*.js").concat([paths.js]))
.pipe(sourcemaps.init())
.pipe(concat('ecoengine-dependencies.js'))
.pipe(gulp.dest(paths.publicJs))
.pipe(uglify({
mangle: true,
output: {
beautify: false
}
}))
.pipe(rename({extname: ".min.js"}))
.pipe(sourcemaps.write("./")) // Write a sourcemap for browser debugging
.pipe(gulp.dest(paths.publicJs));
});

//
// Serve contents of the public directory
// locally on port :8080
//
gulp.task("webserver", function() {
gulp
.src("./")
.pipe(webserver({
open: false, // unless you want it
livereload: false, // unless you want it
directoryListing: false,
fallback: "explore/index.html"
}));
});

//
// Watch directories for changes
//
gulp.task("watch", function() {
gulp.watch(mainBowerFiles().concat([paths.js]),["lint", "uglify"]);
console.log("watching directory:", paths.js);

gulp.start("webserver");
});
25 changes: 25 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "ecoengine",
"version": "0.0.0",
"homepage": "https://github.com/stamen/ecoengine",
"authors": [
"syntagmatic",
"Eric Gelinas <[email protected]>"
],
"description": "Stamen built a rich prototype search interface to explore the Berkeley Ecoengine API",
"license": "MIT",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"d3": "~3.5.3",
"leaflet": "~0.7.3",
"hashnav": "~1.0.2",
"d3-geo-projection": "~0.2.12"
}
}
16 changes: 6 additions & 10 deletions explore/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" href="../static/css/stamen.css" />
<script src="../static/js/stamen/leaflet.js"></script>
<script src="../static/js/stamen/d3.v3.min.js"></script>
<script src="../static/js/stamen/zoom-extras.js"></script>
<script src="../static/js/stamen/hashnav.js"></script>
<script src="../static/js/stamen/config-explore.js"></script>
<script src="static/js/stamen/ecoengine.js"></script>

<title>Ecoengine Explorer</title>
<body>
Expand All @@ -33,16 +29,16 @@ <h4>Advanced Search</h4>
<p>
<div class="search-btn">Search</div>
</p>

</p>
<a href="#" class="hide-btn">Hide</a>
</div>

<div id="export-pane" class="flydown">
<h4>Share</h4>
<h4>Share</h4>
<p>Copy this URL to share the page. Note that dropdown selections (such as raster layers) are currently not saved. Only parameters used to query the observations API are shared.</p>
<p><a href="#" id="share-the-page"></a></p>
<h4>Export</h4>
<h4>Export</h4>
<p>These are the queries used to generate the interface on this page.</p>
<h4>Observations</h4>
<a href="#" id="export-observations" target="_blank"></a><br/>
Expand Down Expand Up @@ -126,7 +122,7 @@ <h4>Filters</h4>
<div class="panel right">
<h4>Observations</h4>
<div class="export-buttons">
<a href="#" id="export-view">View data</a> or export as
<a href="#" id="export-view">View data</a> or export as
<a href="#" id="export-csv" target="_blank">CSV</a>,
<a href="#" id="export-json" target="_blank">JSON</a>, or
<a href="#" id="export-geojson" target="_blank">GeoJSON</a> from the <a href="https://ecoengine.berkeley.edu/">Berkeley Ecoinformatics Engine</a>
Expand All @@ -136,4 +132,4 @@ <h4>Observations</h4>
</div>
</div>
</div>
<script src="../static/js/stamen/ecoengine-explore.js"></script>
<script src="static/js/stamen/ecoengine-explore.js"></script>
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "ecoengine",
"version": "0.0.0",
"description": "Stamen built a rich prototype search interface to explore the Berkeley Ecoengine API",
"main": "index.js",
"scripts": {
"build": "gulp",
"postinstall": "bower install",
"start": "gulp && gulp watch"
},
"repository": {
"type": "git",
"url": "git://github.com/stamen/ecoengine"
},
"license": "ISC",
"bugs": {
"url": "https://github.com/stamen/ecoengine/issues"
},
"homepage": "https://github.com/stamen/ecoengine",
"dependencies": {
"gulp-watch": "~3.0.0",
"gulp": "~3.8.10",
"gulp-rename": "~1.2.0",
"gulp-compile-handlebars": "~0.4.4",
"gulp-jshint": "~1.9.0",
"gulp-uglify": "~1.0.2",
"gulp-webserver": "~0.9.0",
"jshint-stylish": "~1.0.0",
"gulp-run": "~1.6.6",
"gulp-sourcemaps": "~1.3.0",
"gulp-copy": "0.0.2",
"bower": "~1.3.12",
"bower-requirejs": "~1.1.2",
"gulp-hb": "~1.0.1",
"gulp-replace": "~0.5.0",
"gulp-autopolyfiller": "~1.2.0",
"gulp-concat": "~2.4.3",
"samesies": "0.0.0",
"gulp-env": "~0.2.0",
"main-bower-files": "~2.5.0",
"gulp-wrap": "~0.10.0",
"wrap": "~0.1.2",
"escape-string-regexp": "~1.0.2"
}
}
Loading

0 comments on commit e0727fa

Please sign in to comment.