Permalink
Browse files

restructure, packaging, doc updates

  • Loading branch information...
1 parent 8331813 commit 0cb0f57c91bdacd17b4072af2160d8e58f3991cc @wavded wavded committed Apr 25, 2012
View
@@ -1,17 +1,34 @@
-.PHONY: watch tmux tmux_setup deploy_live
project=wheredat
-path=/var/www/wheredat
-instance=\033[32;01m${project}\033[m
+instance=\033[36;01m${project}\033[m
watch:
- @always app.js
+ @if ! which supervisor > /dev/null; then echo "supervisor required, installing..."; sudo npm install -g supervisor; fi
+ @supervisor -e html,js,css -n exit server.js
-deploy_live: serverA = sawyer@172.25.20.111
+tmux_setup:
+ @tmux new-session -s ${project} -d -n workspace
+ @tmux split-window -t ${project} -h
+ @tmux split-window -t ${project} -v
+ @tmux select-pane -t ${project}:1.0
+ @tmux select-pane -t ${project}:1.1
+ @tmux resize-pane -t ${project} -D 2
+ @tmux select-layout -t ${project} main-vertical
+ @tmux send-keys -t ${project}:1.0 'vim' C-m
+ @tmux send-keys -t ${project}:1.2 'make' C-m
+ @tmux select-pane -t ${project}:1.0
+ @tmux resize-pane -t ${project} -R 40
+
+tmux:
+ @if ! tmux has-session -t ${project}; then exec make tmux_setup; fi
+ @tmux attach -t ${project}
+
+# sample deployment script (assumes upstart as daemon)
+deploy_live: serverA = sawyer@172.25.20.120
deploy_live: serverB = sawyer@172.25.20.120
deploy_live:
- @rsync -az --exclude=".git" --delete * ${serverA}:${path}
- @rsync -az --exclude=".git" --delete * ${serverB}:${path}
- @echo -e " ${instance} | copied files to ${serverA} and ${serverB}"
+ @ssh ${serverA} "sudo npm install -g ${project}"
+ @ssh ${serverB} "sudo npm install -g ${project}"
+ @echo -e " ${instance} | updated ${project} on ${serverA} and ${serverB}"
@ssh ${serverA} "sudo restart ${project}"
@ssh ${serverB} "sudo restart ${project}"
@echo -e " ${instance} | restarting app on ${serverA} and ${serverB}"
View
@@ -1,44 +0,0 @@
-"use strict"
-var http = require('http')
-var fs = require('fs')
-
-process.chdir(__dirname)
-
-function makeIndex() {
- var index = fs.readFileSync('index.html').toString()
- .replace("<link href='lib.css' rel='stylesheet'>", '<style>' + fs.readFileSync('lib.css').toString() + '</style>')
- .replace("<script src='lib.js'></script>", '<script>' + fs.readFileSync('lib.js').toString() + '</script>')
- .replace("<script src='wheredat.js'></script>", '<script>' + fs.readFileSync('wheredat.js').toString() + '</script>')
- return new Buffer(index)
-}
-
-var index = makeIndex()
-var example = fs.readFileSync('example.html')
-
-var icons = {
- '/img/marker.png': fs.readFileSync('img/marker.png'),
- '/img/marker-shadow.png': fs.readFileSync('img/marker-shadow.png'),
- '/img/popup-close.png': fs.readFileSync('img/popup-close.png'),
- '/img/zoom-in.png': fs.readFileSync('img/zoom-in.png'),
- '/img/zoom-out.png': fs.readFileSync('img/zoom-out.png')
-}
-
-var iecss = fs.readFileSync('lib-ie.css')
-
-http.createServer(function (req, res) {
- if (req.url.match(/img/)) {
- res.writeHead(200, { 'Content-Type': 'image/png' })
- res.end(icons[req.url])
- }
- else if (req.url === '/lib-ie.css') {
- res.writeHead(200, { 'Content-Type': 'text/css' })
- res.end(iecss)
- }
- else {
- res.writeHead(200, { 'Content-Type': 'text/html' })
- if (req.url === '/example.html')
- res.end(example)
- else
- res.end(index)
- }
-}).listen(8002)
View
@@ -1,8 +1,8 @@
<!doctype html>
<title>... wheredat ...</title>
<meta http-equiv='X-UA-Compatible' content='IE=Edge,chrome=1'/>
-<link href='lib.css' rel='stylesheet'>
-<!--[if lte IE 8]><link rel="stylesheet" href="lib-ie.css" /><![endif]-->
+<link href='leaflet/leaflet.css' rel='stylesheet'>
+<!--[if lte IE 8]><link rel="stylesheet" href="leaflet/leaflet-ie.css" /><![endif]-->
<style>
html, body { padding: 0; margin: 0; overflow: hidden }
html, body, #map { width: 100%; height: 100% }
@@ -23,5 +23,5 @@
}
</style>
<div id="map"></div><div id="address"></div>
-<script src='lib.js'></script>
+<script src='leaflet/leaflet.js'></script>
<script src='wheredat.js'></script>
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
View
Oops, something went wrong.
File renamed without changes.
View
Oops, something went wrong.
View
@@ -0,0 +1,15 @@
+{
+ "author": "Marc Harter <wavded@gmail.com> (wavded.com)",
+ "name": "wheredat",
+ "description": "A simple, easy to use, geocoding interface for web applications",
+ "keywords": ["leaflet","geocode","bing","widget"],
+ "version": "0.2.1",
+ "homepage": "http://wheredat.adc4gis.com",
+ "bin": { "wheredat": "server.js" },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/applieddataconsultants/wheredat.git"
+ },
+ "main": "server.js",
+ "engines": { "node": "*" }
+}
View
@@ -18,8 +18,11 @@ Another one of its goals is to be extremely light weight and quick to load.
Built to be served with [node.js](http://nodejs.org/) although you can serve the files up statically as well.
-```
-node app.js
+For node do:
+
+```sh
+sudo npm install -g wheredat
+wheredat [port]
```
### Request Params
@@ -56,6 +59,14 @@ The data returned will look like:
}
```
+Or if unable to geocode:
+
+```json
+{
+ error: 'wheredat was unable to geocode'
+}
+```
+
This data will return whenever a geocode or reverse geocode happens (e.g.
whenever the point is moved or when the map is initially loaded).
View
@@ -0,0 +1,46 @@
+#!/usr/bin/env node
+
+const http = require('http')
+const fs = require('fs')
+const port = process.argv[2] || 8002
+
+process.chdir(__dirname)
+
+function makeIndex() {
+ var index = fs.readFileSync('index.html').toString()
+ .replace("<link href='leaflet/leaflet.css' rel='stylesheet'>", '<style>' + fs.readFileSync('./leaflet/leaflet.css').toString() + '</style>')
+ .replace("<script src='leaflet/leaflet.js'></script>", '<script>' + fs.readFileSync('./leaflet/leaflet.js').toString() + '</script>')
+ .replace("<script src='wheredat.js'></script>", '<script>' + fs.readFileSync('wheredat.js').toString() + '</script>')
+ return new Buffer(index)
+}
+
+var index = makeIndex()
+var example = fs.readFileSync('example.html')
+
+var icons = {
+ '/img/marker.png': fs.readFileSync('./leaflet/img/marker.png'),
+ '/img/marker-shadow.png': fs.readFileSync('./leaflet/img/marker-shadow.png'),
+ '/img/popup-close.png': fs.readFileSync('./leaflet/img/popup-close.png'),
+ '/img/zoom-in.png': fs.readFileSync('./leaflet/img/zoom-in.png'),
+ '/img/zoom-out.png': fs.readFileSync('./leaflet/img/zoom-out.png')
+}
+
+var iecss = fs.readFileSync('./leaflet/leaflet-ie.css')
+
+http.createServer(function (req, res) {
+ if (req.url.match(/img/)) {
+ res.writeHead(200, { 'Content-Type': 'image/png' })
+ res.end(icons[req.url])
+ }
+ else if (req.url === '/leaflet/leaflet-ie.css') {
+ res.writeHead(200, { 'Content-Type': 'text/css' })
+ res.end(iecss)
+ }
+ else {
+ res.writeHead(200, { 'Content-Type': 'text/html' })
+ if (req.url === '/example.html')
+ res.end(example)
+ else
+ res.end(index)
+ }
+}).listen(port)

0 comments on commit 0cb0f57

Please sign in to comment.