Add ultimate lapis setup test
This commit is contained in:
parent
a508687a43
commit
5feb3e0c9a
|
@ -0,0 +1 @@
|
|||
.gitignore
|
|
@ -0,0 +1,2 @@
|
|||
/static/css/readable.css linguist-vendored
|
||||
/static/css/font-awesome.min.css linguist-vendored
|
|
@ -0,0 +1,5 @@
|
|||
*.lua
|
||||
*.js
|
||||
bower_components
|
||||
.git
|
||||
.moonbox
|
|
@ -0,0 +1,2 @@
|
|||
lapis
|
||||
dkjson
|
|
@ -0,0 +1 @@
|
|||
FROM xena/lapis-ultimate
|
|
@ -0,0 +1,10 @@
|
|||
lapis = require "lapis"
|
||||
|
||||
class extends lapis.Application
|
||||
layout: require "layout.bootstrap"
|
||||
|
||||
[index: "/"]: =>
|
||||
render: true
|
||||
|
||||
handle_404: =>
|
||||
status: 404, render: "notfound"
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "test",
|
||||
"version": "0.0.0",
|
||||
"homepage": "https://github.com/Xe/dockerfiles",
|
||||
"authors": [
|
||||
"Christine Dodrill <xena@yolo-swag.com>"
|
||||
],
|
||||
"description": "My Test app",
|
||||
"license": "Zlib",
|
||||
"private": true,
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
],
|
||||
"dependencies": {
|
||||
"bootstrap": "~3.3.2",
|
||||
"fontawesome": "~4.3.0",
|
||||
"instantclick": "~3.1.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
config = require "lapis.config"
|
||||
config "development", ->
|
||||
port 8080
|
||||
|
||||
config "docker", ->
|
||||
port os.getenv "PORT"
|
||||
postgresql_url os.getenv "DATABASE_URL"
|
|
@ -0,0 +1,80 @@
|
|||
import Widget from require "lapis.html"
|
||||
|
||||
class Layout extends Widget
|
||||
head: =>
|
||||
meta charset: "UTF-8"
|
||||
|
||||
title ->
|
||||
if @title
|
||||
text "#{@title} - My Awesome Site"
|
||||
else
|
||||
text "My Awesome Site"
|
||||
|
||||
if @meta_description
|
||||
meta property: "og:description", content: @meta_description
|
||||
meta name: "description", content: @meta_description
|
||||
|
||||
link rel: "stylesheet", href: "/static/comp/bootstrap/dist/css/bootstrap.min.css"
|
||||
link rel: "stylesheet", href: "/static/comp/bootstrap/dist/css/bootstrap-theme.min.css"
|
||||
link rel: "stylesheet", href: "/static/comp/fontawesome/font-awesome.min.css"
|
||||
link rel: "stylesheet", href: "/static/css/main.css"
|
||||
|
||||
link type: "text/plain", rel: "author", href: "/humans.txt"
|
||||
|
||||
script src: "/static/comp/jquery/dist/jquery.min.js"
|
||||
script src: "/static/comp/bootstrap/dist/js/bootstrap.min.js"
|
||||
script src: "/static/comp/instantclick/instantclick.js"
|
||||
|
||||
header: =>
|
||||
nav class: "navbar navbar-fixed-top", ->
|
||||
div class: "container", ->
|
||||
div class: "navbar-header", ->
|
||||
button type: "button", class: "navbar-toggle collapsed", ["data-toggle"]: "collapse", ["data-target"]: "#navbar", ["aria-expanded"]: "false", ["aria-controls"]: "navbar", ->
|
||||
span class: "sr-only", ->
|
||||
text "Toggle navigation"
|
||||
|
||||
for i=1,3
|
||||
span class: "icon-bar"
|
||||
|
||||
a class: "navbar-brand", href: "/", ->
|
||||
text "My Awesome Site"
|
||||
|
||||
div id: "navbar", class: "collapse navbar-collapse", ->
|
||||
ul class: "nav navbar-nav", ->
|
||||
li ->
|
||||
a href: "#", "Link 1"
|
||||
li ->
|
||||
a href: "#", "Link 2"
|
||||
|
||||
ul class: "nav navbar-nav navbar-right", ->
|
||||
li ->
|
||||
a href: "#", "Contact"
|
||||
|
||||
footer: =>
|
||||
footer ->
|
||||
div class: "container footer", ->
|
||||
center ->
|
||||
p class: "text-muted", ->
|
||||
text "Copyright - #{os.date "%Y"}"
|
||||
|
||||
if os.getenv "GIT_REV"
|
||||
text " - revision "
|
||||
code "#{os.getenv("GIT_REV")\sub 1,8}"
|
||||
|
||||
body: =>
|
||||
div class: "container", ->
|
||||
if @flash
|
||||
div class: "flash", ->
|
||||
text @flash
|
||||
|
||||
@content_for "inner"
|
||||
|
||||
content: =>
|
||||
html_5 ->
|
||||
head ->
|
||||
@head!
|
||||
|
||||
body ->
|
||||
@header!
|
||||
@body!
|
||||
@footer!
|
|
@ -0,0 +1,79 @@
|
|||
types {
|
||||
text/html html htm shtml;
|
||||
text/css css;
|
||||
text/xml xml;
|
||||
image/gif gif;
|
||||
image/jpeg jpeg jpg;
|
||||
application/x-javascript js;
|
||||
application/atom+xml atom;
|
||||
application/rss+xml rss;
|
||||
|
||||
text/mathml mml;
|
||||
text/plain txt;
|
||||
text/vnd.sun.j2me.app-descriptor jad;
|
||||
text/vnd.wap.wml wml;
|
||||
text/x-component htc;
|
||||
|
||||
image/png png;
|
||||
image/tiff tif tiff;
|
||||
image/vnd.wap.wbmp wbmp;
|
||||
image/x-icon ico;
|
||||
image/x-jng jng;
|
||||
image/x-ms-bmp bmp;
|
||||
image/svg+xml svg svgz;
|
||||
image/webp webp;
|
||||
|
||||
application/java-archive jar war ear;
|
||||
application/mac-binhex40 hqx;
|
||||
application/msword doc;
|
||||
application/pdf pdf;
|
||||
application/postscript ps eps ai;
|
||||
application/rtf rtf;
|
||||
application/vnd.ms-excel xls;
|
||||
application/vnd.ms-powerpoint ppt;
|
||||
application/vnd.wap.wmlc wmlc;
|
||||
application/vnd.google-earth.kml+xml kml;
|
||||
application/vnd.google-earth.kmz kmz;
|
||||
application/x-7z-compressed 7z;
|
||||
application/x-cocoa cco;
|
||||
application/x-java-archive-diff jardiff;
|
||||
application/x-java-jnlp-file jnlp;
|
||||
application/x-makeself run;
|
||||
application/x-perl pl pm;
|
||||
application/x-pilot prc pdb;
|
||||
application/x-rar-compressed rar;
|
||||
application/x-redhat-package-manager rpm;
|
||||
application/x-sea sea;
|
||||
application/x-shockwave-flash swf;
|
||||
application/x-stuffit sit;
|
||||
application/x-tcl tcl tk;
|
||||
application/x-x509-ca-cert der pem crt;
|
||||
application/x-xpinstall xpi;
|
||||
application/xhtml+xml xhtml;
|
||||
application/zip zip;
|
||||
|
||||
application/octet-stream bin exe dll;
|
||||
application/octet-stream deb;
|
||||
application/octet-stream dmg;
|
||||
application/octet-stream eot;
|
||||
application/octet-stream iso img;
|
||||
application/octet-stream msi msp msm;
|
||||
|
||||
audio/midi mid midi kar;
|
||||
audio/mpeg mp3;
|
||||
audio/ogg ogg;
|
||||
audio/x-m4a m4a;
|
||||
audio/x-realaudio ra;
|
||||
|
||||
video/3gpp 3gpp 3gp;
|
||||
video/mp4 mp4;
|
||||
video/mpeg mpeg mpg;
|
||||
video/quicktime mov;
|
||||
video/webm webm;
|
||||
video/x-flv flv;
|
||||
video/x-m4v m4v;
|
||||
video/x-mng mng;
|
||||
video/x-ms-asf asx asf;
|
||||
video/x-ms-wmv wmv;
|
||||
video/x-msvideo avi;
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
worker_processes ${{NUM_WORKERS}};
|
||||
error_log stderr notice;
|
||||
daemon off;
|
||||
|
||||
env PORT;
|
||||
env GIT_REV;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
|
||||
server {
|
||||
listen ${{PORT}};
|
||||
lua_code_cache ${{CODE_CACHE}};
|
||||
|
||||
location / {
|
||||
set $_url "";
|
||||
default_type text/html;
|
||||
content_by_lua '
|
||||
require("lapis").serve("app")
|
||||
';
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias static/;
|
||||
}
|
||||
|
||||
location /static/comp/ {
|
||||
alias bower_components/;
|
||||
}
|
||||
|
||||
location /favicon.ico {
|
||||
alias static/favicon.ico;
|
||||
}
|
||||
|
||||
location /humans.txt {
|
||||
alias static/humans.txt;
|
||||
}
|
||||
|
||||
location /keybase.txt {
|
||||
alias static/keybase.txt;
|
||||
}
|
||||
|
||||
location /capture {
|
||||
internal;
|
||||
resolver 8.8.8.8;
|
||||
set_unescape_uri $clean_url $arg_url;
|
||||
proxy_pass $clean_url;
|
||||
}
|
||||
|
||||
location /proxy {
|
||||
internal;
|
||||
rewrite_by_lua "
|
||||
local req = ngx.req
|
||||
for k,v in pairs(req.get_headers()) do
|
||||
if k ~= 'content-length' then
|
||||
req.clear_header(k)
|
||||
end
|
||||
end
|
||||
if ngx.ctx.headers then
|
||||
for k,v in pairs(ngx.ctx.headers) do
|
||||
req.set_header(k, v)
|
||||
end
|
||||
end
|
||||
";
|
||||
resolver 8.8.8.8;
|
||||
proxy_http_version 1.1;
|
||||
proxy_pass $_url;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
body {
|
||||
padding-top: 60px;
|
||||
background: #FFF9FD;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width 600px;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.container .text-muted {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.flash {
|
||||
background: #cee5F5;
|
||||
padding: 0.5em;
|
||||
border: 1px solid #aacbe2;
|
||||
}
|
||||
.error {
|
||||
background: #f0d6d6;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
table {
|
||||
align: center;
|
||||
border-width: 1px;
|
||||
border-spacing: 2px;
|
||||
border-style: outset;
|
||||
border-color: gray;
|
||||
border-collapse: collapse;
|
||||
background-color: white;
|
||||
}
|
||||
table td {
|
||||
border-width: 1px;
|
||||
padding: 4px;
|
||||
border-style: inset;
|
||||
border-color: gray;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
/* Set the fixed height of the footer here */
|
||||
height: 60px;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,2 @@
|
|||
f = (x) ->
|
||||
alert x
|
|
@ -0,0 +1,8 @@
|
|||
import Widget from require "lapis.html"
|
||||
|
||||
class Index extends Widget
|
||||
content: =>
|
||||
center ->
|
||||
h1 "My Awesome Site"
|
||||
|
||||
p class: "lead", "Check out this awesomeness :D"
|
|
@ -0,0 +1,10 @@
|
|||
import Widget from require "lapis.html"
|
||||
|
||||
class UserInfo extends Widget
|
||||
content: =>
|
||||
center ->
|
||||
h1 "Oops!"
|
||||
|
||||
p "Page not found!"
|
||||
|
||||
img src: "/static/img/404.png"
|
Loading…
Reference in New Issue