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"))
(lexer (get-lexer filename content))
(formatter (HtmlFormatter))
(args {"file" filename "hash" hash}))
(kwargs {"file" filename "hash" hash}))
(.update
args (if (in (get (os.path.splitext filename) 1)
kwargs (if (in (get (os.path.splitext filename) 1)
[".png" ".jpg" ".jpeg" ".gif"])
{"content" (kwapply (render.image)
{"name" filename
"hash" hash})
{"content" (apply render.image []
{"name" filename
"hash" hash})
"style" ""}
{"content" (highlight content lexer formatter)
"style" (formatter.get-style-defs ".highlight")}))
(kwapply (render.main) args))
(apply render.main [] kwargs))
""))
(defun get-html [self name]
@ -129,10 +129,10 @@ If no lexer is found fallback onto the text lexer."
(.write f (web.data)))
(let ((repo (Gittle.init dirname)))
(.stage repo [(str name)])
(kwapply (repo.commit)
{"name" "Hypo"
"email" "hypo@ryuslash.org"
"message" "Initial commit"}))
(apply repo.commit []
{"name" "Hypo"
"email" "hypo@ryuslash.org"
"message" "Initial commit"}))
(setv web.ctx.status (str "201 Created"))
(+ 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
pycommand==0.1.0
web.py==0.37

View file

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