Git Product home page Git Product logo

ghapp.sinatra.min's Introduction

Minimal Sinatra GitHub Application

This is the smallest working Sinatra application that authenticates via the GitHub OAuth2 stuff. This skeleton app exists simply because it took me a little while to figure out how to put all the pieces together to get to the point that I could start building something. So here you go.

Basically, to get this app running on Heroku, for instance, you will want to:

  • Register a new Heroku instance (you will have to use something other than 'ghmin')

      $ heroku apps:create ghmin
      Creating ghmin... done, stack is bamboo-mri-1.9.2
      http://ghmin.heroku.com/ | [email protected]:ghmin.git
      Git remote heroku added
    
  • Add SSL to your Heroku instance, since we are dealing with user tokens here

      $ heroku addons:add piggyback_ssl
      Adding piggyback_ssl to ghmin... done (free)
    
  • Register your GitHub OAuth2 application with that new URL (but https) at:

      https://github.com/account/applications/new
    

It should look something like this:

OAuth application screen

  • Set your Client Secret and Client ID as environment values in your Heroku instance

      $ heroku config:add GITHUB_CLIENT_SECRET=....
      $ heroku config:add GITHUB_CLIENT_ID=....
    
  • Push to Heroku

      $ git push heroku master
      Counting objects: 21, done.
      Delta compression using up to 2 threads.
      Compressing objects: 100% (19/19), done.
      Writing objects: 100% (21/21), 3.92 KiB, done.
      Total 21 (delta 3), reused 0 (delta 0)
    
      -----> Heroku receiving push
      -----> Sinatra app detected
      -----> Gemfile detected, running Bundler version 1.0.7
             Unresolved dependencies detected; Installing...
             Using --without development:test
    
             Fetching source index for http://rubygems.org/
             Installing addressable (2.2.6) 
             Installing multipart-post (1.1.2) 
             Installing rack (1.3.0) 
             Installing faraday (0.6.1) 
             Installing json (1.5.3) with native extensions 
             Installing mime-types (1.16) 
             Installing multi_json (1.0.3) 
             Installing oauth2 (0.4.1) 
             Installing rest-client (1.6.3) 
             Installing tilt (1.3.2) 
             Installing sinatra (1.2.6) 
             Installing warden (1.0.4) 
             Installing warden-github (0.0.9) 
             Installing sinatra_auth_github (0.0.16) 
             Using bundler (1.0.7) 
             Your bundle is complete! It was installed into ./.bundle/gems/
      -----> Compiled slug size is 1.4MB
      -----> Launching... done, v8
             http://ghmin.heroku.com deployed to Heroku
    
      To [email protected]:ghmin.git
       * [new branch]      master -> master
    

Boom.

That should be it, you should now have a running application that allows users to authenticate via GitHub so you can now use the extensive API to do whatever you wish.

Next you will probably want to read through the app.rb file and start modifying stuff. Good luck!

ghapp.sinatra.min's People

Contributors

atmos avatar schacon avatar

Stargazers

 avatar

Watchers

 avatar  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.