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
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
/resources/public/css/screen.css
|
|
||||||
*.log
|
*.log
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{:dev true
|
{:dev true
|
||||||
:port 3000
|
:port 3000
|
||||||
;; when :nrepl-port is set the application starts the nREPL server on load
|
;; 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
|
{:production true
|
||||||
:port 3000}
|
: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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
|
<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">
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<file>log/commiteth.log</file>
|
<file>log/commiteth.log</file>
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
@ -22,7 +30,8 @@
|
||||||
<logger name="com.zaxxer.hikari" level="warn">
|
<logger name="com.zaxxer.hikari" level="warn">
|
||||||
<AppenderRef ref="FILE"/>
|
<AppenderRef ref="FILE"/>
|
||||||
</logger>
|
</logger>
|
||||||
<root level="INFO">
|
<root level="DEBUG">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
<appender-ref ref="FILE" />
|
<appender-ref ref="FILE" />
|
||||||
</root>
|
</root>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{:test true
|
{:test true
|
||||||
:port 3001
|
:port 3001
|
||||||
;; when :nrepl-port is set the application starts the nREPL server on load
|
;; 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
|
:auto
|
||||||
{"sassc" {:file-pattern #"\.(scss|sass)$" :paths ["resources/scss"]}}
|
{"sassc" {:file-pattern #"\.(scss|sass)$" :paths ["resources/scss"]}}
|
||||||
|
|
||||||
:hooks [leiningen.sassc]
|
|
||||||
:clean-targets ^{:protect false}
|
:clean-targets ^{:protect false}
|
||||||
[:target-path [:cljsbuild :builds :app :compiler :output-dir] [:cljsbuild :builds :app :compiler :output-to]]
|
[:target-path [:cljsbuild :builds :app :compiler :output-dir] [:cljsbuild :builds :app :compiler :output-to]]
|
||||||
:figwheel
|
:figwheel
|
||||||
|
|
|
@ -22,17 +22,20 @@ CREATE TABLE repositories
|
||||||
|
|
||||||
CREATE TABLE issues
|
CREATE TABLE issues
|
||||||
(
|
(
|
||||||
issue_id INTEGER PRIMARY KEY NOT NULL,
|
repo_id INTEGER NOT NULL,
|
||||||
repo_id INTEGER NOT NULL,
|
issue_id INTEGER NOT NULL,
|
||||||
address VARCHAR(256),
|
|
||||||
issue_number INTEGER,
|
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
|
CREATE TABLE pull_requests
|
||||||
(
|
(
|
||||||
pr_id INTEGER PRIMARY KEY NOT NULL,
|
pr_id INTEGER PRIMARY KEY NOT NULL,
|
||||||
repo_id INTEGER,
|
pr_number INTEGER,
|
||||||
user_id INTEGER,
|
repo_id INTEGER,
|
||||||
parents VARCHAR(4099) -- 100 commit SHAs + 99 commas
|
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
|
-- :name create-repository! :<! :1
|
||||||
-- :doc creates repository if not exists
|
-- :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
|
SELECT
|
||||||
:repo_id,
|
:repo_id,
|
||||||
|
:user_id,
|
||||||
:login,
|
:login,
|
||||||
:repo,
|
:repo,
|
||||||
:enabled
|
:enabled
|
||||||
WHERE NOT exists(SELECT 1
|
WHERE NOT exists(SELECT 1
|
||||||
FROM repositories
|
FROM repositories
|
||||||
WHERE repo_id = :repo_id)
|
WHERE repo_id = :repo_id)
|
||||||
RETURNING repo_id, login, repo, enabled;
|
RETURNING repo_id, user_id, login, repo, enabled;
|
||||||
|
|
||||||
-- :name get-enabled-repositories :? :*
|
-- :name get-enabled-repositories :? :*
|
||||||
-- :doc returns enabled repositories for a given login
|
-- :doc returns enabled repositories for a given login
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
[tentacles.repos :as repos]
|
[tentacles.repos :as repos]
|
||||||
[tentacles.issues :as issues]
|
[tentacles.issues :as issues]
|
||||||
[ring.util.codec :as codec]
|
[ring.util.codec :as codec]
|
||||||
[clj-http.client :as http])
|
[clj-http.client :as http]
|
||||||
|
[commiteth.config :refer [env]])
|
||||||
(:import [java.util UUID]))
|
(:import [java.util UUID]))
|
||||||
|
|
||||||
(def client-id "caf23d90246fa99ca545")
|
(defn server-address [] (:server-address env))
|
||||||
(def client-secret "e8e7a088e7769c77e9e2d87c47ef81df51080bf3")
|
(defn client-id [] (:github-client-id env))
|
||||||
(def redirect-uri "http://localhost:3000/callback")
|
(defn client-secret [] (:github-client-secret env))
|
||||||
|
(defn redirect-uri [] (str (server-address) "/callback"))
|
||||||
(def allow-signup true)
|
(def allow-signup true)
|
||||||
(def hook-secret "Mu0eiV8ooy7IogheexathocaiSeLeineiLue0au8")
|
(def hook-secret "Mu0eiV8ooy7IogheexathocaiSeLeineiLue0au8")
|
||||||
|
|
||||||
|
@ -18,8 +20,8 @@
|
||||||
(def self-password "Fahh7ithoh8Ahghe")
|
(def self-password "Fahh7ithoh8Ahghe")
|
||||||
|
|
||||||
(defn authorize-url []
|
(defn authorize-url []
|
||||||
(let [params (codec/form-encode {:client_id client-id
|
(let [params (codec/form-encode {:client_id (client-id)
|
||||||
:redirect_uri redirect-uri
|
:redirect_uri (redirect-uri)
|
||||||
:scope "admin:repo_hook"
|
:scope "admin:repo_hook"
|
||||||
:allow_signup allow-signup
|
:allow_signup allow-signup
|
||||||
:state (str (UUID/randomUUID))})]
|
:state (str (UUID/randomUUID))})]
|
||||||
|
@ -29,17 +31,17 @@
|
||||||
[code state]
|
[code state]
|
||||||
(http/post "https://github.com/login/oauth/access_token"
|
(http/post "https://github.com/login/oauth/access_token"
|
||||||
{:content-type :json
|
{:content-type :json
|
||||||
:form-params {:client_id client-id
|
:form-params {:client_id (client-id)
|
||||||
:client_secret client-secret
|
:client_secret (client-secret)
|
||||||
:code code
|
:code code
|
||||||
:redirect_uri redirect-uri
|
:redirect_uri (redirect-uri)
|
||||||
:state state}}))
|
:state state}}))
|
||||||
|
|
||||||
(defn- auth-params
|
(defn- auth-params
|
||||||
[token]
|
[token]
|
||||||
{:oauth-token token
|
{:oauth-token token
|
||||||
:client-id client-id
|
:client-id (client-id)
|
||||||
:client-token client-secret})
|
:client-token (client-secret)})
|
||||||
|
|
||||||
(defn- self-auth-params []
|
(defn- self-auth-params []
|
||||||
{:auth (str self ":" self-password)})
|
{:auth (str self ":" self-password)})
|
||||||
|
@ -79,7 +81,7 @@
|
||||||
[token user repo]
|
[token user repo]
|
||||||
(println "adding webhook")
|
(println "adding webhook")
|
||||||
(repos/create-hook user repo "web"
|
(repos/create-hook user repo "web"
|
||||||
{:url "http://localhost:3000/webhook"
|
{:url (str (server-address) "/webhook")
|
||||||
:content_type "json"}
|
:content_type "json"}
|
||||||
(merge (auth-params token)
|
(merge (auth-params token)
|
||||||
{:events ["issues", "issue_comment", "pull_request"]
|
{:events ["issues", "issue_comment", "pull_request"]
|
||||||
|
|
|
@ -64,13 +64,15 @@
|
||||||
(POST "/repository/toggle" {:keys [params]}
|
(POST "/repository/toggle" {:keys [params]}
|
||||||
:auth-rules authenticated?
|
:auth-rules authenticated?
|
||||||
:current-user user
|
:current-user user
|
||||||
(ok (let [repo-id (:id params)
|
(ok (let [{repo-id :id
|
||||||
result (or
|
repo :name} params
|
||||||
(repositories/create params)
|
{token :token
|
||||||
(repositories/toggle repo-id))
|
login :login
|
||||||
token (:token user)
|
user-id :id} user
|
||||||
login (:login user)
|
result (or
|
||||||
repo (:name params)]
|
(repositories/create (merge params {:user_id user-id}))
|
||||||
|
(repositories/toggle repo-id))
|
||||||
|
]
|
||||||
(if (:enabled result)
|
(if (:enabled result)
|
||||||
;; @todo: do we really want to make this call at this moment?
|
;; @todo: do we really want to make this call at this moment?
|
||||||
(let [created-hook (github/add-webhook token login repo)]
|
(let [created-hook (github/add-webhook token login repo)]
|
||||||
|
|
Loading…
Reference in New Issue