Commit graph

136 commits

Author SHA1 Message Date
Paul Beckingham
820cc4b2e5 DOM: Demoted from class to functions
- The DOM object contains no members, and only two (effectively) const methods.
  Demoting DOM to function calls reduces coupling with Context.
2016-02-03 21:54:37 -05:00
Paul Beckingham
cdd1c4681d Hooks: C++11 2016-02-03 21:06:49 -05:00
Paul Beckingham
60667dbcaa TW-1705: Directories in .task/hooks should not be reported as invalid hooks
- Thanks to Tomas Babej.
2016-01-11 22:30:35 -05:00
Paul Beckingham
08d5db0b49 Hooks: Removed obsolete methods 2016-01-09 22:38:18 -05:00
Paul Beckingham
641d232dea Copyright: Updated to 2016 2015-12-31 15:06:43 -05:00
Paul Beckingham
5c8b7148b4 Task: Moved include to top of list, per flint++ recommendation 2015-11-01 19:59:10 -05:00
Paul Beckingham
31fb7726c0 Hooks: Converted from CLI to CLI2 2015-06-14 22:29:23 -04:00
Wilhelm Schuermann
2ad3713e8c JSON: Fix memory leak in parser
- Fix JSON root object leaking out by using delete.
  This is by no means a comprehensive fix since exceptions are involved
  in a lot of places, but it does fix the memory leak in all cases
  checked in Taskwarrior's test suite.
- Going with a shared_ptr or unique_ptr here might be a better
  solution, but would involve more code changes.
2015-06-03 23:12:34 +02:00
Paul Beckingham
e74c6963a9 C++11: Cleaned up program framework with range-based for 2015-05-11 17:50:53 -04:00
Paul Beckingham
0a54d46589 Hooks: With rc.debug.hooks=2, shows hook arguments 2015-04-05 12:19:55 -04:00
Wilhelm Schuermann
5487414003 Hooks: Add "version:" to hooks v2 arguments
- Saves a call to "task --version", potentially saving precious hook
  execution time.  Useful for writing backwards compatible hooks in
  case of buggy Taskwarrior behavior.
2015-04-02 09:18:34 +02:00
Wilhelm Schuermann
04d0c52a43 Hooks: Implement "Hooks v2" API
- All hook scripts now receive key:value pair command line arguments.
- Add only the basics: api, args, command, rc, data.  Possibly more to
  come.
2015-04-01 11:44:37 +02:00
Wilhelm Schuermann
7a64c19641 Resolve most compiler warnings 2015-03-29 22:05:38 +02:00
Paul Beckingham
5e8426f0cc Config
- The 'next' report was not sㄡrted by urgency, which is wrong (thanks
  to Adam Coddington).
2015-03-05 18:26:43 -05:00
Wilhelm Schuermann
138360b7bc Hooks
- Fixed on-modify hook regression which stopped hooks from modifying
  tasks.  On a related note, more hooks tests are definitely needed.
2015-03-05 07:21:30 -05:00
Wilhelm Schuermann
e2f35a1a06 Hooks
- onAdd, onExit, onLaunch and onModify hooks now output feedback messages
  as footnotes when hooks exit with status 0, as per hooks documentation.
2015-02-24 16:45:23 -05:00
Paul Beckingham
0a62061ca8 L10N
- Localized the new strings in Hooks.cpp.
2015-02-15 02:03:24 -05:00
Paul Beckingham
5a060802e7 Hooks
- It is now an error for a failing hook script to fail to also generate some
  feedback.
- Updated NEWS file to mention stricter hook script controls.
2015-02-14 18:16:32 -05:00
Paul Beckingham
adac566665 Unit Tests
- Corrected expected output from the on-modify-misbehave4 test hook script.
- Moved JSON syntax error details to debug output.
2015-02-14 17:50:28 -05:00
Paul Beckingham
a2e980c6b8 Hooks
- Deferred JSON checking until after we know whether the hooks voluntarily
  failed the event.
2015-02-14 17:33:48 -05:00
Paul Beckingham
e00704a375 Hooks
- Cleaned up logic for crude JSON detection.
2015-02-14 17:31:37 -05:00
Paul Beckingham
8fb3161a02 Hooks
- Modified expected output from an on-modify hooks script, because it's 1 line
  of JSON, not 2.
2015-02-14 17:19:44 -05:00
Paul Beckingham
c5a2b7f759 Unit Tests
- Fixed exected error for on-add-misbehave5. This highlights a potential
  error in the test suite with the one failing test.
