Git Product home page Git Product logo

ofxaddons.com's Introduction

ofxAddons

The central place to discover openFrameworks addons.

Running app locally

Prerequisites

  1. Ruby 2.2.1
  2. Bundler
  3. PostgreSQL 9.x (recommend using homebrew or mac ports to install)
  4. Heroku Toolbelt

Setup

  1. Clone the repository:

     $ git clone https://github.com/atduskgreg/ofxaddons.com
    
  2. Change directories in to the cloned repository:

     $ cd ofxaddons.com
    
  3. Install the gems dependencies

     $ bundle install
    
  4. Set up the database.

    You have two basic options: start with an empty database, or grab a backup from heroku.

    Start with an empty database

     $ rake db:setup
    

    Copy the production database to your local machine

    This option is only available if you have access to the Heroku production server.

    WARNING: the database ofxaddons will be overwritten!

     $ heroku login
    
     $ rake heroku:production:db:pull
    
  5. Create a dotenv file:

    WARNING: Never check in the .env file. It will screw up the production environment.

     $ touch .env
    

    Open up .env and add the following lines:

     PORT=5000
     WEB_CONCURRENCY=1
    
  6. Launch the server:

     $ foreman start
    

    You should now be able to navigate to load the web site at http://localhost:5000

Crawling

API Keys

If you want to avoid rate limiting (hint: you do) with the Github API then you need to register a new application and get some API keys.

API keys are strictly optional. If you don't use them, the app will run fine, but you'll be subject to rate limiting. After you make a few thousand requests Github will start rejecting your requests.

Once you've got your API keys, there are several ways to set up your environment, but here's one way using Foreman.

  1. Create a .env file in the repository root

     $ touch .env
    

    WARNING: Never check in the .env file. It will screw up the production environment.

  2. Add your API key and secret to the file:

     GITHUB_CLIENT_ID=xxxxxxxxxxxxxxxxxxxx
     GITHUB_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
  3. Restart Foreman

Further reading on using foreman for config vars.

Running a Crawl

Crawling and updating is run through the script runner:

$ ./bin/rails r 'Importer.new.run'

The importer currently logs into the rails log for whatever env you're running, which you can watch with:

$ tail -f log/development.log
Caching

By default the importer uses caching in the development environment. This helps speed up development when you're working on the importer since you skip all the HTTP request overhead and just read the responses off of the local disk. You can blow away the caches with rake tmp:cache:clear. Or you can manually delete individual caches files in tmp/caches/importer.

You can force caching behaiour by passing an options hash to run:

$ rails r 'Importer.run(cache: false)'

If you pass cache: true, the importer will use cached responses from the github API (if available).

ofxaddons.com's People

Contributors

atduskgreg avatar csugrue avatar cyrildiagne avatar halfdanj avatar hamoid avatar jamesdwellable avatar jamezilla avatar obviousjim avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.