Skip to content

Commit

Permalink
Remove promotion and releases repo [#415]
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias committed Jan 17, 2016
1 parent b7947ca commit e61cd07
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 415 deletions.
3 changes: 0 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
:exclusions
[org.apache.httpcomponents/httpcore
commons-logging]]
[s3-wagon-private "1.0.0"]
[compojure "1.3.3"]
[ring-middleware-format "0.5.0"]
[hiccup "1.0.3"]
Expand All @@ -31,8 +30,6 @@
[valip "0.2.0" :exclusions [commons-logging]]
[clucy "0.3.0"]
[org.clojure/tools.nrepl "0.2.11"]
[org.bouncycastle/bcpg-jdk15on "1.47"]
[mvxcvi/clj-pgp "0.8.0"]
[yesql "0.5.1"]
[com.stuartsierra/component "0.2.3"]
[duct/hikaricp-component "0.1.0"]
Expand Down
35 changes: 3 additions & 32 deletions resources/queries/sqlite-queryfile.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ SELECT user
FROM groups
WHERE name = :groupname;

--name: group-keys
SELECT users.pgp_key
FROM groups
INNER JOIN users
ON users.user = groups.user
WHERE groups.name = :groupname;

--name: jars-by-username
SELECT j.*
FROM jars j
Expand Down Expand Up @@ -183,20 +176,20 @@ WHERE group_name || '/' || jar_name < :s;

--name: insert-user!
INSERT INTO 'users' (email, user, password, pgp_key, created, ssh_key, salt)
VALUES (:email, :username, :password, :pgp_key, :created, '', '');
VALUES (:email, :username, :password, '', :created, '', '');

--name: insert-group!
INSERT INTO 'groups' (name, user)
VALUES (:groupname, :username);

--name: update-user!
UPDATE users
SET email = :email, user = :username, pgp_key = :pgp_key, password_reset_code = NULL, password_reset_code_created_at = NULL
SET email = :email, user = :username, pgp_key = '', password_reset_code = NULL, password_reset_code_created_at = NULL
WHERE user = :account;

--name: update-user-with-password!
UPDATE users
SET email = :email, user = :username, pgp_key = :pgp_key, password = :password, password_reset_code = NULL, password_reset_code_created_at = NULL
SET email = :email, user = :username, pgp_key = '', password = :password, password_reset_code = NULL, password_reset_code_created_at = NULL
WHERE user = :account;

--name: reset-user-password!
Expand Down Expand Up @@ -293,28 +286,6 @@ VALUES (:groupname, :username, :added_by);
INSERT INTO jars (group_name, jar_name, version, user, created, description, homepage, authors)
VALUES (:groupname, :jarname, :version, :user, :created, :description, :homepage, :authors);

--name: promote!
UPDATE jars
SET promoted_at = :promoted_at
WHERE (
group_name = :group_id
AND
jar_name = :artifact_id
AND
version = :version
);

--name: promoted
SELECT promoted_at
FROM jars
WHERE (
group_name = :group_id
AND
jar_name = :artifact_id
AND
version = :version
);

--name: delete-groups-jars!
DELETE FROM jars
WHERE group_name = :group_id;
Expand Down
3 changes: 0 additions & 3 deletions src/clojars/config.clj
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@
["REPO" :repo]
["DELETION_BACKUP_DIR" :deletion-backup-dir]
["NREPL_PORT" :nrepl-port #(Integer/parseInt %)]
["RELEASES_URL" :releases-url]
["RELEASES_ACCESS_KEY" :releases-access-key]
["RELEASES_SECRET_KEY" :releases-secret-key]
["YELLER_ENV" :yeller-environment]
["YELLER_TOKEN" :yeller-token]])

Expand Down
27 changes: 3 additions & 24 deletions src/clojars/db.clj
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@
{:connection db
:row-fn :user}))

(defn group-keys [db groupname]
(sql/group-keys {:groupname groupname}
{:connection db
:row-fn :pgp_key}))

