Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit d6633e9
Author: thefosk <[email protected]>
Date:   Wed Jan 20 19:46:43 2016 -0800

    Configuration in API - force-leave in API - additional check for luajit

commit e7ce5d6
Author: Thibault Charbonnier <[email protected]>
Date:   Thu Dec 24 01:12:11 2015 -0800

    fix(api) allow to delete APIs and Consumers by name

commit cf4ea3a
Author: Thibault Charbonnier <[email protected]>
Date:   Wed Dec 23 20:17:58 2015 -0800

    docs(readme) update getkong links to https

commit 738cd8e
Author: Thibault Charbonnier <[email protected]>
Date:   Wed Dec 23 15:48:19 2015 -0800

    docs(readme) add more development instructions

    The different test suites and the way test/development running Kong need
    a different configuration file can be confusing at first, so this adds
    some more insight as to what is needed and why.

    Of course, this is the current system but nothing prevents it from being
    improved in the future.

commit 4ea5b2b
Author: thefosk <[email protected]>
Date:   Sat Oct 17 03:03:38 2015 -0700

    Adding cache API - CLI Rewrite - Serf integration/Clustering - Hooks/Events - Invalidations

commit 9f1ffb3
Author: Shashi Ranjan <[email protected]>
Date:   Tue Nov 17 18:37:00 2015 -0800

    fix(resp-tranformer) handle already existing headers

    Now add will only add header/json if it does not exist, config `append` added to support adding new value to existing header/json. If header does not exist, a new one will be added. config `replace added to replace the value of existing header/json with new value

commit 20d4b72
Author: Shashi Ranjan <[email protected]>
Date:   Mon Dec 21 16:39:33 2015 -0800

    refactor(req-transformer) append, replace of header/querystring

    Fix for issue Kong#393 for response-transformer motivated fix for this plugin too. New config append/replace added to support adding new value to existing header/querystring and
    replcaing  existing header/querystring with new value.

commit 5feacd1
Author: Thibault Charbonnier <[email protected]>
Date:   Thu Dec 24 01:12:11 2015 -0800

    fix(api) allow to delete APIs and Consumers by name

    Cassandra from 3 to 2 during an update and a delete, it removed the
    possibility of updating and deleting APIs and Consumers by their name,
    because that change made it so the base_dao's underlying `delete()` and
    `update()` were directly used instead of first querying the entity.
    Querying the entity first allowed to retrieve its PRIMARY KEY fields,
    and hence `delete()` and `update()` never complained. But by removing
    this initial retrieving, we removed this feature, and **there were not
    tests** for it!

    - This adds test for PATCH/DELETE APIs and Consumers by name/username
    - Adds an argument to the base_dao `update()` and `delete()` to select
      by any field rather than only the PRIMARY KEY fields.

commit 32b9945
Author: Thibault Charbonnier <[email protected]>
Date:   Wed Dec 23 20:17:58 2015 -0800

    docs(readme) update getkong links to https

commit 6c31ec5
Author: Thibault Charbonnier <[email protected]>
Date:   Wed Dec 23 15:48:19 2015 -0800

    docs(readme) add more development instructions

    The different test suites and the way test/development running Kong need
    a different configuration file can be confusing at first, so this adds
    some more insight as to what is needed and why.

    Of course, this is the current system but nothing prevents it from being
    improved in the future.
  • Loading branch information
subnetmarco committed Jan 22, 2016
1 parent 14351e3 commit 4720b7b
Show file tree
Hide file tree
Showing 142 changed files with 5,431 additions and 1,196 deletions.
2 changes: 1 addition & 1 deletion .ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

CMD="busted -v -o gtest --exclude-tags=ci"
CMD="busted -v -o gtest --exclude-tags=ci --repeat=3"

if [ "$TEST_SUITE" == "unit" ]; then
CMD="$CMD --coverage spec/unit && luacov-coveralls -i kong"
Expand Down
22 changes: 22 additions & 0 deletions .ci/setup_dnsmasq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

if [ "$TEST_SUITE" == "unit" ]; then
echo "Exiting, no integration tests"
exit
fi

mkdir -p $DNSMASQ_DIR

if [ ! "$(ls -A $DNSMASQ_DIR)" ]; then
pushd $DNSMASQ_DIR
wget http://www.thekelleys.org.uk/dnsmasq/dnsmasq-${DNSMASQ_VERSION}.tar.gz
tar xzf dnsmasq-${DNSMASQ_VERSION}.tar.gz

pushd dnsmasq-${DNSMASQ_VERSION}
make install DESTDIR=$DNSMASQ_DIR
popd

popd
fi
28 changes: 14 additions & 14 deletions .ci/setup_lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ source .ci/platform.sh
# Lua/LuaJIT
############

if [ "$LUA" == "luajit" ]; then
if [ "$LUA_VERSION" == "luajit" ]; then
LUAJIT="yes"
LUA="luajit-2.0"
elif [ "$LUA" == "luajit-2.0" ]; then
LUA_VERSION="luajit-2.0"
elif [ "$LUA_VERSION" == "luajit-2.0" ]; then
LUAJIT="yes"
elif [ "$LUA" == "luajit-2.1" ]; then
elif [ "$LUA_VERSION" == "luajit-2.1" ]; then
LUAJIT="yes"
fi

Expand All @@ -33,32 +33,32 @@ if [ "$LUAJIT" == "yes" ]; then
git clone https://github.com/luajit/luajit $LUAJIT_DIR
pushd $LUAJIT_DIR

if [ "$LUA" == "luajit-2.0" ]; then
if [ "$LUA_VERSION" == "luajit-2.0" ]; then
git checkout v2.0.4
elif [ "$LUA" == "luajit-2.1" ]; then
elif [ "$LUA_VERSION" == "luajit-2.1" ]; then
git checkout v2.1
fi

make
make install PREFIX=$LUAJIT_DIR
popd

if [ "$LUA" == "luajit-2.1" ]; then
if [ "$LUA_VERSION" == "luajit-2.1" ]; then
ln -sf $LUAJIT_DIR/bin/luajit-2.1.0-beta1 $LUAJIT_DIR/bin/luajit
fi

ln -sf $LUAJIT_DIR/bin/luajit $LUAJIT_DIR/bin/lua
fi

LUA_INCLUDE="$LUAJIT_DIR/include/$LUA"
LUA_INCLUDE="$LUAJIT_DIR/include/$LUA_VERSION"
else
if [ "$LUA" == "lua5.1" ]; then
if [ "$LUA_VERSION" == "lua5.1" ]; then
curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
pushd lua-5.1.5
elif [ "$LUA" == "lua5.2" ]; then
elif [ "$LUA_VERSION" == "lua5.2" ]; then
curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz
pushd lua-5.2.3
elif [ "$LUA" == "lua5.3" ]; then
elif [ "$LUA_VERSION" == "lua5.3" ]; then
curl http://www.lua.org/ftp/lua-5.3.0.tar.gz | tar xz
pushd lua-5.3.0
fi
Expand All @@ -84,11 +84,11 @@ git checkout v$LUAROCKS_VERSION

if [ "$LUAJIT" == "yes" ]; then
LUA_DIR=$LUAJIT_DIR
elif [ "$LUA" == "lua5.1" ]; then
elif [ "$LUA_VERSION" == "lua5.1" ]; then
CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --lua-version=5.1"
elif [ "$LUA" == "lua5.2" ]; then
elif [ "$LUA_VERSION" == "lua5.2" ]; then
CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --lua-version=5.2"
elif [ "$LUA" == "lua5.3" ]; then
elif [ "$LUA_VERSION" == "lua5.3" ]; then
CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --lua-version=5.3"
fi

Expand Down
17 changes: 17 additions & 0 deletions .ci/setup_serf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

if [ "$TEST_SUITE" == "unit" ]; then
echo "Exiting, no integration tests"
exit
fi

mkdir -p $SERF_DIR

if [ ! "$(ls -A $SERF_DIR)" ]; then
pushd $SERF_DIR
wget https://releases.hashicorp.com/serf/${SERF_VERSION}/serf_${SERF_VERSION}_linux_amd64.zip
unzip serf_${SERF_VERSION}_linux_amd64.zip
popd
fi
4 changes: 2 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
redefined = false
unused_args = false
globals = {"ngx", "dao", "app", "configuration", "process_id"}
globals = {"ngx", "dao", "app", "configuration", "events"}

files["kong/"] = {
std = "luajit"
Expand All @@ -20,5 +20,5 @@ files["kong/vendor/resty_http.lua"] = {
}

files["spec/"] = {
globals = {"describe", "it", "before_each", "setup", "after_each", "teardown", "stub", "mock", "spy", "finally", "pending"}
globals = {"describe", "it", "before_each", "setup", "after_each", "teardown", "stub", "mock", "spy", "finally", "pending", "build"}
}
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ addons:
- build-essential
env:
global:
- LUA=luajit-2.1
- CASSANDRA_VERSION=2.1.9
- LUA_VERSION=luajit-2.1
- CASSANDRA_VERSION=2.2.4
- LUAROCKS_VERSION=2.2.2
- OPENSSL_VERSION=1.0.2e
- OPENRESTY_VERSION=1.9.3.1
- SERF_VERSION=0.7.0
- DNSMASQ_VERSION=2.75
- LUAJIT_DIR=$HOME/luajit
- LUAROCKS_DIR=$HOME/luarocks
- OPENRESTY_DIR=$HOME/openresty
- SERF_DIR=$HOME/serf
- DNSMASQ_DIR=$HOME/dnsmasq
- CASSANDRA_HOSTS=127.0.0.1
matrix:
- TEST_SUITE=unit
Expand All @@ -28,7 +32,9 @@ before_install:
- bash .ci/setup_lua.sh
- bash .ci/setup_openresty.sh
- bash .ci/setup_cassandra.sh
- export PATH="$LUAJIT_DIR/bin:$LUAROCKS_DIR/bin:$OPENRESTY_DIR/nginx/sbin:$PATH"
- bash .ci/setup_serf.sh
- bash .ci/setup_dnsmasq.sh
- export PATH="$LUAJIT_DIR/bin:$LUAROCKS_DIR/bin:$OPENRESTY_DIR/nginx/sbin:$SERF_DIR:$DNSMASQ_DIR/usr/local/sbin:$PATH"
- export LUA_PATH="./?.lua;$LUAROCKS_DIR/share/lua/5.1/?.lua;$LUAROCKS_DIR/share/lua/5.1/?/init.lua;$LUAROCKS_DIR/lib/lua/5.1/?.lua;$LUA_PATH"
- export LUA_CPATH="./?.so;$LUAROCKS_DIR/lib/lua/5.1/?.so;$LUA_CPATH"
install:
Expand All @@ -38,7 +44,6 @@ install:
- luarocks install luacheck
- luarocks make kong-*.rockspec
- "kong config -c kong.yml -e TEST"
- 'sed -i "2 i\dns_resolver: server" kong_TEST.yml'
script:
- make lint
- .ci/run_tests.sh
Expand All @@ -49,4 +54,6 @@ cache:
- $LUAJIT_DIR
- $LUAROCKS_DIR
- $OPENRESTY_DIR
- $HOME/.ccm/repository
- $SERF_DIR
- $DNSMASQ_DIR
- $HOME/.ccm/repository
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ coverage:
@rm -f luacov.*
@busted --coverage spec/
@luacov -c spec/.luacov
@tail -n 1 luacov.report.out | awk '{ print $$3 }'
@tail -n 1 luacov.report.out | awk '{ print $$3 }'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Support, Demo, Training, API Certifications and Consulting available at https://
## License

```
Copyright 2015 Mashape, Inc
Copyright 2016 Mashape, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
28 changes: 15 additions & 13 deletions bin/kong
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,28 @@
-- This script is not parsed by lapp due to limitations of the said framework as it
-- is currently implemented.

