New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

leda micro framework #887

Merged
merged 35 commits into from Jul 21, 2014
Commits
Jump to file or symbol
Failed to load files and symbols.
+112 −0
Diff settings

Always

Just for now

View
@@ -0,0 +1,23 @@
# Leda Benchmark Test
### Deployment
[Leda](https://github.com/sergeyzavadski/leda) framework has to set up.
### JSON Encoding Test
* [Source](app.lua)
## Test URLs
### JSON Encoding
http://localhost:8080/json
### Plaintext
http://localhost:8080/plaintext
View
No changes.
View
@@ -0,0 +1,14 @@
local http = require('leda.http')
local json = require('cjson')
local server = http.Server(8080, '')
server.request = function(server, request, response)
local url = request:url()
if url:find('/json') then
response.body = json.encode{message= 'Hello, World!'}
response.headers['Content-Type'] = 'application/json'
elseif url:find('/plaintext') then
response.body = 'Hello, World!'
end
end
View
@@ -0,0 +1,24 @@
{
"framework": "leda",
"tests": [{
"default": {
"setup_file": "setup",
"json_url": "/json",
"plaintext_url": "/plaintext",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "None",
"framework": "leda",
"language": "lua",
"orm": "Raw",
"platform": "libpropeller",
"webserver": "None",
"os": "Linux",
"database_os": "Linux",
"display_name": "leda",
"notes": "",
"versus": ""
}
}]
}
View
@@ -0,0 +1,3 @@
#!/bin/bash
fw_depends leda
View
@@ -0,0 +1,24 @@
import subprocess
import sys
import setup_util
import os
def start(args, logfile, errfile):
subprocess.Popen('leda app.lua', shell=True, cwd="leda", stderr=errfile, stdout=logfile)
return 0
def stop(logfile, errfile):
p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.splitlines():
if 'app.lua' in line:
try:
pid = int(line.split(None, 2)[1])
os.kill(pid, 15)
except OSError:
pass
return 0
View
@@ -0,0 +1 @@
./leda/app.lua
@@ -0,0 +1,23 @@
#!/bin/bash
RETCODE=$(fw_exists leda)
[ ! "$RETCODE" == 0 ] || { return 0; }
rm -rf leda || true
sudo apt-get install -y g++
sudo apt-get install -y luarocks
sudo luarocks install lua-cjson
wget -O leda.tar.gz http://sergeyzavadski.github.io/leda/releases/leda-0.5.4/leda-0.5.4.tar.gz
fw_untar leda.tar.gz
cd leda-0.5.4
./configure
make
sudo make install
cd ..
mv leda-0.5.4 leda
ProTip! Use n and p to navigate between commits in a pull request.