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
:destroy ldview.handler/destroy
:open-browser? false}
:profiles {
:production {:ring {:stacktraces? false}}
:aliases {"start-over" ["run" "-m" "ldview.tasks.runner/reset-all!"]
"fetch-competition" ["run" "-m" "ldview.tasks.runner/load-competition" "28"]}
:profiles {:production {:ring {:stacktraces? false}}
:dev {:ring {:auto-reload? true
:auto-refresh? true}
:dependencies [[ring-mock "0.1.5"]

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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