forked from goodow/realtime-web-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
larry
committed
Jul 11, 2014
1 parent
4545ee4
commit d812150
Showing
6 changed files
with
169 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "gh-pages"] | ||
path = gh-pages | ||
url = https://github.com/goodow/realtime-web-playground.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,19 @@ language: node_js | |
node_js: | ||
- 0.10 | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
before_install: | ||
- git config --global user.name "Goodow Dev" | ||
- git config --global user.name "Goodow Bot" | ||
- git config --global user.email "[email protected]" | ||
- git remote set-url origin "https://${GH_TOKEN}@github.com/goodow/realtime-web-playground.git" | ||
- git fetch origin gh-pages:gh-pages | ||
|
||
before_script: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- npm start > /dev/null & | ||
- npm run update-webdriver | ||
- sleep 1 | ||
- cd gh-pages && git pull origin gh-pages && git remote set-url origin "https://${GH_TOKEN}@github.com/goodow/realtime-web-playground.git" | ||
- cd ${TRAVIS_BUILD_DIR} | ||
|
||
after_success: | ||
- cp -r app/ .gh-pages/ | ||
- git checkout gh-pages && cp -r .gh-pages/* . && rm -rf .gh-pages/ app/ node_modules/ | ||
- git add . && git commit -m "Generated by ${TRAVIS_COMMIT}" | ||
- test ${TRAVIS_PULL_REQUEST} == "false" && git push origin | ||
- cd gh-pages | ||
- rm -rf `find . -maxdepth 1 -name "*" ! -name ".git*" ! -name "CNAME"` | ||
- cp -r ../app/* . | ||
- git add . && git commit -a -m "Generated by ${TRAVIS_COMMIT}" | ||
- test ${TRAVIS_PULL_REQUEST} == "false" && git push origin HEAD:gh-pages | ||
- cd ${TRAVIS_BUILD_DIR} | ||
|
||
env: | ||
global: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,105 @@ | ||
# Google Drive Realtime API Playground | ||
# Goodow Realtime Store API Playground [![Build Status](https://travis-ci.org/goodow/realtime-web-playground.svg?branch=master)](https://travis-ci.org/goodow/realtime-web-playground) | ||
|
||
[![Goodow Realtime Store API Playground Screenshot](https://github.com/goodow/realtime-web-playground/raw/master/screenshot.png)](http:https://realtimeplayground.goodow.com/) | ||
|
||
[![Google Drive Realtime API Playground Screenshot](https://github.com/googledrive/realtime-playground/raw/master/screenshot.png)](https://realtimeplayground.appspot.com/) | ||
|
||
## Overview | ||
|
||
**Google Drive Realtime API Playground**, is a web app that helps you to try out the features of the [Google Drive Realtime API](https://developers.google.com/drive/realtime). | ||
**Goodow Realtime Store API Playground**, is a web app that helps you to try out the features of the [Goodow Realtime Store API](https://github.com/goodow/realtime-store/). | ||
|
||
You can try out the Goodow Realtime Store API Playground on its [live instance](http:https://realtimeplayground.goodow.com/). | ||
|
||
Visit [Google groups](https://groups.google.com/forum/#!forum/goodow-realtime) for discussions and announcements. | ||
|
||
## Getting Started | ||
|
||
To get you started you can simply clone the realtime-web-playground repository and install the dependencies: | ||
|
||
### Prerequisites | ||
|
||
You need git to clone the realtime-web-playground repository. You can get it from | ||
[http:https://git-scm.com/][git]. | ||
|
||
We also use a number of node.js tools to initialize and test realtime-web-playground. You must have node.js and | ||
its package manager (npm) installed. You can get them from [http:https://nodejs.org/][node]. | ||
|
||
### Clone realtime-web-playground | ||
|
||
Clone the realtime-web-playground repository using [git][git]: | ||
|
||
``` | ||
git clone https://github.com/goodow/realtime-web-playground.git | ||
cd realtime-web-playground | ||
``` | ||
|
||
### Install Dependencies | ||
|
||
We have two kinds of dependencies in this project: tools and realtime-store library code. The tools help | ||
us manage and test the application. | ||
|
||
* We get the tools we depend upon via `npm`, the [node package manager][npm]. | ||
* We get the realtime-store code via `bower`, a [client-side code package manager][bower]. | ||
|
||
We have preconfigured `npm` to automatically run `bower` so we can simply do: | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
Behind the scenes this will also call `bower install`. You should find that you have two new | ||
folders in your project. | ||
|
||
* `node_modules` - contains the npm packages for the tools we need | ||
* `app/bower_components` - contains the realtime-store library files | ||
|
||
*Note that the `bower_components` folder would normally be installed in the root folder but | ||
realtime-web-playground changes this location through the `.bowerrc` file. Putting it in the app folder makes | ||
it easier to serve the files by a webserver.* | ||
|
||
### Run the Application | ||
|
||
The project can run on any static web server, but we also have preconfigured the project with a | ||
simple development web server. The simplest way to start this server is: | ||
|
||
The Playground will take you through the steps required to have the Realtime API working on your application and can be used as a reference implementation of a Google Drive Realtime API application. | ||
``` | ||
gulp serve | ||
``` | ||
|
||
You can try out the Google Drive Realtime API Playground on its [live instance](https://realtimeplayground.appspot.com). | ||
This outputs an IP address you can use to locally test and another that can be used on devices connected to your network. | ||
|
||
## Installation and Configuration | ||
|
||
The project can run on any static web server, but we also provide required configuration and boilerplate files to host it on App Engine. | ||
## Updating Realtime Store | ||
You can update the tool dependencies by running: | ||
|
||
If you wish to host it in your own App Engine instance make sure you set the name of your App Engine application in `/app.yaml`. To create an App Engine instance follow the instructions on [appengine.google.com](https://appengine.google.com). | ||
``` | ||
npm update | ||
``` | ||
|
||
### Create a Google APIs project and Activate the Drive API | ||
This will find the latest versions that match the version ranges specified in the `package.json` file. | ||
|
||
First, you need to activate the Drive API for your app. You can do it by configuring your API project in the Google APIs Console. | ||
You can update the Realtime Store dependencies by running: | ||
|
||
- Create an API project in the [Google APIs Console](https://code.google.com/apis/console/b/0/?noredirect). | ||
- Select the "Services" tab and enable the Drive API. | ||
- Select the "API Access" tab in your API project, and click "Create an OAuth 2.0 client ID". | ||
- In the Branding Information section, provide a name for your application (e.g. "CollabCube 3D"), and click Next. Providing a product logo is optional. | ||
- In the Client ID Settings section, do the following: | ||
- Select Web application for the Application type | ||
- Click the more options link next to the heading, Your site or hostname. | ||
- List your hostname in the Authorized Redirect URIs and JavaScript Origins fields. | ||
- Click Create Client ID. | ||
- In the **API Access** page, locate the section **Client ID for Web applications** and note the **Client ID** value. | ||
- List your hostname in JavaScript origins in the Client ID settings. | ||
- Go to the **Drive SDK** page and copy the **App ID**. | ||
``` | ||
bower update | ||
``` | ||
|
||
### Setup your App information in the code | ||
This will find the latest versions that match the version ranges specified in the `bower.json` file. | ||
|
||
You should now have your **Client ID** and your **App ID**. In `/js/rtpg.js` change the `APP_ID` and the `CLIENT_ID` constants at the top of the file. | ||
|
||
### Deploy, run that's it! | ||
## Continuous Integration | ||
|
||
## Contributing | ||
### Travis CI | ||
|
||
Before creating a pull request, please fill out either the individual or | ||
corporate Contributor License Agreement. | ||
[Travis CI][travis] is a continuous integration service, which can monitor GitHub for new commits | ||
to your repository and execute scripts such as building the app or running tests. The realtime-web-playground | ||
project contains a Travis configuration file, `.travis.yml`, which will cause Travis to build and | ||
deploy the app to Github Pages when you push to GitHub. | ||
|
||
* If you are an individual writing original source code and you're sure you | ||
own the intellectual property, then you'll need to sign an | ||
[individual CLA](http:https://code.google.com/legal/individual-cla-v1.0.html). | ||
* If you work for a company that wants to allow you to contribute your work | ||
to this client library, then you'll need to sign a | ||
[corporate CLA](http:https://code.google.com/legal/corporate-cla-v1.0.html). | ||
You will need to enable the integration between Travis and GitHub. See the Travis website for more | ||
instruction on how to do this. | ||
|
||
Follow either of the two links above to access the appropriate CLA and | ||
instructions for how to sign and return it. Once we receive it, we'll add you | ||
to the official list of contributors and be able to accept your patches. | ||
[git]: http:https://git-scm.com/ | ||
[bower]: http:https://bower.io | ||
[npm]: https://www.npmjs.org/ | ||
[node]: http:https://nodejs.org | ||
[travis]: https://travis-ci.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* | ||
* Goodow Realtime Store | ||
* Copyright 2014 Goodow.com. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License | ||
* | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// Include Gulp & Tools We'll Use | ||
var gulp = require('gulp'); | ||
var browserSync = require('browser-sync'); | ||
var reload = browserSync.reload; | ||
|
||
// Watch Files For Changes & Reload | ||
gulp.task('serve', function () { | ||
browserSync({ | ||
notify: false, | ||
server: { | ||
baseDir: ['app'] | ||
} | ||
}); | ||
|
||
gulp.watch(['app/**/*.html'], reload); | ||
gulp.watch(['app/css/**/*.css'], reload); | ||
gulp.watch(['app/js/**/*.js'], reload); | ||
gulp.watch(['app/images/**/*'], reload); | ||
}); | ||
|
||
gulp.task('default', function() { | ||
// place code for your default task here | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters