diff -Nru lua-cliargs-3.0-1/debian/changelog lua-cliargs-3.0-2/debian/changelog --- lua-cliargs-3.0-1/debian/changelog 2017-08-26 03:32:31.000000000 +0000 +++ lua-cliargs-3.0-2/debian/changelog 2018-04-05 01:16:34.000000000 +0000 @@ -1,3 +1,13 @@ +lua-cliargs (3.0-2-1) unstable; urgency=medium + + * New upstream release + * Bump debhelper compat to 11 + * Bump Standards-Version to 4.1.3, no changes needed + * Update Vcs-* to point to salsa.d.o + * Update copyright years + + -- Jason Pleau Wed, 04 Apr 2018 21:16:34 -0400 + lua-cliargs (3.0-1-3) unstable; urgency=medium * Add to the lua-busted build-dependency to break a circular diff -Nru lua-cliargs-3.0-1/debian/compat lua-cliargs-3.0-2/debian/compat --- lua-cliargs-3.0-1/debian/compat 2015-04-30 00:14:27.000000000 +0000 +++ lua-cliargs-3.0-2/debian/compat 2018-04-05 01:09:11.000000000 +0000 @@ -1 +1 @@ -9 +11 diff -Nru lua-cliargs-3.0-1/debian/control lua-cliargs-3.0-2/debian/control --- lua-cliargs-3.0-1/debian/control 2017-08-26 03:32:31.000000000 +0000 +++ lua-cliargs-3.0-2/debian/control 2018-04-05 01:09:13.000000000 +0000 @@ -2,16 +2,16 @@ Section: interpreters Priority: optional Maintainer: Jason Pleau -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 11), dh-lua, lua-busted , lua-dkjson, lua-inifile, lua-yaml -Standards-Version: 4.1.0 +Standards-Version: 4.1.3 Homepage: https://github.com/amireh/lua_cliargs/ -Vcs-Git: https://anonscm.debian.org/cgit/pkg-lua/lua-cliargs.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-lua/lua-cliargs.git +Vcs-Git: https://salsa.debian.org/lua-team/lua-cliargs +Vcs-Browser: https://salsa.debian.org/lua-team/lua-cliargs Package: lua-cliargs Architecture: all diff -Nru lua-cliargs-3.0-1/debian/copyright lua-cliargs-3.0-2/debian/copyright --- lua-cliargs-3.0-1/debian/copyright 2017-08-26 03:31:05.000000000 +0000 +++ lua-cliargs-3.0-2/debian/copyright 2018-04-05 01:09:13.000000000 +0000 @@ -3,11 +3,11 @@ Source: https://github.com/amireh/lua_cliargs/ Files: * -Copyright: Copyright (c) 2012 Ahmad Amireh +Copyright: Copyright (c) 2012-2015 Ahmad Amireh License: Expat Files: debian/* -Copyright: Copyright (c) 2015 Jason Pleau +Copyright: Copyright (c) 2015-2018 Jason Pleau License: Expat License: Expat diff -Nru lua-cliargs-3.0-1/lua_cliargs-3.0-1.rockspec lua-cliargs-3.0-2/lua_cliargs-3.0-1.rockspec --- lua-cliargs-3.0-1/lua_cliargs-3.0-1.rockspec 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/lua_cliargs-3.0-1.rockspec 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -package = "lua_cliargs" -version = "3.0-1" -source = { - url = "https://github.com/amireh/lua_cliargs/archive/v3.0-1.tar.gz", - dir = "lua_cliargs-3.0-1" -} -description = { - summary = "A command-line argument parser.", - detailed = [[ - This module adds support for accepting CLI arguments easily using multiple - notations and argument types. - - cliargs allows you to define required, optional, and flag arguments. - ]], - homepage = "https://github.com/amireh/lua_cliargs", - license = "MIT " -} -dependencies = { - "lua >= 5.1" -} -build = { - type = "builtin", - modules = { - ["cliargs"] = "src/cliargs.lua", - ["cliargs.config_loader"] = "src/cliargs/config_loader.lua", - ["cliargs.constants"] = "src/cliargs/constants.lua", - ["cliargs.core"] = "src/cliargs/core.lua", - ["cliargs.parser"] = "src/cliargs/parser.lua", - ["cliargs.printer"] = "src/cliargs/printer.lua", - ["cliargs.utils.disect"] = "src/cliargs/utils/disect.lua", - ["cliargs.utils.disect_argument"] = "src/cliargs/utils/disect_argument.lua", - ["cliargs.utils.filter"] = "src/cliargs/utils/filter.lua", - ["cliargs.utils.lookup"] = "src/cliargs/utils/lookup.lua", - ["cliargs.utils.shallow_copy"] = "src/cliargs/utils/shallow_copy.lua", - ["cliargs.utils.split"] = "src/cliargs/utils/split.lua", - ["cliargs.utils.trim"] = "src/cliargs/utils/trim.lua", - ["cliargs.utils.wordwrap"] = "src/cliargs/utils/wordwrap.lua", - } -} diff -Nru lua-cliargs-3.0-1/lua_cliargs-3.0-2.rockspec lua-cliargs-3.0-2/lua_cliargs-3.0-2.rockspec --- lua-cliargs-3.0-1/lua_cliargs-3.0-2.rockspec 1970-01-01 00:00:00.000000000 +0000 +++ lua-cliargs-3.0-2/lua_cliargs-3.0-2.rockspec 2018-04-02 08:00:21.000000000 +0000 @@ -0,0 +1,39 @@ +package = "lua_cliargs" +version = "3.0-2" +source = { + url = "https://github.com/amireh/lua_cliargs/archive/v3.0-2.tar.gz", + dir = "lua_cliargs-3.0-2" +} +description = { + summary = "A command-line argument parser.", + detailed = [[ + This module adds support for accepting CLI arguments easily using multiple + notations and argument types. + + cliargs allows you to define required, optional, and flag arguments. + ]], + homepage = "https://github.com/amireh/lua_cliargs", + license = "MIT " +} +dependencies = { + "lua >= 5.1" +} +build = { + type = "builtin", + modules = { + ["cliargs"] = "src/cliargs.lua", + ["cliargs.config_loader"] = "src/cliargs/config_loader.lua", + ["cliargs.constants"] = "src/cliargs/constants.lua", + ["cliargs.core"] = "src/cliargs/core.lua", + ["cliargs.parser"] = "src/cliargs/parser.lua", + ["cliargs.printer"] = "src/cliargs/printer.lua", + ["cliargs.utils.disect"] = "src/cliargs/utils/disect.lua", + ["cliargs.utils.disect_argument"] = "src/cliargs/utils/disect_argument.lua", + ["cliargs.utils.filter"] = "src/cliargs/utils/filter.lua", + ["cliargs.utils.lookup"] = "src/cliargs/utils/lookup.lua", + ["cliargs.utils.shallow_copy"] = "src/cliargs/utils/shallow_copy.lua", + ["cliargs.utils.split"] = "src/cliargs/utils/split.lua", + ["cliargs.utils.trim"] = "src/cliargs/utils/trim.lua", + ["cliargs.utils.wordwrap"] = "src/cliargs/utils/wordwrap.lua", + } +} diff -Nru lua-cliargs-3.0-1/README.md lua-cliargs-3.0-2/README.md --- lua-cliargs-3.0-1/README.md 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/README.md 2018-04-02 08:00:21.000000000 +0000 @@ -106,6 +106,11 @@ ## Changelog +### 3.0-2 + +- optimized an internal routine responsible for word-wrapping. Thanks to + @Tieske, refs GH-47 + ### Changes from 2.5.x 3.0 This major version release contains BREAKING API CHANGES. See the UPGRADE guide for help in updating your code to make use of it. diff -Nru lua-cliargs-3.0-1/spec/utils/wordwrap_spec.lua lua-cliargs-3.0-2/spec/utils/wordwrap_spec.lua --- lua-cliargs-3.0-1/spec/utils/wordwrap_spec.lua 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/spec/utils/wordwrap_spec.lua 2018-04-02 08:00:21.000000000 +0000 @@ -7,20 +7,20 @@ local expected, result result = subject(text, 10) - expected = "123456789\n123456789\n123456789!" + expected = { "123456789", "123456789", "123456789!" } assert.is.same(result, expected) -- exact length + 1 overflow result = subject(text, 9) - expected = "123456789\n123456789\n123456789\n!" + expected = { "123456789", "123456789", "123456789", "!" } assert.is.same(result, expected) - result = subject(text, 9, nil, true) - expected = "123456789\n123456789\n123456789!" + result = subject(text, 9, true) + expected = { "123456789", "123456789", "123456789!" } assert.is.same(result, expected) result = subject(text, 8) - expected = "12345678\n9\n12345678\n9\n12345678\n9!" + expected = { "12345678", "9", "12345678", "9", "12345678", "9!" } assert.is.same(result, expected) end) end) diff -Nru lua-cliargs-3.0-1/src/cliargs/printer.lua lua-cliargs-3.0-2/src/cliargs/printer.lua --- lua-cliargs-3.0-1/src/cliargs/printer.lua 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/src/cliargs/printer.lua 2018-04-02 08:00:21.000000000 +0000 @@ -92,7 +92,7 @@ local function append(label, desc) label = " " .. label .. string.rep(" ", col1 - (#label + 2)) - desc = wordwrap(desc, col2) -- word-wrap + desc = table.concat(wordwrap(desc, col2), "\n") -- word-wrap desc = desc:gsub("\n", "\n" .. string.rep(" ", col1)) -- add padding msg = msg .. label .. desc .. "\n" diff -Nru lua-cliargs-3.0-1/src/cliargs/utils/wordwrap.lua lua-cliargs-3.0-2/src/cliargs/utils/wordwrap.lua --- lua-cliargs-3.0-1/src/cliargs/utils/wordwrap.lua 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/src/cliargs/utils/wordwrap.lua 2018-04-02 08:00:21.000000000 +0000 @@ -3,48 +3,34 @@ local function buildline(words, size, overflow) -- if overflow is set, a word longer than size, will overflow the size -- otherwise it will be chopped in line-length pieces - local line = "" - if string.len(words[1]) > size then + local line = {} + if #words[1] > size then -- word longer than line if overflow then - line = words[1] + line[1] = words[1] table.remove(words, 1) else - line = words[1]:sub(1, size) + line[1] = words[1]:sub(1, size) words[1] = words[1]:sub(size + 1, -1) end else - while words[1] and (#line + string.len(words[1]) + 1 <= size) or (line == "" and #words[1] == size) do - if line == "" then - line = words[1] - else - line = line .. " " .. words[1] - end + local len = 0 + while words[1] and (len + #words[1] + 1 <= size) or (len == 0 and #words[1] == size) do + line[#line+1] = words[1] + len = len + #words[1] + 1 table.remove(words, 1) end end - return line, words + return table.concat(line, " "), words end -local function wordwrap(str, size, pad, overflow) +local function wordwrap(str, size, overflow) -- if overflow is set, then words longer than a line will overflow -- otherwise, they'll be chopped in pieces - pad = pad or 0 - - local line - local out = "" - local padstr = string.rep(" ", pad) - local words = split(str, ' ') - + local out, words = {}, split(str, ' ') while words[1] do - line, words = buildline(words, size, overflow) - if out == "" then - out = padstr .. line - else - out = out .. "\n" .. padstr .. line - end + out[#out+1], words = buildline(words, size, overflow) end - return out end diff -Nru lua-cliargs-3.0-1/src/cliargs.lua lua-cliargs-3.0-2/src/cliargs.lua --- lua-cliargs-3.0-1/src/cliargs.lua 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/src/cliargs.lua 2018-04-02 08:00:21.000000000 +0000 @@ -27,6 +27,6 @@ cli = nil end -cli.VERSION = "3.0-1" +cli.VERSION = "3.0-2" return cli \ No newline at end of file diff -Nru lua-cliargs-3.0-1/.travis_setup.sh lua-cliargs-3.0-2/.travis_setup.sh --- lua-cliargs-3.0-1/.travis_setup.sh 1970-01-01 00:00:00.000000000 +0000 +++ lua-cliargs-3.0-2/.travis_setup.sh 2018-04-02 08:00:21.000000000 +0000 @@ -0,0 +1,46 @@ +# A script for setting up environment for travis-ci testing. +# Sets up Lua and Luarocks. +# LUA must be "Lua 5.1", "Lua 5.2", "Lua 5.3" or "LuaJIT 2.0". +# +# Shamelessly adapted from [busted](https://github.com/Olivine-Labs/busted). + +set -e + +echo 'rocks_servers = { + "http://rocks.moonscript.org/", + "http://luarocks.org/repositories/rocks", + "http://luarocks.logiceditor.com/rocks", + "http://liblua.so/luarocks/repositories/rocks" +}' >> ~/config.lua + + +if [ "$LUA" == "LuaJIT 2.0" ]; then + wget -O - http://luajit.org/download/LuaJIT-2.0.4.tar.gz | tar xz + cd LuaJIT-2.0.4 + make && sudo make install INSTALL_TSYMNAME=lua; +else + if [ "$LUA" == "Lua 5.1" ]; then + wget -O - http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz + cd lua-5.1.5; + elif [ "$LUA" == "Lua 5.2" ]; then + wget -O - http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz + cd lua-5.2.4; + elif [ "$LUA" == "Lua 5.3" ]; then + wget -O - http://www.lua.org/ftp/lua-5.3.0.tar.gz | tar xz + cd lua-5.3.0; + fi + sudo make linux install; +fi + +cd .. +wget -O - http://luarocks.org/releases/luarocks-2.2.2.tar.gz | tar xz || wget -O - http://keplerproject.github.io/luarocks/releases/luarocks-2.2.2.tar.gz | tar xz +cd luarocks-2.2.2 + +if [ "$LUA" == "LuaJIT 2.0" ]; then + ./configure --with-lua-include=/usr/local/include/luajit-2.0; +else + ./configure; +fi + +make build && sudo make install +cd .. diff -Nru lua-cliargs-3.0-1/.travis.yml lua-cliargs-3.0-2/.travis.yml --- lua-cliargs-3.0-1/.travis.yml 2016-01-12 09:32:26.000000000 +0000 +++ lua-cliargs-3.0-2/.travis.yml 2018-04-02 08:00:21.000000000 +0000 @@ -1,21 +1,32 @@ -language: erlang -otp_release: - - R15B02 +language: c env: - - LUA="" - - LUA="luajit" + - LUA='Lua 5.1' + - LUA='Lua 5.2' + - LUA='Lua 5.3' + - LUA='LuaJIT 2.0' branches: only: - master +before_install: + - bash .travis_setup.sh + install: - - sudo apt-get install luajit - - sudo apt-get install luarocks - - sudo luarocks install busted 2.0rc10-1 + - sudo apt-get update -qq + - sudo luarocks install luasec + - sudo luarocks install luacheck + - sudo luarocks install busted - sudo luarocks install dkjson - sudo luarocks install yaml - sudo luarocks install inifile -script: "busted spec" +script: + - luacheck examples src spec + - busted spec + +notifications: + email: + on_success: change + on_failure: always \ No newline at end of file