diff --git a/project.clj b/project.clj index 6987a86dee166185418a5fd3797fc9d3e4638389..40a129d46750227d64e44885fc11c11d1e81e3ac 100644 --- a/project.clj +++ b/project.clj @@ -1,17 +1,28 @@ -(defproject metabase-init "0.1.0-SNAPSHOT" - :description "FIXME: write description" - :url "http://example.com/FIXME" +(defproject metabase "metabase-0.1.0-SNAPSHOT" + :description "Metabase Community Edition" + :url "http://metabase.com/" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.6.0"] [expectations "2.0.12"] ; unit tests [marginalia "0.7.1"] ; for documentation + [environ "0.5.0"] ; easy environment management + [org.clojure/tools.logging "0.3.1"] ; logging framework + [log4j/log4j "1.2.17" :exclusions [javax.mail/mail + javax.jms/jms + com.sun.jdmk/jmxtools + com.sun.jmx/jmxri]] + [korma "0.4.0"] ; SQL lib ] :plugins [[cider/cider-nrepl "0.8.2"] ; Interactive development w/ cider NREPL in Emacs + [lein-environ "0.5.0"] ; easy access to environment variables [lein-expectations "0.0.7"] ; run unit tests with 'lein expectations' + [lein-midje "3.1.3"] ; another unit testing option [lein-marginalia "0.7.0"] ; generate documentation with 'lein marg' ] - :main ^:skip-aot metabase-init.core + :main ^:skip-aot metabase.core :target-path "target/%s" - :profiles {:uberjar {:aot :all}}) + :profiles {:dev {:dependencies [[midje "1.6.3"]] + :jvm-opts ["-Dlogfile.path=target/log"]} + :uberjar {:aot :all}}) diff --git a/resources/log4j.properties b/resources/log4j.properties new file mode 100644 index 0000000000000000000000000000000000000000..d19fbb9fa189a4ce905afe47b435651783bb4f43 --- /dev/null +++ b/resources/log4j.properties @@ -0,0 +1,7 @@ +log4j.rootLogger=INFO, corvus +log4j.appender.corvus=org.apache.log4j.RollingFileAppender +log4j.appender.corvus.File=${logfile.path}/corvus.log +log4j.appender.corvus.MaxFileSize=500MB +log4j.appender.corvus.MaxBackupIndex=2 +log4j.appender.corvus.layout=org.apache.log4j.PatternLayout +log4j.appender.corvus.layout.ConversionPattern=%d [%t] %-5p%c - %m%n \ No newline at end of file diff --git a/src/metabase/core.clj b/src/metabase/core.clj new file mode 100644 index 0000000000000000000000000000000000000000..2afa7d46da5296960fdaf2bd7a5d276ce180a802 --- /dev/null +++ b/src/metabase/core.clj @@ -0,0 +1,14 @@ +(ns metabase.core + (:gen-class) + (:require [clojure.tools.logging :as log])) + +(defn -main + "I don't do a whole lot ... yet." + [& args] + (println "Hello, World!") + (log/info "testing logging")) + +(defn first-element [sequence default] + (if (nil? sequence) + default + (first sequence))) \ No newline at end of file diff --git a/src/metabase_init/core.clj b/src/metabase_init/core.clj deleted file mode 100644 index 062b362acc090df3b989c033d481ef8f7518d52d..0000000000000000000000000000000000000000 --- a/src/metabase_init/core.clj +++ /dev/null @@ -1,7 +0,0 @@ -(ns metabase-init.core - (:gen-class)) - -(defn -main - "I don't do a whole lot ... yet." - [& args] - (println "Hello, World!")) diff --git a/test/metabase/core_test.clj b/test/metabase/core_test.clj new file mode 100644 index 0000000000000000000000000000000000000000..b8577ecba8c795d893ff98ef2cd397bc4e519b6d --- /dev/null +++ b/test/metabase/core_test.clj @@ -0,0 +1,19 @@ +(ns metabase.core-test + (:use midje.sweet) + (:use [metabase.core]) + (:require [clojure.tools.logging :as log])) + +(println "You should expect to see three failures below.") +(log/info "testing out this logging") + +(facts "about `first-element`" + (fact "it normally returns the first element" + (first-element [1 2 3] :default) => 1 + (first-element '(1 2 3) :default) => 1) + + ;; I'm a little unsure how Clojure types map onto the Lisp I'm used to. + (fact "default value is returned for empty sequences" + (first-element [] :default) => :default + (first-element '() :default) => :default + (first-element nil :default) => :default + (first-element (filter even? [1 3 5]) :default) => :default)) diff --git a/test/metabase_init/core_test.clj b/test/metabase_init/core_test.clj deleted file mode 100644 index 89c2c58ba8c117a212781e8864dbbbf78a07137f..0000000000000000000000000000000000000000 --- a/test/metabase_init/core_test.clj +++ /dev/null @@ -1,6 +0,0 @@ -(ns metabase-init.core-test - (:use expectations) - (:require [metabase-init.core :refer :all])) - -;; Basic sanity check -(expect 2 (+ 1 1))