mirror of
https://github.com/journeyman-cc/smeagol.git
synced 2026-04-12 18:05:06 +00:00
Kibitzed
This commit is contained in:
parent
6f22517f0c
commit
85097f942a
5 changed files with 11 additions and 37 deletions
|
|
@ -128,7 +128,7 @@
|
|||
"Return the map of features of this user, if any."
|
||||
[username]
|
||||
(if
|
||||
(and username (> (count (str username)) 0))
|
||||
(and username (pos? (count (str username))))
|
||||
((keyword username) (get-users))))
|
||||
|
||||
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
(timbre/info "Trying to add user " username)
|
||||
(cond
|
||||
(not (string? username)) (throw (Exception. "Username must be a string."))
|
||||
(= (count username) 0) (throw (Exception. "Username cannot be zero length"))
|
||||
(zero? (count username)) (throw (Exception. "Username cannot be zero length"))
|
||||
true (let [users (get-users)
|
||||
user ((keyword username) users)
|
||||
password (if
|
||||
|
|
@ -146,7 +146,7 @@
|
|||
(password/encrypt newpass))
|
||||
details {:email email
|
||||
:admin (if
|
||||
(and (string? admin) (> (count admin) 0))
|
||||
(and (string? admin) (pos? (count admin)))
|
||||
true
|
||||
false)}
|
||||
;; if we have a valid password we want to include it in the details to update.
|
||||
|
|
|
|||
|
|
@ -47,16 +47,6 @@
|
|||
(defn diff2html
|
||||
"Convert this string, assumed to be in diff format, to HTML."
|
||||
[^String diff-text]
|
||||
(apply str
|
||||
(flatten
|
||||
(list "<div class='change'>"
|
||||
(join "\n"
|
||||
(remove nil?
|
||||
(map mung-line
|
||||
;; The first five lines are boilerplate, and
|
||||
;; uninteresting for now
|
||||
(drop 5
|
||||
(split-lines diff-text)))))
|
||||
"</div>"))))
|
||||
(clojure.string/join (flatten (list "<div class='change'>" (join "\n" (remove nil? (map mung-line (drop 5 (split-lines diff-text))))) "</div>"))))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
corresponding inclusion should be inserted."
|
||||
[index result fragment fragments processed]
|
||||
(process-text
|
||||
(+ index 1)
|
||||
(inc index)
|
||||
result
|
||||
fragments
|
||||
(cons fragment processed)))
|
||||
|
|
@ -133,18 +133,8 @@
|
|||
(let
|
||||
[kw (keyword (str "inclusion-" index))]
|
||||
(process-text
|
||||
(+ index 1)
|
||||
(assoc
|
||||
result
|
||||
:inclusions
|
||||
(assoc
|
||||
(:inclusions result)
|
||||
kw
|
||||
(apply
|
||||
formatter
|
||||
(list
|
||||
(subs fragment (count token))
|
||||
index))))
|
||||
(inc index)
|
||||
(assoc-in result [:inclusions kw] (apply formatter (list (subs fragment (count token)) index)))
|
||||
(rest fragments)
|
||||
(cons kw processed))))
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,7 @@
|
|||
[^String log-entry ^String file-path]
|
||||
(timbre/info (format "searching '%s' for '%s'" log-entry file-path))
|
||||
(cond
|
||||
(not
|
||||
(empty?
|
||||
(filter
|
||||
#(= (first %) file-path)
|
||||
(:changed_files log-entry))))
|
||||
(seq (filter (fn* [p1__341301#] (= (first p1__341301#) file-path)) (:changed_files log-entry)))
|
||||
log-entry))
|
||||
|
||||
|
||||
|
|
@ -121,7 +117,7 @@
|
|||
new-parse)
|
||||
(PathFilter/create file-path))
|
||||
out))))
|
||||
(.toString out))))
|
||||
(str out))))
|
||||
|
||||
|
||||
(defn fetch-version
|
||||
|
|
@ -144,4 +140,4 @@
|
|||
(throw (IllegalStateException.
|
||||
(str "Did not find expected file '" file-path "'"))))
|
||||
(.copyTo (.open repo (.getObjectId tw 0)) out)
|
||||
(.toString out)))
|
||||
(str out)))
|
||||
|
|
|
|||
|
|
@ -92,9 +92,7 @@
|
|||
file-path (cjio/file util/content-dir file-name)
|
||||
exists? (.exists (cjio/as-file file-path))
|
||||
user (session/get :user)]
|
||||
(if (not exists?)
|
||||
(timbre/info (format "File '%s' not found; creating a new file" file-path))
|
||||
(timbre/info (format "Opening '%s' for editing" file-path)))
|
||||
(if-not exists? (timbre/info (format "File '%s' not found; creating a new file" file-path)) (timbre/info (format "Opening '%s' for editing" file-path)))
|
||||
(cond src-text (process-source params suffix request)
|
||||
true
|
||||
(layout/render template
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue