all repos — litestore @ bc09339019e165067f33d3e84f6a5b28586aadec

A minimalist nosql document store.

Testing basic app; minor changes.
h3rald h3rald@h3rald.com
Sun, 22 Feb 2015 17:49:25 +0100
commit

bc09339019e165067f33d3e84f6a5b28586aadec

parent

8630c9c12223990f349414ea42b1865dd4391c34

M app/md/api.mdapp/md/api.md

@@ -10,12 +10,12 @@ Returns the allowed HTTP verbs for this resource.

##### Example -<div class="terminal"> -curl -i -X OPTIONS http://127.0.0.1:9500/v1/info -HTTP/1.1 200 OK -Content-Length: 0 +``` +curl -i -X OPTIONS http://127.0.0.1:9500/v1/inf +HTTP/1.1 200 OK +Content-Length: 0 Allow: GET,OPTIONS -</div> +``` #### GET info

@@ -92,13 +92,12 @@ Returns the allowed HTTP verbs for this resource.

##### Example -<div class="terminal"> +``` curl -i -X OPTIONS http://0.0.0.0:9500/v1/docs HTTP/1.1 200 OK Content-Length: 0 Allow: HEAD,GET,POST,OPTIONS -</div> - +``` #### OPTIONS docs/:id

@@ -106,12 +105,12 @@ Returns the allowed HTTP verbs for this resource.

##### Example -<div class="terminal"> +``` curl -i -X OPTIONS http://0.0.0.0:9500/v1/docs/test HTTP/1.1 200 OK Content-Length: 0 Allow: HEAD,GET,PUT,PATCH,DELETE,OPTIONS -</div> +``` #### POST docs
M app/styles/badges.lessapp/styles/badges.less

@@ -18,7 +18,7 @@ .check {.mix-symbol(@fa-var-check-square-o, @bright-green)}

.lock {.mix-symbol(@fa-var-lock, @bright-yellow)} .unlock {.mix-symbol(@fa-var-unlock, @bright-yellow)} .bug {.mix-symbol(@fa-var-bug, @bright-red)} -.tag {.mix-symbol(@fa-var-tag, @dark-yellow)} +.tag {.mix-symbol(@fa-var-tag, @bright-yellow)} .date {.mix-symbol(@fa-var-calendar, @bright-blue)} .attachment {.mix-symbol(@fa-var-paperclip, @text-color)} .geo {.mix-symbol(@fa-var-map-marker, @bright-red)}

@@ -50,3 +50,9 @@ .krw {.mix-symbol(@fa-var-krw, @text-color, 90%, "")}

.rub {.mix-symbol(@fa-var-rub, @text-color, 90%, "")} .try {.mix-symbol(@fa-var-try, @text-color, 90%, "")} +.copy {.mix-symbol(@fa-var-copyright, @text-color)} +.red-flag {.mix-symbol(@fa-var-flag, @bright-red)} +.green-flag {.mix-symbol(@fa-var-flag, @bright-green)} +.yellow-flag {.mix-symbol(@fa-var-flag, @bright-yellow)} +.story {.mix-symbol(@fa-var-comment, @bright-blue)} +.feature {.mix-symbol(@fa-var-check-circle, @bright-green)}
M app/styles/blocks.lessapp/styles/blocks.less

@@ -6,22 +6,34 @@ .sidebar {.mix-titled-block(@light-gray, @gray-5, @light-gray, @fa-var-info-circle);}

.output {.mix-box(@light-gray, @gray-5, @light-gray);} .terminal { - .mix-box(@gray-e, @gray-2, @gray-c); + .mix-box(@gray-2, @gray-e, @gray-c); padding: 0 3px; + border: 2px solid @gray-9; + border-top: 10px solid @gray-9; p, p:first-child { margin-top: 0; margin-bottom: 0; text-shadow: none; font-weight: normal; font-family: @monospace-font; - font-size: 90%; - color: @gray-2; + font-size: 85%; + color: @gray-e; &:before { - font-family: "FontAwesome"; + font-family: @monospace-font; font-style: normal; font-weight: bold; color: @dark-green; - content: @fa-var-terminal " "; + content: "$ "; + } + } +} + +.terminal-su { + .terminal; + p, p:first-child { + &:before { + color: @bright-red; + content: "# "; } } }
M app/styles/elements.lessapp/styles/elements.less

@@ -1,10 +1,10 @@

