Преглед изворни кода

updates to code and install script

Sergey Zavadski пре 11 година
родитељ
комит
cb68524e13
2 измењених фајлова са 11 додато и 6 уклоњено
  1. 3 1
      leda/app.lua
  2. 8 5
      toolset/setup/linux/frameworks/leda.sh

+ 3 - 1
leda/app.lua

@@ -1,11 +1,13 @@
 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 =  {message= 'Hello, World!'}
+        response.body =  json.encode{message= 'Hello, World!'}
+        response.headers['Content-Type'] = 'application/json'
     elseif url:find('/plaintext') then    
         response.body =  'Hello, World!'
     end

+ 8 - 5
toolset/setup/linux/frameworks/leda.sh

@@ -1,13 +1,16 @@
 #!/bin/bash
 
-RETCODE=$(fw_exists leda-0.4.1)
+RETCODE=$(fw_exists leda-0.5.0)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
-sudo apt-get install g++
+sudo apt-get install -y g++
+sudo apt-get install -y luarocks
 
-wget http://sergeyzavadski.github.io/leda/releases/leda-0.4.1/leda-0.4.1.tar.gz
-tar xvf leda-0.4.1.tar.gz
-cd leda-0.4.1
+sudo luarocks install lua-cjson
+
+wget http://sergeyzavadski.github.io/leda/releases/leda-0.5.0/leda-0.5.0.tar.gz
+tar xvf leda-0.5.0.tar.gz
+cd leda-0.5.0
 
 ./configure
 make