aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtiene Dalcol <Etiene@users.noreply.github.com>2015-04-15 09:14:38 +0100
committerEtiene Dalcol <Etiene@users.noreply.github.com>2015-04-15 09:14:38 +0100
commit2772aaf051a81b39540b77ee33eab13b6875becd (patch)
treeac10c91a0c692eca1713acae5c06c30c48e11c30
parentd5942f76be9be2815857fa90c8f7fd27b46e43d0 (diff)
parentfae07a450ea0b1e9998c4443c147d4c9e8bd4ef7 (diff)
downloadvalua-2772aaf051a81b39540b77ee33eab13b6875becd.tar.gz
valua-2772aaf051a81b39540b77ee33eab13b6875becd.tar.bz2
valua-2772aaf051a81b39540b77ee33eab13b6875becd.zip
Merge pull request #5 from ignacio/travis_integration
Adds travis-ci integration
-rw-r--r--.travis.yml27
-rw-r--r--.travis/platform.sh15
-rw-r--r--.travis/setenv_lua.sh3
-rw-r--r--.travis/setup_lua.sh122
-rw-r--r--README.md2
-rw-r--r--valua-0.2.1-2.rockspec23
6 files changed, 192 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..754db70
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,27 @@
+language: c
+
+sudo: false
+
+env:
+ global:
+ - LUAROCKS=2.2.1
+ matrix:
+ - LUA=lua5.1
+ - LUA=lua5.2
+ - LUA=lua5.3
+ - LUA=luajit # latest stable version (2.0.3)
+ - LUA=luajit2.0 # current head of 2.0 branch
+ - LUA=luajit2.1 # current head of 2.1 branch
+
+before_install:
+ - source .travis/setenv_lua.sh
+
+script:
+ - lua valua-test.lua
+
+after_success:
+
+notifications:
+ email:
+ on_success: change
+ on_failure: always
diff --git a/.travis/platform.sh b/.travis/platform.sh
new file mode 100644
index 0000000..7259a7d
--- /dev/null
+++ b/.travis/platform.sh
@@ -0,0 +1,15 @@
+if [ -z "${PLATFORM:-}" ]; then
+ PLATFORM=$TRAVIS_OS_NAME;
+fi
+
+if [ "$PLATFORM" == "osx" ]; then
+ PLATFORM="macosx";
+fi
+
+if [ -z "$PLATFORM" ]; then
+ if [ "$(uname)" == "Linux" ]; then
+ PLATFORM="linux";
+ else
+ PLATFORM="macosx";
+ fi;
+fi
diff --git a/.travis/setenv_lua.sh b/.travis/setenv_lua.sh
new file mode 100644
index 0000000..8d8c825
--- /dev/null
+++ b/.travis/setenv_lua.sh
@@ -0,0 +1,3 @@
+export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin
+bash .travis/setup_lua.sh
+eval `$HOME/.lua/luarocks path`
diff --git a/.travis/setup_lua.sh b/.travis/setup_lua.sh
new file mode 100644
index 0000000..5908085
--- /dev/null
+++ b/.travis/setup_lua.sh
@@ -0,0 +1,122 @@
+#! /bin/bash
+
+# A script for setting up environment for travis-ci testing.
+# Sets up Lua and Luarocks.
+# LUA must be "lua5.1", "lua5.2" or "luajit".
+# luajit2.0 - master v2.0
+# luajit2.1 - master v2.1
+
+set -eufo pipefail
+
+LUAJIT_BASE="LuaJIT-2.0.3"
+
+source .travis/platform.sh
+
+LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua
+
+LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks
+
+mkdir $HOME/.lua
+
+LUAJIT="no"
+
+if [ "$PLATFORM" == "macosx" ]; then
+ if [ "$LUA" == "luajit" ]; then
+ LUAJIT="yes";
+ fi
+ if [ "$LUA" == "luajit2.0" ]; then
+ LUAJIT="yes";
+ fi
+ if [ "$LUA" == "luajit2.1" ]; then
+ LUAJIT="yes";
+ fi;
+elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then
+ LUAJIT="yes";
+fi
+
+mkdir -p "$LUA_HOME_DIR"
+
+if [ "$LUAJIT" == "yes" ]; then
+
+ if [ "$LUA" == "luajit" ]; then
+ curl http://luajit.org/download/$LUAJIT_BASE.tar.gz | tar xz;
+ else
+ git clone http://luajit.org/git/luajit-2.0.git $LUAJIT_BASE;
+ fi
+
+ cd $LUAJIT_BASE
+
+ if [ "$LUA" == "luajit2.1" ]; then
+ git checkout v2.1;
+ fi
+
+ make && make install PREFIX="$LUA_HOME_DIR"
+
+ if [ "$LUA" == "luajit2.1" ]; then
+ ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-alpha $HOME/.lua/luajit
+ ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-alpha $HOME/.lua/lua;
+ else
+ ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit
+ ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua;
+ fi;
+
+else
+
+ if [ "$LUA" == "lua5.1" ]; then
+ curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
+ cd lua-5.1.5;
+ elif [ "$LUA" == "lua5.2" ]; then
+ curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz
+ cd lua-5.2.4;
+ elif [ "$LUA" == "lua5.3" ]; then
+ curl http://www.lua.org/ftp/lua-5.3.0.tar.gz | tar xz
+ cd lua-5.3.0;
+ fi
+
+ make $PLATFORM
+ make INSTALL_TOP="$LUA_HOME_DIR" install;
+
+ ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua
+ ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac;
+
+fi
+
+cd $TRAVIS_BUILD_DIR
+
+lua -v
+
+LUAROCKS_BASE=luarocks-$LUAROCKS
+
+curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz
+
+cd $LUAROCKS_BASE
+
+if [ "$LUA" == "luajit" ]; then
+ ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
+elif [ "$LUA" == "luajit2.0" ]; then
+ ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR";
+elif [ "$LUA" == "luajit2.1" ]; then
+ ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR";
+else
+ ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR"
+fi
+
+make build && make install
+
+ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks
+
+cd $TRAVIS_BUILD_DIR
+
+luarocks --version
+
+rm -rf $LUAROCKS_BASE
+
+if [ "$LUAJIT" == "yes" ]; then
+ rm -rf $LUAJIT_BASE;
+elif [ "$LUA" == "lua5.1" ]; then
+ rm -rf lua-5.1.5;
+elif [ "$LUA" == "lua5.2" ]; then
+ rm -rf lua-5.2.4;
+elif [ "$LUA" == "lua5.3" ]; then
+ rm -rf lua-5.3.0;
+fi
diff --git a/README.md b/README.md
index 01cc083..b3903c0 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
##Valua - Validation for Lua
+[![Build Status](https://travis-ci.org/Etiene/valua.svg?branch=master)](https://travis-ci.org/Etiene/valua)
+
A module for making chained validations. Create your objects, append your tests, use and reuse it!
Originally bundled with Sailor MVC Web Framework, now released as a separated module.
diff --git a/valua-0.2.1-2.rockspec b/valua-0.2.1-2.rockspec
new file mode 100644
index 0000000..8584880
--- /dev/null
+++ b/valua-0.2.1-2.rockspec
@@ -0,0 +1,23 @@
+package = "Valua"
+version = "0.2.1-1"
+source = {
+ url = "git://github.com/Etiene/valua",
+ tag = "v0.2.1"
+}
+description = {
+ summary = "Validation for Lua!",
+ detailed = [[
+ This module provides tools for validating values, very useful in forms, but also usable elsewhere. It works in appended chains. Create a new validation object and start chaining your test functions.
+ ]],
+ homepage = "https://github.com/Etiene/valua",
+ license = "MIT"
+}
+dependencies = {
+ "lua >= 5.1, < 5.4"
+}
+build = {
+ type = "builtin",
+ modules = {
+ ["valua"] = "valua.lua",
+ }
+} \ No newline at end of file