local cutils = require "kong.cli.utils"
local infos = cutils.get_kong_infos()
local luarocks = require "kong.cli.utils.luarocks"
local infos = luarocks.get_kong_infos()
local commands = {
db = "kong.cli.db",
stop = "kong.cli.stop",
quit = "kong.cli.quit",
start = "kong.cli.start",
reload = "kong.cli.reload",
config = "kong.cli.config",
restart = "kong.cli.restart",
version = "kong.cli.version",
["--version"] = "kong.cli.version",
migrations = "kong.cli.migrations"
db = "kong.cli.cmds.db",
stop = "kong.cli.cmds.stop",
quit = "kong.cli.cmds.quit",
start = "kong.cli.cmds.start",
reload = "kong.cli.cmds.reload",
config = "kong.cli.cmds.config",
restart = "kong.cli.cmds.restart",
version = "kong.cli.cmds.version",
status = "kong.cli.cmds.status",
migrations = "kong.cli.cmds.migrations",
cluster = "kong.cli.cmds.cluster",
["--version"] = "kong.cli.cmds.version"
}

local help_message = string.format([[
Usage: kong <command>

where <command> is one of:
start, restart, reload, stop, quit, version
start, restart, reload, stop, quit, cluster, status, migrations, version

kong --help print this message
kong <command> --help print the help message of a command
Expand Down
Loading

0 comments on commit 4720b7b

Please sign in to comment.