-body { - .mix-hyphens(auto); -} - main { + max-width: 850px; + margin: auto; margin-top: 60px; } + + /* Blocks */ blockquote {

@@ -24,6 +24,7 @@ box-shadow: none;

background: @light-gray; padding: 0px 2px 0 2px; border: none; + line-height: 1.2em; } .hljs { padding: 0 3px;

@@ -51,7 +52,8 @@ font-family: "FontAwesome";

} code, span.code { - .mix-inline-box(@light-gray, @dark-gray, @gray); + .mix-inline-box(@light-gray, @dark-gray, @light-gray); + margin: 2px 0px; font-family: @monospace-font; font-size: 85%; .mix-hyphens(none);

@@ -61,8 +63,8 @@ kbd, span.kbd {

.mix-inline-box(@light-gray, @dark-gray, @gray); font-family: @monospace-font; font-weight: bold; - border-right: 1px solid @dark-gray; - border-bottom: 1px solid @dark-gray; + border-right: 1px solid @gray-b; + border-bottom: 1px solid @gray-b; line-height: 1em; font-size: 80%; .mix-hyphens(none);

@@ -119,13 +121,3 @@

span.ext, span.kwd { font-weight: bold; } - -/* Links */ - -a,a:visited { - color: @link-color; - text-decoration:none; - &:hover { - text-decoration:underline; - } -}
M app/styles/litestore.cssapp/styles/litestore.css

@@ -1658,14 +1658,9 @@ -webkit-border-radius: 0px;

-moz-border-radius: 0px; border-radius: 0px; } -body { - -webkit-hyphens: auto; - -moz-hyphens: auto; - -ms-hyphens: auto; - -o-hyphens: auto; - hyphens: auto; -} main { + max-width: 850px; + margin: auto; margin-top: 60px; } /* Blocks */

@@ -1704,6 +1699,7 @@ box-shadow: none;

background: #f8f8f8; padding: 0px 2px 0 2px; border: none; + line-height: 1.2em; } pre .hljs { padding: 0 3px;

@@ -1732,7 +1728,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #999999; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -1741,6 +1736,7 @@ -webkit-background-clip: padding-box;

background-clip: padding-box; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + margin: 2px 0px; font-family: "Source Code Pro", "Monaco", "DejaVu Sans Mono", "Courier New", monospace; font-size: 85%; -webkit-hyphens: none;

@@ -1757,7 +1753,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #999999; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -1768,8 +1763,8 @@ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);

box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); font-family: "Source Code Pro", "Monaco", "DejaVu Sans Mono", "Courier New", monospace; font-weight: bold; - border-right: 1px solid #333333; - border-bottom: 1px solid #333333; + border-right: 1px solid #bbbbbb; + border-bottom: 1px solid #bbbbbb; line-height: 1em; font-size: 80%; -webkit-hyphens: none;

@@ -1806,7 +1801,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #f8f8f8; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -1873,16 +1867,6 @@ span.ext,

span.kwd { font-weight: bold; } -/* Links */ -a, -a:visited { - color: #4183c4; - text-decoration: none; -} -a:hover, -a:visited:hover { - text-decoration: underline; -} .note { -moz-background-clip: padding; -webkit-background-clip: padding-box;

@@ -2075,10 +2059,12 @@ margin: 10px auto;

padding: 2px 4px 0 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); - color: #222222; - background-color: #eeeeee; + color: #eeeeee; + background-color: #222222; border: 1px solid #cccccc; padding: 0 3px; + border: 2px solid #999999; + border-top: 10px solid #999999; } .terminal a { color: #264c72;

@@ -2093,16 +2079,63 @@ margin-bottom: 0;

text-shadow: none; font-weight: normal; font-family: "Source Code Pro", "Monaco", "DejaVu Sans Mono", "Courier New", monospace; - font-size: 90%; - color: #222222; + font-size: 85%; + color: #eeeeee; } .terminal p:before, .terminal p:first-child:before { - font-family: "FontAwesome"; + font-family: "Source Code Pro", "Monaco", "DejaVu Sans Mono", "Courier New", monospace; font-style: normal; font-weight: bold; color: #009926; - content: "\f120" " "; + content: "$ "; +} +.terminal-su { + -moz-background-clip: padding; + -webkit-background-clip: padding-box; + background-clip: padding-box; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + margin: 10px auto; + padding: 2px 4px 0 4px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8); + color: #eeeeee; + background-color: #222222; + border: 1px solid #cccccc; + padding: 0 3px; + border: 2px solid #999999; + border-top: 10px solid #999999; +} +.terminal-su a { + color: #264c72; +} +.terminal-su p { + margin: 0 auto; +} +.terminal-su p, +.terminal-su p:first-child { + margin-top: 0; + margin-bottom: 0; + text-shadow: none; + font-weight: normal; + font-family: "Source Code Pro", "Monaco", "DejaVu Sans Mono", "Courier New", monospace; + font-size: 85%; + color: #eeeeee; +} +.terminal-su p:before, +.terminal-su p:first-child:before { + font-family: "Source Code Pro", "Monaco", "DejaVu Sans Mono", "Courier New", monospace; + font-style: normal; + font-weight: bold; + color: #009926; + content: "$ "; +} +.terminal-su p:before, +.terminal-su p:first-child:before { + color: #cc3300; + content: "# "; } div .terminal { margin: 2px auto;

@@ -2117,7 +2150,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #cc3300; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2150,7 +2182,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #cc3300; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2183,7 +2214,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #cc3300; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2216,7 +2246,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #cc3300; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2249,7 +2278,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #cc3300; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2282,7 +2310,6 @@ padding: 0 3px 0;

display: inline-block; width: auto; margin: 1px; - border: 1px solid #705400; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2306,16 +2333,15 @@ font-weight: bold;

