Skip to content

RCB35/the-blue-alliance

 
 

Repository files navigation

The Blue Alliance

The Blue Alliance is a FIRST Robotics tool to help teams scout for, compete at, and relive competitions. You can see how the whole site works here, or even write code to make it better!

Contributing

  1. Join thebluealliance-developers on groups.google.com to stay up to date with development
  2. Fork this project!
  3. Make your changes on a branch.
  4. Make changes!
  5. Send pull request from your fork.
  6. We'll review it, and push your changes to the site!

If you're having trouble getting set up, reach out to us at our mailing list and we'll help you through it!

Setup

  1. Learn a bit about Git and GitHub:
  2. Install Python 2.7.X
  3. Install App Engine
    • Specifically use the Python SDK
    • Run the installer and allow it make symbolic links (it might ask you to enter your root password)
  4. Get the latest version of The Blue Alliance
    • Fork TBA by clicking on "Fork" in the top right of its GitHub page
    • Run git clone git://github.com/USERNAME/the-blue-alliance.git where USERNAME is your GitHub username, or use GitHub's Windows or OS X app to clone it to your computer
    • For detailed instructions see the GitHub guide on contributing
  5. Install numpy
  6. Install Node.js which includes Node Package Manager
  7. Install LESS via Node Package Manager
    • npm install -g less
  8. Install Paver
    • easy_install -U Paver
    • or pip install -U Paver
  9. Run easy_install pep8 to avoid the lint error [Error 2] The system cannot find the file specified.
  10. Run paver setup

Run a local dev server

  1. Import the project into Google App Engine Launcher
    • Open App Engine Launcher
    • File > Add Existing Application...
    • Set the Application Path to your the-blue-alliance directory
    • Set port 8088
  2. Run the app in App Engine Launcher and view its Logs window
  3. You should now have a basic development installation!
  4. Get some data into the local server
  5. Ignore these warnings in the local dev server:
    • pytz is required to calculate future run times for cron jobs with timezones (The pytz library is in the source tree and works fine.)

Run an App Engine server

See myTBA Configuration for how to create and configure an App Engine server.

Setup notes:

  • You could edit the app.yaml file to change its application: setting from tbatv-dev-hrd to your app's Project ID, but then you'll have to remember to not check in that edit. Better yet, write a script like the following mydeploy.sh file (that filename is in .gitignore):

      #!/bin/sh
      appcfg.py --oauth2 --application=<MY_PROJECT_ID> update
    
  • Note that it needs your application's "Project ID", not its "Project name".

  • The --oauth2 argument of appcfg.py saves repeating the login steps each time. If you skip it or deploy via the App Engine Launcher, you'll have to enter your name and password each time. If you use 2-Step Verification for your Google account (you should!), that means generating an App password each time.

  • The cron.yaml file in master will create cron jobs that use up daily free AE Datastore quotas.

    • To avoid that in a dev server, checkout a no-op version of cron.yaml.
    • If it's already happening in a dev server, deploy a no-op cron.yaml via appcfg.py update_cron, then delete the tasks in the usfirst queue.)
    • If you try to deploy a server while it's over Datastore quota, appcfg will say "there was an error updating your indexes. Please retry later with appcfg.py update_indexes." The fix is to wait until the next day's quota then use appcfg.py update_indexes or appcfg.py update.
  • When you set sitevars, the server automatically internalizes them.

  • You don't need a sitevar for firebase.secrets even though that's the placeholder text for a new sitevar name.

  • Ignore these deployment warnings:

    • Cannot upload both <filename>.py and <filename>.pyc
    • Could not guess mimetype for static/ovp/<filename>.xap. Using application/octet-stream.
    • WARNING old_run.py:88 This function, oauth2client.tools.run(), and the use of the gflags library are deprecated and will be removed in a future version of the library.
  • Ignore these warnings in a deployed server's logs:

    • Exception: Missing sitevar: firebase.secrets. Can't write to Firebase (It just means that no push notifications to GameDay will be sent, which is OK for a dev server.)

Notes:

Paver Commands

Paver is an easy way automate repetitive tasks. For The Blue Alliance, these tasks are stored in pavement.py. To install paver, use one of the methods below:

Paver commands include:

  • paver javascript -- combine and compress JavaScript files
  • paver less -- translate LESS files to CSS and combine with other CSS files
  • paver setup -- build CSS and JavaScript files
  • paver lint
  • paver test_fast -- run tests that don't require HTTP

CSS Icon Sprites

Icons get combined into single files called sprites to reduce the number of HTTP requests needed to render a page. To simplify development, we add icons normally (not to the sprite), and every so often we will combine them all into a sprite and fix all necessary CSS.

Potentially useful: http://spriteme.org/

Testing

Build Status

Testing is implemented using a combination of unittest2 and the Google App Engine testbed framework. Test coverage is a work in progress, and focuses on maintaining datafeed integrity in the face of optimizations and changes to FIRST's data formats.

To run the tests, or just the offline (fast) tests:

  • paver test
  • paver test_fast

About

A webapp for accessing information about the FIRST Robotics Competition.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 70.5%
  • Python 20.9%
  • CSS 4.9%
  • JavaScript 3.5%
  • PHP 0.1%
  • Ruby 0.1%