Skip to content

Commit

Permalink
Adds support for Lua 5.3
Browse files Browse the repository at this point in the history
- Rewrote the Travis-ci integration
- Dropped lunit since it does not support Lua 5.3, started using lunitx.
  • Loading branch information
ignacio committed Jan 20, 2015
1 parent b1592cd commit e0f0b4d
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 23 deletions.
23 changes: 4 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,19 @@ language: erlang

env:
global:
- LUAROCKS_BASE=luarocks-2.1.1
- LUAROCKS_BASE=luarocks-2.2.0
matrix:
- LUA=lua5.1 LUA_DEV=liblua5.1-dev LUA_VER=5.1 LUA_SFX=5.1 LUA_INCDIR=/usr/include/lua5.1
- LUA=lua5.2 LUA_DEV=liblua5.2-dev LUA_VER=5.2 LUA_SFX=5.2 LUA_INCDIR=/usr/include/lua5.2
- LUA=lua5.3 LUA_DEV=liblua5.3-dev LUA_VER=5.3 LUA_SFX= LUA_INCDIR=/usr/local/include
- LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.0 LUAJIT_VER=2.0
- LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.1 LUAJIT_VER=2.1

before_install:
- if [ $LUA = "luajit" ] && [ $LUAJIT_VER = "2.0" ]; then
sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y;
fi
- if [ $LUA = "luajit" ] && [ $LUAJIT_VER = "2.1" ]; then
sudo add-apt-repository ppa:neomantra/luajit-v2.1 -y && sudo apt-get update -y;
fi
- sudo apt-get install $LUA
- sudo apt-get install $LUA_DEV
- lua$LUA_SFX -v
# Install a recent luarocks release
- wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz
- tar zxvpf $LUAROCKS_BASE.tar.gz
- cd $LUAROCKS_BASE
- ./configure
--lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR"
- make build && sudo make install
- cd $TRAVIS_BUILD_DIR
- travis/before_install.sh;

install:
- sudo luarocks install lunit
- sudo luarocks install lunitx

script:
- cd unittest
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status](https://travis-ci.org/ignacio/StackTracePlus.png?branch=master)](https://travis-ci.org/ignacio/StackTracePlus)

StackTracePlus provides enhanced stack traces for [Lua 5.1, Lua 5.2][1] and [LuaJIT][2].
StackTracePlus provides enhanced stack traces for [Lua 5.1, Lua 5.2, Lua 5.3][1] and [LuaJIT][2].

StackTracePlus can be used as a replacement for debug.traceback. It gives detailed information about locals, tries to guess
function names when they're not available, etc, so, instead of
Expand Down Expand Up @@ -35,7 +35,7 @@ you'll get
## Usage #

StackTracePlus can be used as a replacement for `debug.traceback`, as an `xpcall` error handler or even from C code. Note that
only the Lua 5.1 interpreter allows the traceback function to be replaced "on the fly". LuaJIT and Lua 5.2 always calls luaL_traceback internally so there is no easy way to override that.
only the Lua 5.1 interpreter allows the traceback function to be replaced "on the fly". LuaJIT, Lua 5.2 and 5.3 always calls luaL_traceback internally so there is no easy way to override that.

```lua
local STP = require "StackTracePlus"
Expand Down
24 changes: 24 additions & 0 deletions rockspecs/stacktraceplus-0.1.2-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package = "StackTracePlus"
version = "0.1.2-1"
source = {
url = "https://github.com/ignacio/StackTracePlus/archive/0.1.2-1.tar.gz",
dir = "StackTracePlus-0.1.2-1"
}
description = {
summary = "StackTracePlus provides enhanced stack traces for Lua",
detailed = [[
StackTracePlus can be used as a replacement for debug.traceback. It gives detailed information about locals, tries to guess
function names when they're not available, etc.
]],
license = "MIT/X11",
homepage = "http://github.com/ignacio/StackTracePlus"
}

dependencies = { "lua >= 5.1, < 5.4" }

build = {
type = "builtin",
modules = {
StackTracePlus = "src/StackTracePlus.lua"
}
}
4 changes: 4 additions & 0 deletions src/StackTracePlus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ add_known_module("bit32", "bit32 module")
-- luajit
add_known_module("bit", "bit module")
add_known_module("jit", "jit module")
-- lua5.3
if _VERSION >= "Lua 5.3" then
add_known_module("utf8", "utf8 module")
end


local m_user_known_tables = {}
Expand Down
37 changes: 37 additions & 0 deletions travis/before_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -e

if [ $LUA = "luajit" ]; then
if [ $LUAJIT_VER = "2.0" ]; then
sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y;
fi
if [ $LUAJIT_VER = "2.1" ]; then
sudo add-apt-repository ppa:neomantra/luajit-v2.1 -y && sudo apt-get update -y;
fi
fi

if [[ $LUA = "lua5.3" ]]; then
LUA_V="5.3.0"
wget "http://www.lua.org/ftp/lua-${LUA_V}.tar.gz"
tar xf "lua-${LUA_V}.tar.gz"
pushd "lua-${LUA_V}"
make linux
sudo make install
popd
else
sudo apt-get install $LUA
sudo apt-get install $LUA_DEV
fi
lua$LUA_SFX -v
# Install a recent luarocks release
wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz
tar zxvpf $LUAROCKS_BASE.tar.gz
pushd $LUAROCKS_BASE
# esto quedo medio feo
if [[ $LUA = "lua5.3" ]]; then
./configure --lua-version=$LUA_VER --with-lua-include="$LUA_INCDIR"
else
./configure --lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR"
fi
make build && sudo make install
popd
cd $TRAVIS_BUILD_DIR
2 changes: 1 addition & 1 deletion unittest/run.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local lunit = require "lunit"
local lunit = require "lunitx"

package.path = "../src/?.lua;../src/?/init.lua;".. package.path

Expand Down
7 changes: 6 additions & 1 deletion unittest/test.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
local STP = require "StackTracePlus"
local lunit = require "lunitx"

module(..., lunit.testcase, package.seeall)
if _VERSION >= "Lua 5.2" then
_ENV = lunit.module("simple","seeall")
else
module( ..., package.seeall, lunit.testcase )
end

function testLuaModule()
local f = function()
Expand Down

0 comments on commit e0f0b4d

Please sign in to comment.