macaullyjames / evabot Goto Github PK
View Code? Open in Web Editor NEWEva: The human-friendly static analysis bot
License: Apache License 2.0
Eva: The human-friendly static analysis bot
License: Apache License 2.0
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
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 ๐ค
It's probably a good idea if users can sign up ยฏ_(ใ)_/ยฏ
"Login with Github" button
[user:email, repo, admin:org, admin:repo_hook]
(for the time being)redirect_uri
since we set it when we registered the applicationLogin controller that handles the OAuth callback
/login
/login?code=something
where the code
parameter is set by GithubPOST
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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.