Update hy to 0.10.0

This commit is contained in:
Tom Willemse 2014-07-25 22:27:41 +02:00
parent e0158bc47b
commit 2e6dcfd74b
3 changed files with 20 additions and 19 deletions

20
hypo.hy
View file

@ -90,17 +90,17 @@ If no lexer is found fallback onto the text lexer."
(let ((content (get (.commit-file repo ref filename) "data")) (let ((content (get (.commit-file repo ref filename) "data"))
(lexer (get-lexer filename content)) (lexer (get-lexer filename content))
(formatter (HtmlFormatter)) (formatter (HtmlFormatter))
(args {"file" filename "hash" hash})) (kwargs {"file" filename "hash" hash}))
(.update (.update
args (if (in (get (os.path.splitext filename) 1) kwargs (if (in (get (os.path.splitext filename) 1)
[".png" ".jpg" ".jpeg" ".gif"]) [".png" ".jpg" ".jpeg" ".gif"])
{"content" (kwapply (render.image) {"content" (apply render.image []
{"name" filename {"name" filename
"hash" hash}) "hash" hash})
"style" ""} "style" ""}
{"content" (highlight content lexer formatter) {"content" (highlight content lexer formatter)
"style" (formatter.get-style-defs ".highlight")})) "style" (formatter.get-style-defs ".highlight")}))
(kwapply (render.main) args)) (apply render.main [] kwargs))
"")) ""))
(defun get-html [self name] (defun get-html [self name]
@ -129,10 +129,10 @@ If no lexer is found fallback onto the text lexer."
(.write f (web.data))) (.write f (web.data)))
(let ((repo (Gittle.init dirname))) (let ((repo (Gittle.init dirname)))
(.stage repo [(str name)]) (.stage repo [(str name)])
(kwapply (repo.commit) (apply repo.commit []
{"name" "Hypo" {"name" "Hypo"
"email" "hypo@ryuslash.org" "email" "hypo@ryuslash.org"
"message" "Initial commit"})) "message" "Initial commit"}))
(setv web.ctx.status (str "201 Created")) (setv web.ctx.status (str "201 Created"))
(+ web.ctx.home "/" *prefix* (get h 0) "\n"))) (+ web.ctx.home "/" *prefix* (get h 0) "\n")))

View file

@ -1,4 +1,4 @@
hy==0.9.12 hy==0.10.0
gittle==0.2.2 gittle==0.2.2
pycommand==0.1.0 pycommand==0.1.0
web.py==0.37 web.py==0.37

View file

@ -25,12 +25,13 @@
(sys.exit 1))) (sys.exit 1)))
(def db (def db
(kwapply (web.database) (apply web.database []
{"dbn" "postgres" "user" *dbuser* "pw" *dbpw* "db" *dbname*})) {"dbn" "postgres" "user" *dbuser* "pw" *dbpw* "db" *dbname*}))
(defun get-file [name] (defun get-file [name]
(let ((res (kwapply (.select db "hfile" {"shash" name}) (let ((res (apply .select
{"where" "shash = $shash"}))) [db "hfile" {"shash" name}]
{"where" "shash = $shash"})))
(if res (car res)))) (if res (car res))))
(foreach [f (os.listdir "files/")] (foreach [f (os.listdir "files/")]
@ -42,7 +43,7 @@
(+ "files/" f "/" file.filename)) (+ "files/" f "/" file.filename))
(let ((repo (Gittle.init (+ "files/" f)))) (let ((repo (Gittle.init (+ "files/" f))))
(.stage repo [(str file.filename)]) (.stage repo [(str file.filename)])
(kwapply (repo.commit) (apply repo.commit []
{"name" "System" {"name" "System"
"email" "tom@ryuslash.org" "email" "tom@ryuslash.org"
"message" "Initial commit for upgrade to git"})))) "message" "Initial commit for upgrade to git"}))))