Code Monkey home page Code Monkey logo

evabot's People

Watchers

 avatar  avatar

Forkers

mictab

evabot's Issues

<Owner> ::= <User> | <Organisation>

Sometimes repos are owned by a User, sometimes repos are owned by an Organisation. We could tidy up the code a bit by creating an abstract Owner model like this:

class Owner < ApplicationRecord
  has_one :user_or_org, polymorphic: true
end
class User < ApplicationRecord
  belongs_to :owner, as: :user_or_org
end

class Organization < ApplicationRecord
  belongs_to :owner, as: :user_or_org
end

This way repos could be accessed with an OwnersController like so: /owners/:owner_id/repos/:repo:id. We could tidy this up even more by using the owners'/repos' names instead of their ids for Github-like urls (/macaullyjames/evabot) and some routing magic:

# config/routes.rb
resource :owners, path: "" do
  resource :repos, path: ""
end
class Owner < ApplicationRecord
  # ...
  def to_param
    login
  end
end

class Repo < ApplicationRecord
  # ...
  def to_param
    "#{owner.login}/#{name}"
  end
end

Upgrade Rails

Rails 5.0.0.rc2 was released a short while ago. The deployment scripts will likely have to reworked, I don't think they take into account the fact that gems might need to be upgraded ๐Ÿค”

Basic OAuth flow

It's probably a good idea if users can sign up ยฏ_(ใƒ„)_/ยฏ

"Login with Github" button

  • Should link to https://github.com/login/oauth/authorize
  • Scopes: [user:email, repo, admin:org, admin:repo_hook] (for the time being)
  • Don't need to set redirect_uri since we set it when we registered the application

Login controller that handles the OAuth callback

  • Should probably be at /login
  • Requests look like /login?code=something where the code parameter is set by Github
  • Should POST to https://github.com/login/oauth/access_token
    • Parameters client_id, client_secret and code should be set.

    • Set the header Accept: application/json for a JSON response

    • Response looks like this:

      {"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a", "scope":"repo,gist", "token_type":"bearer"}
    • After receiving the token we should create the rails user, log the client in and redirect them to the dashboard.

Relevant links
Github OAuth docs

CI should only deploy master branch

As seen in #1, Travis throws a fit when trying to test PRs because it can't decrypt the deploy key. It's probably a good idea to rewrite .travis.yml so that it doesn't push anything but the master branch ๐Ÿค” This should fix the PR workflow as well.

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.