content: "verify"; } .draftcomment { - color: #00cc33; + color: #009926; } .draftcomment:before { - color: #00cc33; + color: #009926; background-color: #d8f5cd; padding: 0 3px 0; display: inline-block; width: auto; margin: 1px; - border: 1px solid #00cc33; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px;

@@ -2431,7 +2457,7 @@ font-family: "FontAwesome";

font-style: normal; font-weight: normal; font-size: 100%; - color: #705400; + color: #f5b800; content: "\f02b" " "; } .date:before {

@@ -2592,3 +2618,51 @@ font-size: 90%;

color: #333333; content: "\f195" ""; } +.copy:before { + font-family: "FontAwesome"; + font-style: normal; + font-weight: normal; + font-size: 100%; + color: #333333; + content: "\f1f9" " "; +} +.red-flag:before { + font-family: "FontAwesome"; + font-style: normal; + font-weight: normal; + font-size: 100%; + color: #cc3300; + content: "\f024" " "; +} +.green-flag:before { + font-family: "FontAwesome"; + font-style: normal; + font-weight: normal; + font-size: 100%; + color: #00cc33; + content: "\f024" " "; +} +.yellow-flag:before { + font-family: "FontAwesome"; + font-style: normal; + font-weight: normal; + font-size: 100%; + color: #f5b800; + content: "\f024" " "; +} +.story:before { + font-family: "FontAwesome"; + font-style: normal; + font-weight: normal; + font-size: 100%; + color: #0f4bff; + content: "\f075" " "; +} +.feature:before { + font-family: "FontAwesome"; + font-style: normal; + font-weight: normal; + font-size: 100%; + color: #00cc33; + content: "\f058" " "; +}
M app/styles/mixins.lessapp/styles/mixins.less

@@ -33,7 +33,6 @@ padding:0 3px 0;

display: inline-block; width: auto; margin: 1px; - border:1px solid @border-color; -webkit-border-radius:2px; -moz-border-radius:2px; border-radius:2px;

@@ -86,7 +85,7 @@ .mix-badge(@text, @bright-red, @lighter-red);

} .mix-green-badge (@text){ - .mix-badge(@text, @bright-green, @lighter-green); + .mix-badge(@text, @dark-green, @lighter-green); } .mix-yellow-badge (@text){

@@ -116,7 +115,7 @@ -o-hyphens: @val;

hyphens: @val; } -.mix-link-icon (@icon, @space:" ") { +.mix-link-icon (@icon, @space:"\202F") { &:before { content: @icon @space; font-family: "FontAwesome";
M lib/contenttypes.jsonlib/contenttypes.json

@@ -962,6 +962,9 @@ },

{ ".les":"application\/vnd.hhe.lesson-player" }, + { + ".less":"text/x-less" + }, { ".lha":"application\/octet-stream" },

@@ -1751,6 +1754,9 @@ },

{ ".saf":"application\/vnd.yamaha.smaf-audio" }, + { + ".sass":"text/x-sass" + }, { ".sbml":"application\/sbml+xml" },

@@ -1768,6 +1774,9 @@ ".scq":"application\/scvp-cv-request"

}, { ".scs":"application\/scvp-cv-response" + }, + { + ".scss":"text/x-scss" }, { ".scurl":"text\/vnd.curl.scurl"
M lib/core.nimlib/core.nim

@@ -124,7 +124,6 @@

proc countDocuments*(store: Datastore): int64 = return store.db.getRow(SQL_COUNT_DOCUMENTS)[0].parseInt - # Manage Tags proc createTag*(store: Datastore, tagid, documentid: string, system=false) =

@@ -166,15 +165,19 @@ obj[row[0]] = %row[1].parseInt

tag_array.add(obj) return %tag_array - proc importDir*(store: Datastore, dir: string) = if not dir.dirExists: raise newException(EDirectoryNotFound, "Directory '$1' not found." % dir) for f in dir.walkDirRec(): + if f.existsDir: + continue + if f.splitFile.name.startsWith("."): + # Ignore hidden files + continue let ext = f.splitFile.ext var d_id = f var d_contents = f.readFile - var d_ct = "text/plain" + var d_ct = "application/octet-stream" if CONTENT_TYPES.hasKey(ext): d_ct = CONTENT_TYPES[ext].replace("\"", "") var d_binary = 0
M lib/server.nimlib/server.nim

@@ -21,7 +21,7 @@ result.version = matches[0]

result.resource = matches[1] result.id = matches[2] else: - raise newException(EInvalidRequest, req.url.path&"?"&req.url.query) + raise newException(EInvalidRequest, req.getReqInfo()) proc route(req: Request, LS: LiteStore): Response = try:

@@ -44,7 +44,7 @@

proc serve*(LS: LiteStore) = var server = newAsyncHttpServer() proc handleHttpRequest(req: Request): Future[void] {.async.} = - info getReqInfo(req) + info(getReqInfo(req).replace("$", "$$")) let res = req.route(LS) await req.respond(res.code, res.content, res.headers) info(LS.appname & " v" & LS.appversion & " started on " & LS.address & ":" & $LS.port & ".")