2015-02-14 17:03:43 -05:00
Paul Beckingham
bd785ffad5 Hooks
- Added a new on-launch-misbehave2 script that emits unexpected JSON.
2015-02-14 16:14:20 -05:00
Paul Beckingham
3cce6c23f5 Hooks
- Hooks now verify the expected number of JSON lines emitted by hook scripts.
2015-02-14 15:50:51 -05:00
Paul Beckingham
1cfdfbae52 Hooks
- Removed the ability for hooks to add tasks, or modify tasks that are outside
  the context of the current event. This makes hooks a local mechanism that
  operates only on local changes. Modifications/additions coming in via sync
  command are not processed by hooks.
2015-01-31 17:47:58 -05:00
Paul Beckingham
4865269630 Hooks
- Modified loop so it no longer walks the whole list unnecessarily.
- Minor style tweaks.
2015-01-25 10:33:03 -05:00
Tomas Babej
8683574b18 Hooks: Make sure that original task is properly detected
On modify event uses UUID of the original task being modified
to determine which line should be interpreted as modification
of the task.

This was achieved by searching by a substring in a specific JSON
format, which, consenquently, failed on JSON strings of other (valid)
formats.
2015-01-25 10:28:04 -05:00
Tomas Babej
654159b2fd Hooks: Add per-hook time measurement 2015-01-19 16:07:34 -05:00
Tomas Babej
6fdf0738a7 Hooks: Improve debugging messages for on-exit hooks 2015-01-18 13:27:32 -05:00
Paul Beckingham
411fab3a27 Hooks
- Added debug output on startup, if a hook script is found and does not have
  a valid name.
2015-01-07 22:54:55 -05:00
Paul Beckingham
b7ad091d00 Updated copyright to 2015 2015-01-01 00:00:41 -05:00
Paul Beckingham
d9222606e7 Hooks
- The on-exit hook can now terminate processing.
2014-10-19 01:47:33 -04:00
Paul Beckingham
7895ea0f42 Hooks
- Added safety measure in case of a hook misfire.
- Made debug output consistent.
2014-10-19 01:32:41 -04:00
Paul Beckingham
7e2582f2b8 Hooks
- Fixed bug where the identifier "on-modify" contained some bogus UTF8.
- Ensured that every input line has a \n.
2014-10-19 00:57:30 -04:00
Paul Beckingham
719e9d242b Hooks
- Bug due to missing reference & in calls to callHookScript.  Dumbass.
2014-10-18 23:59:40 -04:00
Paul Beckingham
f1639e6862 Hooks
- Revised all event functions to use the new callHookScript method, which is
  now common to all events.
2014-10-18 23:47:32 -04:00
Paul Beckingham
d1f6b36ecf Hooks
- Standardized formatting of hook input and output in debug.hooks mode.
2014-10-18 17:26:20 -04:00
Paul Beckingham
8d75d0c7f3 Hooks
- Reduced validation to simply checking that a description attribute is present.
  This is the bare minimum for the Task(const std::string&) contructor.
2014-10-18 17:23:39 -04:00
Paul Beckingham
21bbedbfc5 Hooks
- Now performs a full JSON parse on hook script output before accepting it as a
  task.
2014-10-18 16:59:46 -04:00
Paul Beckingham
b6be1cdc99 Hooks
- Factored out the code that determines if the JSON output from a hook script is
  actually JSON.
2014-10-18 16:55:26 -04:00
Wilhelm Schuermann
ae9705561c Hooks
- Throw exception instead of segfaulting for on-add hooks not adhering to the specs. More work needed.
2014-10-14 15:58:24 -04:00
Paul Beckingham
7521dc56e8 Hooks
- Supports 'debug.hooks' configuration setting.
2014-10-06 23:04:44 -04:00
Paul Beckingham
5b7e6df00b Util
- The execute() function needed to fill the STDIN pipe before the fork, not
  after the fork, so the data is ready before the child process reads.
2014-09-14 17:43:19 -04:00
Paul Beckingham
bfc6e38851 Hooks
- ::onExit now provides a set of all changeѕ tasks to the hook script, in
  read-only form.
2014-09-14 17:04:12 -04:00
Paul Beckingham
8be6c589da Hooks
- Implemented new interface.  Testing time.
2014-09-14 15:55:22 -04:00
Paul Beckingham
ab72cdad4d Hooks
- Stubbed new ::onAdd and ::onModify interfaces.
2014-09-14 15:42:47 -04:00
Paul Beckingham
7e35508bb4 Hooks
- Added a run-time enable/disable control, for nested add/modify calls.
2014-09-09 23:36:45 -04:00
Paul Beckingham
78650ac8c3 Hooks
- Added a master control, rc.hooks, which defaults to 'on', but can be used
  to disable hook processing in general.
2014-09-08 01:22:35 -04:00
Paul Beckingham
6dff1f36bf Hooks
- Added notes regarding the use of 'first', which may be problematic.
2014-09-08 00:01:54 -04:00