mirror of
https://github.com/journeyman-cc/smeagol.git
synced 2026-04-12 18:05:06 +00:00
#22: H'mmm, clj-git API has changed considerably.
This isn't working, but does compile. More work needed.
This commit is contained in:
parent
ea52054785
commit
f9587f1e16
3 changed files with 9 additions and 7 deletions
|
|
@ -61,9 +61,9 @@
|
||||||
(git/load-repo git-directory-path)
|
(git/load-repo git-directory-path)
|
||||||
(catch java.io.FileNotFoundException fnf
|
(catch java.io.FileNotFoundException fnf
|
||||||
(log/info "Initialising Git repository at" git-directory-path)
|
(log/info "Initialising Git repository at" git-directory-path)
|
||||||
(git/git-init git-directory-path)
|
(git/git-init :dir git-directory-path)
|
||||||
(let [repo (git/load-repo git-directory-path)]
|
(let [repo (git/load-repo git-directory-path)]
|
||||||
(git/git-add-and-commit repo "Initial commit")
|
(git/git-commit repo "Initial commit")
|
||||||
repo))))
|
repo))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
(log/info (format "Saving %s's changes ('%s') to %s in file '%s'" user summary page file-path))
|
(log/info (format "Saving %s's changes ('%s') to %s in file '%s'" user summary page file-path))
|
||||||
(spit file-path source-text)
|
(spit file-path source-text)
|
||||||
(git/git-add git-repo file-name)
|
(git/git-add git-repo file-name)
|
||||||
(git/git-commit git-repo summary {:name user :email email})
|
(git/git-commit git-repo summary :name user :email email)
|
||||||
(response/redirect
|
(response/redirect
|
||||||
(str
|
(str
|
||||||
"/wiki?page="
|
"/wiki?page="
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,15 @@
|
||||||
(cjio/file local-url-base file-path))]
|
(cjio/file local-url-base file-path))]
|
||||||
(cond
|
(cond
|
||||||
(cs/includes? file-path "..")
|
(cs/includes? file-path "..")
|
||||||
(cs/join " " file-path
|
(cs/join " " [file-path
|
||||||
"Attempts to ascend the file hierarchy are disallowed.")
|
"Attempts to ascend the file hierarchy are disallowed."])
|
||||||
(not (cs/starts-with? path local-url-base))
|
(not (cs/starts-with? path local-url-base))
|
||||||
(cs/join " " [path "is not servable"])
|
(cs/join " " [path "is not servable"])
|
||||||
(not (fs/exists? path))
|
(not (fs/exists? path))
|
||||||
(cs/join " " [path "does not exist"])
|
(cs/join " " [path "does not exist"])
|
||||||
(not (fs/readable? path))
|
(not (fs/readable? path))
|
||||||
(cs/join " " [path "is not readable"])))
|
(cs/join " " [path "is not readable"])))
|
||||||
(catch Exception any (cs/join " " file-path "is not servable because" (.getMessage any)))))
|
(catch Exception any (cs/join " " [file-path "is not servable because" (.getMessage any)]))))
|
||||||
|
|
||||||
|
|
||||||
;; (not-servable-reason "/home/simon/workspace/smeagol/resources/public/content/vendor/node_modules/photoswipe/dist/photoswipe.min.js")
|
;; (not-servable-reason "/home/simon/workspace/smeagol/resources/public/content/vendor/node_modules/photoswipe/dist/photoswipe.min.js")
|
||||||
|
|
@ -157,8 +157,10 @@
|
||||||
|
|
||||||
|
|
||||||
(defn get-servlet-context-path
|
(defn get-servlet-context-path
|
||||||
|
"Return the servlet context path, if we're running as a servlet; if
|
||||||
|
not, return `nil`."
|
||||||
[request]
|
[request]
|
||||||
(if-let [context (:servlet-context request)]
|
(when-let [context (:servlet-context request)]
|
||||||
;; If we're not inside a serlvet environment (for
|
;; If we're not inside a serlvet environment (for
|
||||||
;; example when using mock requests), then
|
;; example when using mock requests), then
|
||||||
;; .getContextPath might not exist
|
;; .getContextPath might not exist
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue