This guide explains how to install and setup Link-SF .
Link-SF is designed to be free to setup and free to run in perpetuity. Since hosting files is cheap, we've decided to go with building a static site. There's only one hard dependency as far as accounts go. Parse gives us data persistence, authentication for admins, and querying:
-
If you are on OS X 10.10 the Parse CLI tools may not be installed in their documented fashion. Alternatively the following may be copied into a text editor:
#!/bin/bash
TMP_FILE=/tmp/parse.tmp
if [ -e /tmp/parse.tmp ]; then
echo "Cleaning up from previous install failure"
rm -f /tmp/parse.tmp
fi
echo "Fetching latest version ..."
curl --progress-bar https://www.parse.com/downloads/cloud_code/parse -o /tmp/parse.tmp
if [ ! -d /usr/local/bin ]; then
echo "Making /usr/local/bin"
mkdir -p /usr/local/bin
fi
echo "Installing ..."
mv /tmp/parse.tmp /usr/local/bin/parse
chmod 755 /usr/local/bin/parse
Call the file install.sh (or be creative, whatevs) and execute:
$ bash install.sh
If you want to deploy the site publicly, S3 gives us free file hosting:
The following accounts are optional:
- Mailgun: For capturing feedback entered in the feedback form as an email to your account.
- Google Analytics: In addition to capturing useful things like user agent and traffic, we've added a couple custom events that help us keep track of how often a user connects to a service via external link (calling, visiting website, or getting directions).
To build the site (turn a file tree into a monolithic html, js, and css file), you'll need some command line tools installed from the sites below:
Download the source (via git or .zip file).
In the project root, you'll find a .env.example file. Make copies of that file called .env.dev and .env.prod in the same directory. They will probably look something like this:
PARSE_APP_NAME=xxxxxxx
PARSE_APP_ID=xxxxxxx
PARSE_JS_KEY=xxxxxxx
PARSE_MASTER_KEY=xxxxxxx
...
There are placeholders for development and production Parse tokens because we don't want any breakage during development to affect the production site. Create a new Parse app and call it
4DFD
whatever you'd like. Replace the token placeholder values (xxxx) with those specific to your apps from Parse. The Mailgun and Google Analytics tokens can be ignored for now, if you'd like.
Keep your .env.dev and .env.prod files secret (out of source control, etc).
From the project root (and with the command line tools outlined above installed):
npm installgruntgrunt parse:deploy:devopen build/index.html
If everything worked, you should have Link-SF open and running in your browser. You won't see any facilities listed in search, so you'll want to add one in the admin interface. First, create a new user in the Parse interface, then:
open build/admin.html
Login using the credentials for the user you just added, then add a facility and service. From the Parse website, go to the Data Browser and set the permissions on the Facility and Service objects to have public GET and FIND permissions. You will be able to return to the enduser app and see the facility in search results.
Making changes to the site is pretty simple. grunt will build the site once, then you want to invoke grunt watch which will rebuild the site once the watched set of files change. The flow should be:
gruntgrunt watch- edit a watched file, then save
- see the site rebuild in your terminal
- reload the page and see updated build
We use http://fontello.com to generate an icon bundle. Here's a guide on how to add or change icons.
To test out the app, using an emulator is best in the absence of an actual device; this lets us simulate our target devices fairly well. Our target device is any 320x480 phone on Android 2.2.
To get an android emulator setup on Mac OS:
- Download the Android Developer Tools
- Open the
adt-bundle-mac-...folder, and openEclipse.app. You may have to control-click and selectOpen, since this is a.appdirectly downloaded from an untrusted source. - Window -> Android SDK Manager
- In the list of packages, select
Android 2.2 (API 8)and clickInstall packages.... - Window -> Android Virtual Device Manager
- Click
New...and configure a new device with 320x480 resolution and targeting Android 2.2. - Click
Start... - Open the Android browser and visit Link-SF.
If you'd like to use a feedback form:
- Setup a Mailgun account
- Add your Mailgun domain and API key to the
.env.xxxfiles (see example .env.xxx file) - Addany to/from email address you'd like to the
.env.xxxfiles on theMAILGUN_TO_EMAIL_ADDRESSandMAILGUN_FROM_EMAIL_ADDRESSlines. - Deploy your new changes, then check to see if your feedback form works as intended (you'll find the feedback link on the footer of the home and detail pages).