diff --git a/ChangeLog b/ChangeLog index 42418e48b..c3077e140 100644 --- a/ChangeLog +++ b/ChangeLog @@ -38,6 +38,7 @@ Features + Added the configuration variable 'print.empty.columns'. + The 'push' and 'pull' commands now properly distinguish between a missing transport utility and other errors (thanks to Russell Steicke). + + Removed support for Lua extensions. Bugs + Fixed bug #642, so that the default 'data.location=~/.task' preserves the diff --git a/INSTALL b/INSTALL index f31d49ab4..1932b6299 100644 --- a/INSTALL +++ b/INSTALL @@ -112,11 +112,6 @@ Cygwin again, or reinstall Cygwin under your normal Windows login. -Darwin - If you're having trouble with Lua, check to see if the include files were - installed. If you're using fink, this will require the lua51-dev package in - addition to lua51. - Darwin, 32bit The taskwarrior packages will not work on a 32-bit OSX installation on Core Duo hardware. You will need to build Taskwarrior from source, and use this @@ -134,7 +129,7 @@ Darwin, 32bit Troubleshooting --------------- -If you've recently made changes to dependencies (by reinstalling Lua, for +If you've recently made changes to dependencies (by reinstalling them, for example) be sure to rerun 'cmake .' before trying to execute 'make' again. CMake will run and locate all the necessary pieces for the build, and create diff --git a/NEWS b/NEWS index 63f6c440c..d22c76188 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,7 @@ Newly deprecated features in taskwarrior 2.2.0 - The bash completion script no longer expands IDs after 'depends:'. (Such expansion required running gc() which is not correct.) + - The incomplete support for Lua extensions was removed. --- diff --git a/cmake.h.in b/cmake.h.in index 38ae27a74..c3be2aa19 100644 --- a/cmake.h.in +++ b/cmake.h.in @@ -39,9 +39,6 @@ #cmakedefine SOLARIS #cmakedefine UNKNOWN -/* Found the lua library */ -#cmakedefine HAVE_LIBLUA - /* Found the pthread library */ #cmakedefine HAVE_LIBPTHREAD diff --git a/doc/man/task-faq.5.in b/doc/man/task-faq.5.in index 329ef139c..be557b4a6 100644 --- a/doc/man/task-faq.5.in +++ b/doc/man/task-faq.5.in @@ -340,17 +340,6 @@ The day in question has to be boxed by a range, like this: Note that a single date, such as 3/29/2013 does not refer to a whole day, but to a single point in time, 3/20/2013 0:00:00. -.TP -.B Q: Why Lua as an extension language? -Lua has many positive attributes: - - - Lua is written using tight, fast, standard C - - Lua is a breeze to integrate into any product - - The Lua source code is beautifully written - - Lua is a small language - -Guile, Scheme and Neko were also considered. - .TP .B Q: How can I help? There are lots of ways. Here are some: diff --git a/package-config/osx/README b/package-config/osx/README index c5c6dfa9a..49ee6f5dc 100644 --- a/package-config/osx/README +++ b/package-config/osx/README @@ -66,23 +66,7 @@ Note: This is being written from the OSX 10.6 perspective, and may therefore from one release to the next. While this is not a perfect solution, it has saved us many times from releasing code that is inferior. - The first step is to modify the test suite Makefile to remove the Lua line. - This is because we do not yet have dynamic detection of the Lua library for - the unit tests. - $ cd ~/task-package.git/src/tests - $ vi Makefile - - Any text editor will do, but look for this line (line 5): - - LFLAGS = -L/usr/local/lib -llua - - and change it to: - - LFLAGS = -L/usr/local/lib - - Now build the unit tests: - $ make -j 2 ... diff --git a/scripts/extensions/command.lua b/scripts/extensions/command.lua deleted file mode 100644 index 441331426..000000000 --- a/scripts/extensions/command.lua +++ /dev/null @@ -1,45 +0,0 @@ --- Command Extension. --- Implementing 'random'. - --- Arguments: None --- Returns: An 8-element list of installation details. Only called once, on --- installation of the extension. -function install () - return 'command', -- Type - 'random', -- Name - '1.0', -- Version - 'Displays a random pending task', -- Description - 'Paul Beckingham', -- Author - 'paul@beckingham.net', -- Contact - 'MIT', -- License - '© 2013, Göteborg Bit Factory' -- Copyright -end - --- Arguments: None --- Returns: Usage syntax, such as "task random" -function usage () - return 'task random' -end - --- Arguments: None --- Returns: 1 --> command does not modify data --- 0 --> command modifies data -function read_only () - return true -end - --- Arguments: None --- Returns: 1 --> command displays task ID --- 0 --> no ID displayed -function display_id () - return true -end - --- Arguments: None --- Returns: 1 --> command failed --- 0 --> success -function execute (command_line) - task_footnote_message ('Not implemented') - return 1 -end - diff --git a/scripts/extensions/dom.lua b/scripts/extensions/dom.lua deleted file mode 100644 index a1cc3e9f1..000000000 --- a/scripts/extensions/dom.lua +++ /dev/null @@ -1,26 +0,0 @@ --- DOM Extension. --- Implementing 'system.load.average'. - --- Arguments: None --- Returns: An 8-element list of installation details. Only called once, on --- installation of the extension. -function install () - return 'dom', -- Type - 'system.load.average', -- Name - '1.0', -- Version - 'Provides access to system load', -- Description - 'Paul Beckingham', -- Author - 'paul@beckingham.net', -- Contact - 'MIT', -- License - '© 2013, Göteborg Bit Factory' -- Copyright -end - --- Arguments: The DOM reference to evaluate --- Returns: The value from the DOM lookup -function lookup (name) - if name == 'system.load.average' - then - return 1.23 -- Fake load average - end -end - diff --git a/scripts/extensions/format.lua b/scripts/extensions/format.lua deleted file mode 100644 index d29659754..000000000 --- a/scripts/extensions/format.lua +++ /dev/null @@ -1,23 +0,0 @@ --- Format Extension. --- Implementing 'uuid.short' - --- Arguments: None --- Returns: An 8-element list of installation details. Only called once, on --- installation of the extension. -function install () - return 'format', -- Type - 'uuid.short', -- Name - '1.0', -- Version - 'Provides short formatted UUIDs', -- Description - 'Paul Beckingham', -- Author - 'paul@beckingham.net', -- Contact - 'MIT', -- License - '© 2013, Göteborg Bit Factory' -- Copyright -end - --- Argument: Value to be formatted --- Returns: Formatted value -function format (value) - return string.sub (value, 0, 8) -end - diff --git a/scripts/extensions/program_hook.lua b/scripts/extensions/program_hook.lua deleted file mode 100644 index 75d1ea386..000000000 --- a/scripts/extensions/program_hook.lua +++ /dev/null @@ -1,29 +0,0 @@ --- Program Hook Extension. --- Implementing goodbye message. - --- Arguments: None --- Returns: An 8-element list of installation details. Only called once, on --- installation of the extension. -function install () - return 'program', -- Type - 'goodbye', -- Name - '1.0', -- Version - 'Simply says goodbye', -- Description - 'Paul Beckingham', -- Author - 'paul@beckingham.net', -- Contact - 'MIT', -- License - '© 2013, Göteborg Bit Factory' -- Copyright -end - --- Arguments: None --- Returns: String identifying valid program hook -function hook () - return 'on-exit' -end - --- Arguments: None --- Returns: 0 --> success only -function execute () - print ('Goodbye.') -end - diff --git a/scripts/extensions/task_hook.lua b/scripts/extensions/task_hook.lua deleted file mode 100644 index 444daf20c..000000000 --- a/scripts/extensions/task_hook.lua +++ /dev/null @@ -1,36 +0,0 @@ --- Task Hook Extension. --- Implementing encouragement message. - --- Arguments: None --- Returns: An 8-element list of installation details. Only called once, on --- installation of the extension. -function install () - return 'task', -- Type - 'encourage', -- Name - '1.0', -- Version - 'Positive feedback', -- Description - 'Paul Beckingham', -- Author - 'paul@beckingham.net', -- Contact - 'MIT', -- License - '© 2013, Göteborg Bit Factory' -- Copyright -end - --- Arguments: None --- Returns: String identifying valid program hook -function hook () - return 'on-task-complete' -end - --- Arguments: None --- Returns: 1 --> failure --- 0 --> success -function execute (uuid) - -- Only provide encouragement if the verbosity settings allow it. - verbosity = task_get ('rc.verbose') - if string.find (verbosity, 'encourage') ~= nil - then - task_footnote_message ('Good work.') - end - return 0 -end - diff --git a/scripts/extensions/uda.lua b/scripts/extensions/uda.lua deleted file mode 100644 index 27a4923cc..000000000 --- a/scripts/extensions/uda.lua +++ /dev/null @@ -1,64 +0,0 @@ --- User Defined Attribute Extension. --- Implementing 'priority'. - --- Arguments: None --- Returns: An 8-element list of installation details. Only called once, on --- installation of the extension. -function install () - return 'uda', -- Type - 'priority', -- Name - '1.0', -- Version - 'Implements priority attribute', -- Description - 'Paul Beckingham', -- Author - 'paul@beckingham.net', -- Contact - 'MIT', -- License - '© 2013, Göteborg Bit Factory' -- Copyright -end - --- Arguments: None --- Returns: Data type -function type () - return 'custom' -end - --- Arguments: None --- Returns: List of allowable values -function allowed () - return 'H', 'M', 'L', '' -end - --- Arguments: Left and right values to compare --- Returns: 1 --> left < right --- 0 --> left >= right -function compare (left, right) - if left == 'M' && right == 'H' then - return 1 - elseif left == 'L' && (right == 'H' || right == 'M') then - return 1 - elseif left == '' then - return 1 - end - - return 0 -end - --- Arguments: Raw data --- Returns: Formatted data --- Note: Shown here is a pass-through format, doing no formatting. This is --- also the default behavior if the format function is not --- implemented. -function format (value) - return value -end - --- Arguments: Value --- Returns: Urgency Term --- Note: Should reference rc.urgency..coefficient -function urgency (uuid) - coefficient = task_get ('rc.urgency.priority.coefficient') - - -- TODO Urgency calculation here - - return coefficient * 1.0 -end - diff --git a/src/API.cpp b/src/API.cpp deleted file mode 100644 index 401117667..000000000 --- a/src/API.cpp +++ /dev/null @@ -1,258 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Taskwarrior Lua API -// -// Copyright 2006-2013, Paul Beckingham, Federico Hernandez. -// Copyright © 1994–2008 Lua.org, PUC-Rio. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -//////////////////////////////////////////////////////////////////////////////// - -#define L10N // Localization complete. - -#include -#include -#include -#include -#include -#include - -extern Context context; - -#ifdef HAVE_LIBLUA - -//////////////////////////////////////////////////////////////////////////////// -static int api_task_header_message (lua_State* L) -{ - std::string message = luaL_checkstring (L, 1); - context.header (message); - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -static int api_task_footnote_message (lua_State* L) -{ - std::string message = luaL_checkstring (L, 1); - context.footnote (message); - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -static int api_task_debug_message (lua_State* L) -{ - std::string message = luaL_checkstring (L, 1); - context.debug (message); - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// Causes the shell mode task to exit. Ordinarily this does not occur. -static int api_task_exit (lua_State*) -{ - // TODO Is this the correct exception? How does the shell handle this? - std::cout << STRING_API_EXITING << std::endl; - exit (0); - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -// DOM reads. -static int api_task_get (lua_State* L) -{ - std::string name = luaL_checkstring (L, 1); - try - { - lua_pushstring (L, context.dom.get (name).c_str ()); - } - catch (...) - { - // TODO Error! - lua_pushstring (L, ""); - } - - return 1; // 1 returned value. -} - -//////////////////////////////////////////////////////////////////////////////// -// DOM writes. -static int api_task_set (lua_State* L) -{ - std::string name = luaL_checkstring (L, 1); - std::string value = luaL_checkstring (L, 2); - - try - { - context.dom.set (name, value); - } - catch (...) - { - // TODO Error! - lua_pushstring (L, ""); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -API::API () -: _state (NULL) -{ -} - -//////////////////////////////////////////////////////////////////////////////// -API::~API () -{ - if (_state) - { - lua_close (_state); - _state = NULL; - } -} - -//////////////////////////////////////////////////////////////////////////////// -void API::initialize () -{ - // Initialize Lua. - _state = luaL_newstate (); - luaL_openlibs (_state); // TODO Error handling - - // Register all the API functions in Lua global space. - lua_pushcfunction (_state, api_task_header_message); lua_setglobal (_state, "task_header_message"); - lua_pushcfunction (_state, api_task_footnote_message); lua_setglobal (_state, "task_footnote_message"); - lua_pushcfunction (_state, api_task_debug_message); lua_setglobal (_state, "task_debug_message"); - lua_pushcfunction (_state, api_task_exit); lua_setglobal (_state, "task_exit"); - lua_pushcfunction (_state, api_task_get); lua_setglobal (_state, "task_get"); - lua_pushcfunction (_state, api_task_set); lua_setglobal (_state, "task_set"); -} - -//////////////////////////////////////////////////////////////////////////////// -bool API::callProgramHook ( - const std::string& file, - const std::string& function) -{ - loadFile (file); - - // Get function. - lua_getglobal (_state, function.c_str ()); - if (!lua_isfunction (_state, -1)) - { - lua_pop (_state, 1); - throw format (STRING_API_NOFUNC, function); - } - - // Make call. - if (lua_pcall (_state, 0, 2, 0) != 0) - throw format (STRING_API_ERROR_CALLING, function, lua_tostring (_state, -1)); - - // Call successful - get return values. - if (!lua_isnumber (_state, -2)) - throw format (STRING_API_ERROR_FAIL, function); - - if (!lua_isstring (_state, -1) && !lua_isnil (_state, -1)) - throw format (STRING_API_ERROR_NORET, function); - - int rc = lua_tointeger (_state, -2); - const char* message = lua_tostring (_state, -1); - - if (rc == 0) - { - if (message) - context.footnote (format (STRING_API_WARNING, message)); - } - else - { - if (message) - throw std::string (message); - } - - lua_pop (_state, 1); - return rc == 0 ? true : false; -} - -//////////////////////////////////////////////////////////////////////////////// -bool API::callTaskHook ( - const std::string& file, - const std::string& function, - Task& task) -{ - loadFile (file); - - // Save the task for reference via the API. - _current = task; - - // Get function. - lua_getglobal (_state, function.c_str ()); - if (!lua_isfunction (_state, -1)) - { - lua_pop (_state, 1); - throw format (STRING_API_NOFUNC, function); - } - - // Prepare args. - lua_pushnumber (_state, _current.id); - - // Make call. - if (lua_pcall (_state, 1, 2, 0) != 0) - throw format (STRING_API_ERROR_CALLING, function, lua_tostring (_state, -1)); - - // Call successful - get return values. - if (!lua_isnumber (_state, -2)) - throw format (STRING_API_ERROR_FAIL, function); - - if (!lua_isstring (_state, -1) && !lua_isnil (_state, -1)) - throw format (STRING_API_ERROR_NORET, function); - - int rc = lua_tointeger (_state, -2); - const char* message = lua_tostring (_state, -1); - - if (rc == 0) - { - if (message) - context.footnote (format (STRING_API_WARNING, message)); - } - else - { - if (message) - throw std::string (message); - } - - lua_pop (_state, 1); - return rc == 0 ? true : false; -} - -//////////////////////////////////////////////////////////////////////////////// -void API::loadFile (const std::string& file) -{ - // If the file is not loaded. - if (std::find (_loaded.begin (), _loaded.end (), file) == _loaded.end ()) - { - // Load the file, if possible. - if (luaL_loadfile (_state, file.c_str ()) || lua_pcall (_state, 0, 0, 0)) - throw format (STRING_API_ERROR, lua_tostring (_state, -1)); - - // Mark this as _loaded, so as to not bother again. - _loaded.push_back (file); - } -} - -//////////////////////////////////////////////////////////////////////////////// - -#endif - diff --git a/src/API.h b/src/API.h deleted file mode 100644 index c19bc3868..000000000 --- a/src/API.h +++ /dev/null @@ -1,74 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// Taskwarrior Lua API -// -// Copyright 2006-2013, Paul Beckingham, Federico Hernandez. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -// -// http://www.opensource.org/licenses/mit-license.php -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_API -#define INCLUDED_API -#define L10N // Localization complete. - -#include -#ifdef HAVE_LIBLUA - -#include -#include -#include - -extern "C" -{ - #include - #include - #include -} - -class API -{ -public: - API (); - API (const API&); - API& operator= (const API&); - ~API (); - - void initialize (); - bool callProgramHook (const std::string&, const std::string&); - bool callTaskHook (const std::string&, const std::string&, Task&); - -private: - void loadFile (const std::string&); - -public: - lua_State* _state; - std::vector _loaded; - - // Context for the API. -// std::vector all; - Task _current; -// std::string& name; -// std::string& value; -}; - -#endif -#endif -//////////////////////////////////////////////////////////////////////////////// diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 979d77b04..05b138a89 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,6 @@ include_directories (${CMAKE_SOURCE_DIR} ${TASK_INCLUDE_DIRS}) set (task_SRCS A3.cpp A3.h - API.cpp API.h Arg.cpp Arg.h Color.cpp Color.h Config.cpp Config.h diff --git a/src/Context.cpp b/src/Context.cpp index 60c72122e..d410b4598 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -497,7 +497,7 @@ bool Context::verbose (const std::string& token) } //////////////////////////////////////////////////////////////////////////////// -// This needs to be taken out and shot, as soon as Lua extensions will allow. +// This needs to be taken out and shot, as soon as... void Context::shadow () { std::string file_name = config.get ("shadow.file"); diff --git a/src/DOM.cpp b/src/DOM.cpp index 819219fa2..24a638dd2 100644 --- a/src/DOM.cpp +++ b/src/DOM.cpp @@ -35,13 +35,6 @@ #include #include -#ifdef HAVE_LIBLUA -extern "C" -{ - #include -} -#endif - extern Context context; //////////////////////////////////////////////////////////////////////////////// @@ -64,7 +57,6 @@ const std::vector DOM::get_references () const refs.push_back ("context.width"); refs.push_back ("context.height"); refs.push_back ("system.version"); - refs.push_back ("system.lua.version"); refs.push_back ("system.os"); return refs; @@ -82,7 +74,6 @@ const std::vector DOM::get_references () const // TODO stats. <-- context.stats // // system.version -// system.lua.version // system.os const std::string DOM::get (const std::string& name) { @@ -117,12 +108,6 @@ const std::string DOM::get (const std::string& name) if (name == "system.version") return VERSION; -#ifdef HAVE_LIBLUA - // Lua version number. - else if (name == "system.lua.version") - return LUA_RELEASE; -#endif - // OS type. else if (name == "system.os") #if defined (DARWIN) @@ -245,8 +230,6 @@ const std::string DOM::get (const std::string& name, const Task& task) return this->get (name); } -// TODO Need a context-specific DOM::set. For Lua. Probably. - //////////////////////////////////////////////////////////////////////////////// void DOM::set (const std::string& name, const std::string& value) { diff --git a/src/Hooks.cpp b/src/Hooks.cpp index 4ad54b749..b44316a3a 100644 --- a/src/Hooks.cpp +++ b/src/Hooks.cpp @@ -103,10 +103,6 @@ Hooks::~Hooks () // that if it isn't called, a script will not be loaded. void Hooks::initialize () { -#ifdef HAVE_LIBLUA - _api.initialize (); -#endif - // Allow a master switch to turn the whole thing off. bool big_red_switch = context.config.getBoolean ("extensions"); if (big_red_switch) @@ -147,7 +143,7 @@ void Hooks::initialize () (void) n.skip (','); } else - throw std::string (format (STRING_LUA_BAD_HOOK_DEF, *it)); + ; // Was: throw std::string (format (STRING_LAU_BAD_HOOK_DEF, *it)); } } } @@ -160,54 +156,14 @@ void Hooks::initialize () // Program hooks. bool Hooks::trigger (const std::string& event) { -#ifdef HAVE_LIBLUA - std::vector ::iterator it; - for (it = _all.begin (); it != _all.end (); ++it) - { - if (it->_event == event) - { - Timer timer (std::string ("Hooks::trigger ") + event); - - if (validProgramEvent (event)) - { - context.debug (std::string ("Event ") + event + " triggered"); - if (! _api.callProgramHook (it->_file, it->_function)) - return false; - } - else - throw std::string (format (STRING_LUA_BAD_EVENT, event)); - } - } -#endif - - return true; + return false; } //////////////////////////////////////////////////////////////////////////////// // Task hooks. bool Hooks::trigger (const std::string& event, Task& task) { -#ifdef HAVE_LIBLUA - std::vector ::iterator it; - for (it = _all.begin (); it != _all.end (); ++it) - { - if (it->_event == event) - { - Timer timer (std::string ("Hooks::trigger ") + event); - - if (validTaskEvent (event)) - { - context.debug (std::string ("Event ") + event + " triggered"); - if (! _api.callTaskHook (it->_file, it->_function, task)) - return false; - } - else - throw std::string (format (STRING_LUA_BAD_EVENT, event)); - } - } -#endif - - return true; + return false; } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Hooks.h b/src/Hooks.h index 2c30a086d..5c892b1bd 100644 --- a/src/Hooks.h +++ b/src/Hooks.h @@ -31,7 +31,6 @@ #include #include -#include #include // Hook class representing a single hook, which is just a three-way map. @@ -68,9 +67,6 @@ private: bool validTaskEvent (const std::string&); private: -#ifdef HAVE_LIBLUA - API _api; -#endif std::vector _all; // All current hooks. std::vector _validProgramEvents; diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index 64d6ba36b..8cf274d1f 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -39,13 +39,6 @@ #include #include -#ifdef HAVE_LIBLUA -extern "C" -{ - #include -} -#endif - #include extern Context context; @@ -132,27 +125,6 @@ int CmdDiagnostics::execute (std::string& output) << " +vp" << sizeof (void*) << "\n\n"; - out << bold.colorize (STRING_CMD_DIAG_LIBRARIES) - << "\n"; - - out << " Lua: " -#ifdef HAVE_LIBLUA - << LUA_RELEASE -#else - << "n/a" -#endif - << "\n"; - - out << " libuuid: " -#if defined (HAVE_UUID) and defined (HAVE_UUID_UNPARSE_LOWER) - << "libuuid + uuid_unparse_lower" -#elif defined (HAVE_UUID) and !defined (HAVE_UUID_UNPARSE_LOWER) - << "libuuid, no uuid_unparse_lower" -#else - << "n/a" -#endif - << "\n\n"; - out << bold.colorize (STRING_CMD_DIAG_FEATURES) << "\n" @@ -183,6 +155,15 @@ int CmdDiagnostics::execute (std::string& output) << " +uuid" #else << " -uuid" +#endif + << "\n"; + out << " libuuid: " +#if defined (HAVE_UUID) and defined (HAVE_UUID_UNPARSE_LOWER) + << "libuuid + uuid_unparse_lower" +#elif defined (HAVE_UUID) and !defined (HAVE_UUID_UNPARSE_LOWER) + << "libuuid, no uuid_unparse_lower" +#else + << "n/a" #endif << "\n\n"; diff --git a/src/commands/CmdShow.cpp b/src/commands/CmdShow.cpp index c588719ce..8b0443b6a 100644 --- a/src/commands/CmdShow.cpp +++ b/src/commands/CmdShow.cpp @@ -351,46 +351,6 @@ int CmdShow::execute (std::string& output) // TODO Check for referenced but missing string files. // TODO Check for referenced but missing tips files. - // Check for referenced but missing hook scripts. -#ifdef HAVE_LIBLUA - std::vector missing_scripts; - for (i = all.begin (); i != all.end (); ++i) - { - if (i->substr (0, 5) == "hook.") - { - std::string value = context.config.get (*i); - Nibbler n (value); - - // : [, ...] - while (!n.depleted ()) - { - std::string file; - std::string function; - if (n.getUntil (':', file) && - n.skip (':') && - n.getUntil (',', function)) - { - Path script (file); - if (!script.exists () || !script.readable ()) - missing_scripts.push_back (file); - - (void) n.skip (','); - } - } - } - } - - if (missing_scripts.size ()) - { - out << STRING_CMD_SHOW_HOOKS << "\n"; - - for (i = missing_scripts.begin (); i != missing_scripts.end (); ++i) - out << " " << *i << "\n"; - - out << "\n"; - } -#endif - // Check for bad values in rc.calendar.details. std::string calendardetails = context.config.get ("calendar.details"); if (calendardetails != "full" && diff --git a/src/commands/CmdVersion.cpp b/src/commands/CmdVersion.cpp index 4b0f6a91c..2f36285d4 100644 --- a/src/commands/CmdVersion.cpp +++ b/src/commands/CmdVersion.cpp @@ -94,10 +94,6 @@ int CmdVersion::execute (std::string& output) << STRING_CMD_VERSION_UNKNOWN #endif -#ifdef HAVE_LIBLUA - << "-lua" -#endif - #if PACKAGE_LANGUAGE != LANGUAGE_EN_US << " " << STRING_LOCALIZATION_DESC @@ -105,12 +101,7 @@ int CmdVersion::execute (std::string& output) << "\n" << STRING_CMD_VERSION_COPY - << "\n" -#ifdef HAVE_LIBLUA - << STRING_CMD_VERSION_COPY2 - << "\n" -#endif - << "\n" + << "\n\n" << disclaimer.render () << "\n" << link.render () diff --git a/src/en-US.h b/src/en-US.h index 73bbae47c..3091de98c 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -118,15 +118,6 @@ #define STRING_A3_RANGE_INVERTED "Inverted range 'high-low' instead of 'low-high'" #define STRING_A3_UUID_AFTER_COMMA "Unrecognized UUID after comma." -// API -#define STRING_API_EXITING "Exiting." -#define STRING_API_NOFUNC "The Lua function '{1}' was not found." -#define STRING_API_ERROR_CALLING "Error calling '{1}' - {2}." -#define STRING_API_ERROR_FAIL "Error: '{1}' did not return a success indicator." -#define STRING_API_ERROR_NORET "Error: '{1}' did not return a message or nil." -#define STRING_API_WARNING "Warning: {1}" -#define STRING_API_ERROR "Error: {1}" - // Color #define STRING_COLOR_UNRECOGNIZED "The color '{1}' is not recognized." @@ -210,7 +201,6 @@ #define STRING_CMD_VERSION_BUILT "{1} {2} built for " #define STRING_CMD_VERSION_UNKNOWN "unknown" #define STRING_CMD_VERSION_COPY "Copyright (C) 2006 - 2013 P. Beckingham, F. Hernandez." -#define STRING_CMD_VERSION_COPY2 "Portions of this software Copyright (C) 1994 – 2008 Lua.org, PUC-Rio." #define STRING_CMD_LOGO_USAGE "Displays the Taskwarrior logo" #define STRING_CMD_LOGO_COLOR_REQ "The logo command requires that color support is enabled." #define STRING_CMD_EXEC_USAGE "Executes external commands and scripts" @@ -752,10 +742,6 @@ // Legacy #define STRING_LEGACY_FEATURE "Note: the '{1}' feature is deprecated." -// Lua -#define STRING_LUA_BAD_HOOK_DEF "Malformed hook definition '{1}'." -#define STRING_LUA_BAD_EVENT "Unrecognized hook event '{1}'." - // Record #define STRING_RECORD_EMPTY "Empty record in input." #define STRING_RECORD_JUNK_AT_EOL "Unrecognized characters at end of line." diff --git a/src/es-ES.h b/src/es-ES.h index da40745cb..458dc68f9 100644 --- a/src/es-ES.h +++ b/src/es-ES.h @@ -118,15 +118,6 @@ #define STRING_A3_RANGE_INVERTED "Rango invertido 'alto-bajo' en vez de 'bajo-alto'" #define STRING_A3_UUID_AFTER_COMMA "UUID no reconocido tras coma." -// API -#define STRING_API_EXITING "Saliendo." -#define STRING_API_NOFUNC "No se encontró la función Lua '{1}'." -#define STRING_API_ERROR_CALLING "Error al llamar '{1}' - {2}." -#define STRING_API_ERROR_FAIL "Error: '{1}' no devolvió un indicador de éxito." -#define STRING_API_ERROR_NORET "Error: '{1}' no devolvió un mensaje o nulo." -#define STRING_API_WARNING "Advertencia: {1}" -#define STRING_API_ERROR "Error: {1}" - // Color #define STRING_COLOR_UNRECOGNIZED "El color '{1}' no se reconoce." @@ -214,7 +205,6 @@ #define STRING_CMD_VERSION_BUILT "{1} {2} construido para " #define STRING_CMD_VERSION_UNKNOWN "desconocido" #define STRING_CMD_VERSION_COPY "Copyright (C) 2006 - 2013 P. Beckingham, F. Hernandez." -#define STRING_CMD_VERSION_COPY2 "Partes de este software Copyright (C) 1994 – 2008 Lua.org, PUC-Rio." #define STRING_CMD_LOGO_USAGE "Muestra el logo de Taskwarrior" #define STRING_CMD_LOGO_COLOR_REQ "El comando logo requiere que el soporte de color esté habilitado." #define STRING_CMD_EXEC_USAGE "Ejecuta comandos y scripts externos" @@ -766,10 +756,6 @@ // Legacy #define STRING_LEGACY_FEATURE "Note: la función '{1}' está en desuso." -// Lua -#define STRING_LUA_BAD_HOOK_DEF "Definición de hook incorrecta '{1}'." -#define STRING_LUA_BAD_EVENT "Evento hook no reconocido '{1}'." - // Record #define STRING_RECORD_EMPTY "Registro vacío en la entrada." #define STRING_RECORD_JUNK_AT_EOL "Caracteres no reconocidos al final de línea." diff --git a/test/dom.t.cpp b/test/dom.t.cpp index 7aa6fc8db..9f55b3a87 100644 --- a/test/dom.t.cpp +++ b/test/dom.t.cpp @@ -31,23 +31,12 @@ #include #include -#ifdef HAVE_LIBLUA -extern "C" -{ - #include -} -#endif - Context context; //////////////////////////////////////////////////////////////////////////////// int main (int argc, char** argv) { -#if defined(HAVE_LIBLUA) - UnitTest t (7); -#else UnitTest t (6); -#endif try { @@ -57,9 +46,6 @@ int main (int argc, char** argv) // TODO dom.get rc.name DOM dom; t.is (dom.get ("system.version"), VERSION, "DOM system.version -> VERSION"); -#ifdef HAVE_LIBLUA - t.is (dom.get ("system.lua.version"), LUA_RELEASE, "DOM system.lua.version -> LUA_RELEASE"); -#endif t.ok (dom.get ("system.os") != "", "DOM system.os -> != Unknown"); t.is (dom.get ("context.program"), "task", "DOM context.program -> 'task'"); t.is (dom.get ("context.args"), "task", "DOM context.args -> 'task'"); diff --git a/test/hook.on-exit.t b/test/hook.on-exit.t deleted file mode 100755 index 41aaa9e4e..000000000 --- a/test/hook.on-exit.t +++ /dev/null @@ -1,74 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006-2013, Paul Beckingham, Federico Hernandez. -## -## Permission is hereby granted, free of charge, to any person obtaining a copy -## of this software and associated documentation files (the "Software"), to deal -## in the Software without restriction, including without limitation the rights -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -## copies of the Software, and to permit persons to whom the Software is -## furnished to do so, subject to the following conditions: -## -## The above copyright notice and this permission notice shall be included -## in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -## SOFTWARE. -## -## http://www.opensource.org/licenses/mit-license.php -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 4; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "extensions=on\n", - "hook.on-exit=" . $ENV{'PWD'} . "/hook:test\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -if (open my $fh, '>', 'hook') -{ - print $fh "function test () print ('marker') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -# Test the hook. -my $output = qx{../src/task rc:hook.rc version 2>&1}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version 2>&1}; - like ($output, qr/(\w{7}|[\d.]+)\nmarker/ms, 'Found marker after output'); -} -else -{ - pass ('Found marker after output - skipping: no Lua support'); -} - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data synch.key hook hook.rc); -ok (! -r 'pending.data' && - ! -r 'completed.data' && - ! -r 'undo.data' && - ! -r 'backlog.data' && - ! -r 'synch.key' && - ! -r 'hook' && - ! -r 'hook.rc', 'Cleanup'); - -exit 0; - diff --git a/test/hook.on-launch.t b/test/hook.on-launch.t deleted file mode 100755 index 9ff942f38..000000000 --- a/test/hook.on-launch.t +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/env perl -################################################################################ -## taskwarrior - a command line task list manager. -## -## Copyright 2006-2013, Paul Beckingham, Federico Hernandez. -## -## Permission is hereby granted, free of charge, to any person obtaining a copy -## of this software and associated documentation files (the "Software"), to deal -## in the Software without restriction, including without limitation the rights -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -## copies of the Software, and to permit persons to whom the Software is -## furnished to do so, subject to the following conditions: -## -## The above copyright notice and this permission notice shall be included -## in all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -## SOFTWARE. -## -## http://www.opensource.org/licenses/mit-license.php -## -################################################################################ - -use strict; -use warnings; -use Test::More tests => 4; - -# Create the rc file. -if (open my $fh, '>', 'hook.rc') -{ - print $fh "data.location=.\n", - "extensions=on\n", - "hook.on-launch=" . $ENV{'PWD'} . "/hook:test\n"; - close $fh; - ok (-r 'hook.rc', 'Created hook.rc'); -} - -if (open my $fh, '>', 'hook') -{ - print $fh "function test () print ('marker') return 0, nil end\n"; - close $fh; - ok (-r 'hook', 'Created hook'); -} - -my $output = qx{../src/task rc:hook.rc version 2>&1}; -if ($output =~ /PUC-Rio/) -{ - # Test the hook. - $output = qx{../src/task rc:hook.rc _version 2>&1}; - like ($output, qr/^marker.+\b(\w{7}|[\d.]+)\b/ms, 'Found marker before output'); -} -else -{ - pass ('Found marker before output - skip: no Lua support'); -} - -# Cleanup. -unlink qw(pending.data completed.data undo.data backlog.data synch.key hook hook.rc); -ok (! -r 'pending.data' && - ! -r 'completed.data' && - ! -r 'undo.data' && - ! -r 'backlog.data' && - ! -r 'synch.key' && - ! -r 'hook' && - ! -r 'hook.rc', 'Cleanup'); - -exit 0; -