Browse Source

Merge pull request #887 from sergeyzavadski/master

leda micro framework
Alexander Schneider 11 years ago
parent
commit
e4782d63f3
8 changed files with 112 additions and 0 deletions
  1. 23 0
      leda/README.md
  2. 0 0
      leda/__init__.py
  3. 14 0
      leda/app.lua
  4. 24 0
      leda/benchmark_config
  5. 3 0
      leda/install.sh
  6. 24 0
      leda/setup.py
  7. 1 0
      leda/source_code
  8. 23 0
      toolset/setup/linux/frameworks/leda.sh

+ 23 - 0
leda/README.md

@@ -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

+ 0 - 0
leda/__init__.py


+ 14 - 0
leda/app.lua

@@ -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

+ 24 - 0
leda/benchmark_config

@@ -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": ""
+    }
+  }]
+}

+ 3 - 0
leda/install.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+fw_depends leda

+ 24 - 0
leda/setup.py

@@ -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

+ 1 - 0
leda/source_code

@@ -0,0 +1 @@
+./leda/app.lua

+ 23 - 0
toolset/setup/linux/frameworks/leda.sh

@@ -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
+