Prepare for deployment + bugfixes
Add empty css directory (again) Remove sassc hook (Heroku)
This commit is contained in:
parent
7f6cb564a0
commit
520e5e34e4
|
@ -13,5 +13,4 @@ profiles.clj
|
|||
.idea
|
||||
*.iml
|
||||
*.ipr
|
||||
/resources/public/css/screen.css
|
||||
*.log
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{:dev true
|
||||
:port 3000
|
||||
{:dev true
|
||||
:port 3000
|
||||
;; when :nrepl-port is set the application starts the nREPL server on load
|
||||
:nrepl-port 7000}
|
||||
:nrepl-port 7000
|
||||
:database-url "jdbc:postgresql://localhost/commiteth?user=commiteth&password=commiteth"
|
||||
:server-address "http://localhost:3000"
|
||||
:github-client-id "caf23d90246fa99ca545"
|
||||
:github-client-secret "e8e7a088e7769c77e9e2d87c47ef81df51080bf3"}
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
{:production true
|
||||
:port 3000}
|
||||
{:production true
|
||||
:port 3000
|
||||
:database-url "jdbc:postgresql://ec2-54-217-213-203.eu-west-1.compute.amazonaws.com:5432/d7cku33rlq0j96?user=wehpnfptnwmvwn&password=YpJoD1AmgPN4FMyQHl1FO3bWmI"
|
||||
:server-address "http://commiteth.herokuapp.com"
|
||||
:github-client-id "eaf23cff7b5fbdf716a6"
|
||||
:github-client-secret "a31af857986c8385b95962c7a590033513ef24d9"}
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<charset>UTF-8</charset>
|
||||
<pattern>%date{ISO8601} [%thread] %-5level %logger{36} - %msg %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>log/commiteth.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
|
@ -22,7 +30,8 @@
|
|||
<logger name="com.zaxxer.hikari" level="warn">
|
||||
<AppenderRef ref="FILE"/>
|
||||
</logger>
|
||||
<root level="INFO">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{:test true
|
||||
:port 3001
|
||||
{:test true
|
||||
:port 3001
|
||||
;; when :nrepl-port is set the application starts the nREPL server on load
|
||||
:nrepl-port 7001}
|
||||
:nrepl-port 7001
|
||||
:database-url "jdbc:postgresql://localhost/commiteth?user=commiteth&password=commiteth"
|
||||
:server-address "http://localhost:3000"
|
||||
:github-client-id "caf23d90246fa99ca545"
|
||||
:github-client-secret "e8e7a088e7769c77e9e2d87c47ef81df51080bf3"}
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
:auto
|
||||
{"sassc" {:file-pattern #"\.(scss|sass)$" :paths ["resources/scss"]}}
|
||||
|
||||
:hooks [leiningen.sassc]
|
||||
:clean-targets ^{:protect false}
|
||||
[:target-path [:cljsbuild :builds :app :compiler :output-dir] [:cljsbuild :builds :app :compiler :output-to]]
|
||||
:figwheel
|
||||
|
|
|
@ -22,17 +22,20 @@ CREATE TABLE repositories
|
|||
|
||||
CREATE TABLE issues
|
||||
(
|
||||
issue_id INTEGER PRIMARY KEY NOT NULL,
|
||||
repo_id INTEGER NOT NULL,
|
||||
address VARCHAR(256),
|
||||
repo_id INTEGER NOT NULL,
|
||||
issue_id INTEGER NOT NULL,
|
||||
issue_number INTEGER,
|
||||
commit_id VARCHAR(40)
|
||||
title VARCHAR(256),
|
||||
address VARCHAR(256),
|
||||
commit_id VARCHAR(40),
|
||||
CONSTRAINT issues_repo_id_issue_id_pk PRIMARY KEY (repo_id, issue_id)
|
||||
);
|
||||
|
||||
CREATE TABLE pull_requests
|
||||
(
|
||||
pr_id INTEGER PRIMARY KEY NOT NULL,
|
||||
repo_id INTEGER,
|
||||
user_id INTEGER,
|
||||
parents VARCHAR(4099) -- 100 commit SHAs + 99 commas
|
||||
pr_id INTEGER PRIMARY KEY NOT NULL,
|
||||
pr_number INTEGER,
|
||||
repo_id INTEGER,
|
||||
user_id INTEGER,
|
||||
parents VARCHAR(4099) -- 100 commit SHAs + 99 commas
|
||||
);
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
html, body {
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
height: 100%;
|
||||
padding-top: 0px; }
|
||||
|
||||
.app {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
max-width: 100%; }
|
||||
|
||||
.container {
|
||||
padding-top: 20px; }
|
||||
|
||||
.profile-settings button {
|
||||
margin-top: 20px; }
|
||||
|
||||
.profile-link {
|
||||
display: inline-block;
|
||||
padding-top: .425rem;
|
||||
padding-bottom: .425rem;
|
||||
padding-right: 1em;
|
||||
color: rgba(0, 0, 0, 0.3); }
|
||||
|
||||
.navbar-toggler, .nav-item {
|
||||
float: left;
|
||||
display: inline-block;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px; }
|
||||
|
||||
h3 {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 20px; }
|
|
@ -51,16 +51,17 @@ RETURNING repo_id, login, repo, enabled, hook_id;
|
|||
|
||||
-- :name create-repository! :<! :1
|
||||
-- :doc creates repository if not exists
|
||||
INSERT INTO repositories (repo_id, login, repo, enabled)
|
||||
INSERT INTO repositories (repo_id, user_id, login, repo, enabled)
|
||||
SELECT
|
||||
:repo_id,
|
||||
:user_id,
|
||||
:login,
|
||||
:repo,
|
||||
:enabled
|
||||
WHERE NOT exists(SELECT 1
|
||||
FROM repositories
|
||||
WHERE repo_id = :repo_id)
|
||||
RETURNING repo_id, login, repo, enabled;
|
||||
RETURNING repo_id, user_id, login, repo, enabled;
|
||||
|
||||
-- :name get-enabled-repositories :? :*
|
||||
-- :doc returns enabled repositories for a given login
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
[tentacles.repos :as repos]
|
||||
[tentacles.issues :as issues]
|
||||
[ring.util.codec :as codec]
|
||||
[clj-http.client :as http])
|
||||
[clj-http.client :as http]
|
||||
[commiteth.config :refer [env]])
|
||||
(:import [java.util UUID]))
|
||||
|
||||
(def client-id "caf23d90246fa99ca545")
|
||||
(def client-secret "e8e7a088e7769c77e9e2d87c47ef81df51080bf3")
|
||||
(def redirect-uri "http://localhost:3000/callback")
|
||||
(defn server-address [] (:server-address env))
|
||||
(defn client-id [] (:github-client-id env))
|
||||
(defn client-secret [] (:github-client-secret env))
|
||||
(defn redirect-uri [] (str (server-address) "/callback"))
|
||||
(def allow-signup true)
|
||||
(def hook-secret "Mu0eiV8ooy7IogheexathocaiSeLeineiLue0au8")
|
||||
|
||||
|
@ -18,8 +20,8 @@
|
|||
(def self-password "Fahh7ithoh8Ahghe")
|
||||
|
||||
(defn authorize-url []
|
||||
(let [params (codec/form-encode {:client_id client-id
|
||||
:redirect_uri redirect-uri
|
||||
(let [params (codec/form-encode {:client_id (client-id)
|
||||
:redirect_uri (redirect-uri)
|
||||
:scope "admin:repo_hook"
|
||||
:allow_signup allow-signup
|
||||
:state (str (UUID/randomUUID))})]
|
||||
|
@ -29,17 +31,17 @@
|
|||
[code state]
|
||||
(http/post "https://github.com/login/oauth/access_token"
|
||||
{:content-type :json
|
||||
:form-params {:client_id client-id
|
||||
:client_secret client-secret
|
||||
:form-params {:client_id (client-id)
|
||||
:client_secret (client-secret)
|
||||
:code code
|
||||
:redirect_uri redirect-uri
|
||||
:redirect_uri (redirect-uri)
|
||||
:state state}}))
|
||||
|
||||
(defn- auth-params
|
||||
[token]
|
||||
{:oauth-token token
|
||||
:client-id client-id
|
||||
:client-token client-secret})
|
||||
:client-id (client-id)
|
||||
:client-token (client-secret)})
|
||||
|
||||
(defn- self-auth-params []
|
||||
{:auth (str self ":" self-password)})
|
||||
|
@ -79,7 +81,7 @@
|
|||
[token user repo]
|
||||
(println "adding webhook")
|
||||
(repos/create-hook user repo "web"
|
||||
{:url "http://localhost:3000/webhook"
|
||||
{:url (str (server-address) "/webhook")
|
||||
:content_type "json"}
|
||||
(merge (auth-params token)
|
||||
{:events ["issues", "issue_comment", "pull_request"]
|
||||
|
|
|
@ -64,13 +64,15 @@
|
|||
(POST "/repository/toggle" {:keys [params]}
|
||||
:auth-rules authenticated?
|
||||
:current-user user
|
||||
(ok (let [repo-id (:id params)
|
||||
result (or
|
||||
(repositories/create params)
|
||||
(repositories/toggle repo-id))
|
||||
token (:token user)
|
||||
login (:login user)
|
||||
repo (:name params)]
|
||||
(ok (let [{repo-id :id
|
||||
repo :name} params
|
||||
{token :token
|
||||
login :login
|
||||
user-id :id} user
|
||||
result (or
|
||||
(repositories/create (merge params {:user_id user-id}))
|
||||
(repositories/toggle repo-id))
|
||||
]
|
||||
(if (:enabled result)
|
||||
;; @todo: do we really want to make this call at this moment?
|
||||
(let [created-hook (github/add-webhook token login repo)]
|
||||
|
|
Loading…
Reference in New Issue