(defn jars-by-username [db username]
(sql/jars-by-username {:username username}
{:connection db}))
Expand Down Expand Up @@ -175,9 +170,9 @@
`(serialize-task* ~name
(fn [] ~@body)))

(defn add-user [db email username password pgp-key]
(defn add-user [db email username password]
(let [record {:email email, :username username, :password (bcrypt password),
:pgp_key pgp-key :created (get-time)}
:created (get-time)}
groupname (str "org.clojars." username)]
(serialize-task :add-user
(sql/insert-user! record
Expand All @@ -186,10 +181,9 @@
{:connection db}))
record))

(defn update-user [db account email username password pgp-key]
(defn update-user [db account email username password]
(let [fields {:email email
:username username
:pgp_key pgp-key
:account account}]
(serialize-task :update-user
(if (empty? password)
Expand Down Expand Up @@ -302,18 +296,3 @@
(sql/find-groups-jars-information {:group_id group-id}
{:connection db}))))

(defn promote [db group name version]
(serialize-task :promote
(sql/promote! {:group_id group
:artifact_id name
:version version
:promoted_at (get-time)}
{:connection db})))

(defn promoted? [db group-id artifact-id version]
(sql/promoted {:group_id group-id
:artifact_id artifact-id
:version version}
{:connection db
:result-set-fn first
:row-fn :promoted_at}))
13 changes: 5 additions & 8 deletions src/clojars/friend/registration.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,18 @@
[clojars.db :refer [add-user]]
[valip.core :refer [validate]]))

(defn register [db {:keys [email username password confirm pgp-key]}]
(let [pgp-key (and pgp-key (.trim pgp-key))
email (and email (.trim email))]
(defn register [db {:keys [email username password confirm]}]
(let [email (and email (.trim email))]
(if-let [errors (apply validate {:email email
:username username
:password password
:pgp-key pgp-key}
:password password}
(new-user-validations db confirm))]
(->
(response (register-form {:errors (apply concat (vals errors))
:email email
:username username
:pgp-key pgp-key}))
:username username}))
(content-type "text/html"))
(do (add-user db email username password pgp-key)
(do (add-user db email username password)
(workflow/make-auth {:identity username :username username})))))

(defn workflow [db]
Expand Down
143 changes: 0 additions & 143 deletions src/clojars/promote.clj

This file was deleted.

17 changes: 1 addition & 16 deletions src/clojars/routes/artifact.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
[clojars.auth :as auth]
[clojars.web.jar :as view]
[clojars.web.common :as common]
[clojars.promote :as promote]
[ring.util.response :as response]
[clojure.set :as set]))

Expand Down Expand Up @@ -87,18 +86,4 @@
:artifact-id #"[^/]+"
:file-format #"(svg|json)$"]
[group-id artifact-id file-format]
(response-based-on-format db file-format artifact-id group-id))

#_(POST ["/:group-id/:artifact-id/promote/:version"
:group-id #"[^/]+" :artifact-id #"[^/]+" :version #"[^/]+"]
[group-id artifact-id version]
(auth/with-account
(auth/require-authorization
db
group-id
(if-let [jar (db/find-jar db group-id artifact-id version)]
(do (promote/promote db (set/rename-keys jar {:jar_name :name
:group_name :group}))
(response/redirect
(common/jar-url {:group_name group-id
:jar_name artifact-id})))))))))
(response-based-on-format db file-format artifact-id group-id))))
29 changes: 1 addition & 28 deletions src/clojars/web/jar.clj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
[clojars.maven :refer [jar-to-pom-map commit-url github-info]]
[clojars.auth :refer [authorized?]]
[clojars.db :refer [find-jar jar-exists]]
[clojars.promote :refer [blockers]]
[clojars.stats :as stats]
[clojure.set :as set]
[ring.util.codec :refer [url-encode]]
Expand Down Expand Up @@ -56,31 +55,6 @@
(when (jar-fork? jar)
single-fork-notice))

(defn promoted? [jar]
(:promoted_at jar))

(defn promoted-at [jar]
[:p (str "Promoted at " (java.util.Date. (:promoted_at jar)))])

(defn promotion-issues [db jar]
(seq (blockers db (set/rename-keys jar {:group_name :group
:jar_name :name}))))

(defn promotion-details [db account jar]
(when (authorized? db account (:group_name jar))
(list [:h2 "Promotion"]
(if (promoted? jar)
(promoted-at jar)
[:p "Promotion currently disabled"]
#_(if-let [issues (promotion-issues db jar)]
(list [:h3 "Issues Blocking Promotion"]
[:ul#blockers
(for [i issues]
[:li i])])
(form-to [:post (str "/" (:group_name jar) "/" (:jar_name jar)
"/promote/" (:version jar))]
(submit-button "Promote")))))))

(defn show-jar [db reporter stats account jar recent-versions count]
(html-doc (str (:jar_name jar) " " (:version jar)) {:account account}
(let [pom-map (jar-to-pom-map reporter jar)]
Expand Down Expand Up @@ -146,8 +120,7 @@
(tag " <version>") (:version jar) (tag "</version>\n")
(tag "</dependency>")]]
(list
(fork-notice jar)
(promotion-details db account jar))]
(fork-notice jar))]
[:ul#jar-sidebar.col-sm-3.col-xs-12.col-md-3.col-lg-3
[:li
[:h4 "Pushed by"]
Expand Down
Loading

0 comments on commit e61cd07

Please sign in to comment.