Permalink
Browse files

Added storing of version to functions table, see database/store-var-map

  • Loading branch information...
1 parent 820fd81 commit bb6a6079e823c51a449d10f8be30a9feab01b11d @zk committed Sep 30, 2010
Showing with 41 additions and 36 deletions.
  1. +2 −2 project.clj
  2. +2 −1 src/cd_analyzer/core.clj
  3. +5 −3 src/cd_analyzer/database.clj
  4. +32 −30 src/cd_analyzer/libs.clj
View
@@ -1,7 +1,7 @@
(defproject cd-analyzer "0.1.0-SNAPSHOT"
:description "FIXME: write"
- :dependencies [[org.clojure/clojure "1.2.0-RC1"]
- [org.clojure/clojure-contrib "1.2.0-RC1"]
+ :dependencies [[org.clojure/clojure "1.2.0"]
+ [org.clojure/clojure-contrib "1.2.0"]
[mysql/mysql-connector-java "5.1.12"]
[org.slf4j/slf4j-api "1.6.1"]
[ch.qos.logback/logback-classic "0.9.24"]
View
@@ -167,7 +167,7 @@
(reportln)
(doseq [v (sort-by :name vars)]
(report (indt) (:name v) (pad (:name v)) "(var)")
- (if ((store-var-map (:name library)) v)
+ (if ((store-var-map (:name library) (:version library)) v)
(reportln " Ok")
(reportln " Error")))
(reportln)
@@ -205,4 +205,5 @@
(report-on-lib (parse-clojure-contrib (File. root-dir))))
#_(run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
+#_(run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib")
#_(pprint (parse-clojure-core (File. "/Users/zkim/clojurelibs/clojure")))
@@ -171,7 +171,7 @@ string, which looks nasty when you display it."
(with-query-results rs ["select * from functions where ns=? and name=?" ns name]
(first rs)))))
-(defn store-var-map [lib]
+(defn store-var-map [lib version]
(fn [var-map]
(try
(let [{:keys [ns name file line arglists added doc source]} var-map]
@@ -184,6 +184,7 @@ string, which looks nasty when you display it."
:functions
["id=?" (:id existing)]
{:library lib
+ :version version
:ns (str ns)
:name (str name)
:file file
@@ -196,8 +197,9 @@ string, which looks nasty when you display it."
:updated_at (java.sql.Timestamp. (System/currentTimeMillis))})
(insert-values
:functions
- [:library :ns :name :file :line :arglists_comp :added :doc :shortdoc :source :updated_at :created_at]
+ [:library :version :ns :name :file :line :arglists_comp :added :doc :shortdoc :source :updated_at :created_at]
[lib
+ version
(str ns)
(str name)
file
@@ -258,7 +260,7 @@ string, which looks nasty when you display it."
[:name :doc :source_url :created_at :updated_at]
[name doc web-path (sql-now) (sql-now)]))))))
-(defn store-var-references [var-map]
+(defn store-var-references var-map
(when-let [vars-in (:vars-in var-map)]
(try
(with-connection *db*
View
@@ -3,42 +3,44 @@
[cd-analyzer.runner]
[cd-analyzer.database]))
+;;
+;; Scratch file, ignore.
+;;
+
#_(time
- (do
- (run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
- (run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib")
- (run-update "/Users/zkim/clojurelibs/leiningen")
- (run-update "/Users/zkim/clojurelibs/swank-clojure")
- (run-update "/Users/zkim/clojurelibs/clj-ssh")
- (run-update "/Users/zkim/clojurelibs/pallet")
- (run-update "/Users/zkim/clojurelibs/enlive")
- (run-update "/Users/zkim/clojurelibs/circumspec")
- (run-update "/Users/zkim/clojurelibs/Midje")
- (run-update "/Users/zkim/clojurelibs/ring")
- (run-update "/Users/zkim/clojurelibs/incanter")
- (run-update "/Users/zkim/clojurelibs/trammel")))
-
-#_(run-update "/Users/zkim/clojurelibs/ring")
+ (do
+ (run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
+ (run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib")
+ (run-update "/Users/zkim/clojurelibs/leiningen")
+ (run-update "/Users/zkim/clojurelibs/swank-clojure")
+ (run-update "/Users/zkim/clojurelibs/clj-ssh")
+ (run-update "/Users/zkim/clojurelibs/pallet")
+ (run-update "/Users/zkim/clojurelibs/enlive")
+ (run-update "/Users/zkim/clojurelibs/circumspec")
+ (run-update "/Users/zkim/clojurelibs/Midje")
+ (run-update "/Users/zkim/clojurelibs/ring")
+ (run-update "/Users/zkim/clojurelibs/incanter")
+ (run-update "/Users/zkim/clojurelibs/trammel")))
+
+(run-update "/Users/zkim/clojurelibs/ring")
#_(run-update-and-log "./logs/enlive-import.log" "http://github.com/cgrand/enlive.git")
#_(binding [*db* {:classname "com.mysql.jdbc.Driver"
- :subprotocol "mysql"
- :subname "//localhost:4444/clojuredocs?user=root&password=gammaClojureDocs1024"
- :create true
- :username "root"
- :password "gammaClojureDocs1024"}]
- (run-update-clojure-core "/Users/zkim/clojurelibs/clojure"))
+ :subprotocol "mysql"
+ :subname "//localhost:4444/clojuredocs?user=root&password=gammaClojureDocs1024"
+ :create true
+ :username "root"
+ :password "gammaClojureDocs1024"}]
+ (run-update-clojure-core "/Users/zkim/clojurelibs/clojure"))
-(binding [*db* {:classname "com.mysql.jdbc.Driver"
- :subprotocol "mysql"
- :subname "//localhost:4444/clojuredocs?user=root&password=gammaClojureDocs1024"
- :create true
- :username "root"
- :password "gammaClojureDocs1024"}]
- (run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib"))
+#_ (binding [*db* {:classname "com.mysql.jdbc.Driver"
+ :subprotocol "mysql"
+ :subname "//localhost:4444/clojuredocs?user=root&password=gammaClojureDocs1024"
+ :create true
+ :username "root"
+ :password "gammaClojureDocs1024"}]
+ (run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib"))
-(run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
-(run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib")

0 comments on commit bb6a607

Please sign in to comment.