Remove deprecated :use directives and add some aliases

This commit is contained in:
Aaron Mueller 2014-04-24 23:26:24 +02:00
parent 7cce88f523
commit c3380a2860
11 changed files with 29 additions and 27 deletions

View file

@ -23,8 +23,9 @@
:init ldview.handler/init :init ldview.handler/init
:destroy ldview.handler/destroy :destroy ldview.handler/destroy
:open-browser? false} :open-browser? false}
:profiles { :aliases {"start-over" ["run" "-m" "ldview.tasks.runner/reset-all!"]
:production {:ring {:stacktraces? false}} "fetch-competition" ["run" "-m" "ldview.tasks.runner/load-competition" "28"]}
:profiles {:production {:ring {:stacktraces? false}}
:dev {:ring {:auto-reload? true :dev {:ring {:auto-reload? true
:auto-refresh? true} :auto-refresh? true}
:dependencies [[ring-mock "0.1.5"] :dependencies [[ring-mock "0.1.5"]

View file

@ -1,7 +1,7 @@
(ns ldview.db (ns ldview.db
(:use korma.core (:require [ldview.models.schema :as schema]
[korma.db :only (defdb)]) [korma.core :refer :all]
(:require [ldview.models.schema :as schema])) [korma.db :refer [defdb]]))
(defdb db schema/db-spec) (defdb db schema/db-spec)

View file

@ -1,6 +1,6 @@
(ns ldview.models.competition (ns ldview.models.competition
(:use korma.core (:require [korma.core :refer :all]
[ldview.db])) [ldview.db :refer :all]))
(defn latest [] (defn latest []
(first (select competitions (first (select competitions

View file

@ -1,7 +1,7 @@
(ns ldview.models.entry (ns ldview.models.entry
(:use korma.core (:require [korma.core :refer :all]
[ldview.db]) [ldview.db :refer :all]
(:require [ldview.models.user :as user] [ldview.models.user :as user]
[ldview.models.competition :as competition] [ldview.models.competition :as competition]
[ldview.models.source :as source])) [ldview.models.source :as source]))

View file

@ -1,6 +1,6 @@
(ns ldview.models.source (ns ldview.models.source
(:use korma.core (:require [korma.core :refer :all]
[ldview.db])) [ldview.db :refer :all]))
(defn create! [entry_id uri title] (defn create! [entry_id uri title]
; (if (empty? (select sources (where {:entry_id entry_id :type title}))) ; (if (empty? (select sources (where {:entry_id entry_id :type title})))

View file

@ -1,6 +1,6 @@
(ns ldview.models.user (ns ldview.models.user
(:use korma.core (:require [korma.core :refer :all]
[ldview.db])) [ldview.db :refer :all]))
(defn user-id [username] (defn user-id [username]
(first (select users (first (select users

View file

@ -1,7 +1,7 @@
(ns ldview.repl (ns ldview.repl
(:use ldview.handler (:require [ldview.handler :refer :all]
ring.server.standalone [ring.server.standalone :refer :all]
[ring.middleware file-info file])) [ring.middleware :refer [file-info file]]))
(defonce server (atom nil)) (defonce server (atom nil))

View file

@ -1,7 +1,7 @@
(ns ldview.routes (ns ldview.routes
(:use compojure.core)
(:require [ldview.models.entry :as entry] (:require [ldview.models.entry :as entry]
[ldview.templates :as templates])) [ldview.templates :as templates]
[compojure.core :refer :all]))
; TODO: Replace with enlive template stuff ; TODO: Replace with enlive template stuff
(defn entries-page [] (defn entries-page []

View file

@ -6,8 +6,9 @@
[clojure.java.io :as io] [clojure.java.io :as io]
[noir.io :as noir-io])) [noir.io :as noir-io]))
(defn base-path [competition-id] (defn base-path
(str (noir-io/resource-path) "img/ld" competition-id "/")) ([] (str (noir-io/resource-path) "img"))
([competition-id] (str (base-path) "/ld" competition-id "/")))
(defn image-name [competition-id folder entry-id number] (defn image-name [competition-id folder entry-id number]
(str (base-path competition-id) folder "/" entry-id "_" number ".png")) (str (base-path competition-id) folder "/" entry-id "_" number ".png"))

View file

@ -7,6 +7,7 @@
[ldview.models.schema :as schema] [ldview.models.schema :as schema]
[noir.io :as io])) [noir.io :as io]))
(defn delete-database! [] (defn delete-database! []
(let [db-file (str (io/resource-path) schema/db-store)] (let [db-file (str (io/resource-path) schema/db-store)]
(if (fs/exists? db-file) (fs/delete db-file)))) (if (fs/exists? db-file) (fs/delete db-file))))
@ -44,13 +45,12 @@
(save-entry! competition-id (scrape/entry-details competition-id ld-uid)))))) (save-entry! competition-id (scrape/entry-details competition-id ld-uid))))))
(defn load-competition [competition-id] (defn load-competition [competition-id]
(if-not (schema/initialized?) (if-not (schema/initialized?) (schema/create-initial-tables))
(schema/create-initial-tables))
(initialize-file-structure! competition-id) (initialize-file-structure! competition-id)
(competition/create! competition-id (scrape/theme competition-id)) (competition/create! competition-id (scrape/theme competition-id))
(fetch-all-content competition-id)) (fetch-all-content competition-id))
(defn wipe-all!! [] (defn reset-all! []
(delete-database!) (delete-database!)
(fs/delete-dir (images/base-path))
(schema/create-initial-tables)) (schema/create-initial-tables))

View file

@ -1,8 +1,8 @@
(ns ldview.tasks.scrape (ns ldview.tasks.scrape
(:require [net.cgrand.enlive-html :as html] (:require [net.cgrand.enlive-html :as html]
[clj-http.client :as http] [clj-http.client :as http]
[clojure.java.io :as io]) [clojure.java.io :as io]
(:use [clojure.string :only (split)])) [clojure.string :refer [split]]))
(defn url-action [competition-id action] (defn url-action [competition-id action]
(str "http://www.ludumdare.com/compo/ludum-dare-" competition-id "/?action=" action)) (str "http://www.ludumdare.com/compo/ludum-dare-" competition-id "/?action=" action))