Koha/debian/scripts
Tomas Cohen Arazi 80de9fa97c Bug 18964: Add --debugger option to koha-plack
CAVEAT: This patch is only about allowing koha-plack to start a debugging
session on a remote target. Configuring all the needed pieces to make it
work is out of the scope of the bug. Testing should be focused (mainly) on
making sure this introduces NO REGRESSIONS on regular use (i.e. not debugging).

This patch adds the following option switches to koha-plack:

--debugger
----------
Toggle debugging

--debugger-key
--------------
Some IDEs require a key, this needs to match because they are picky about it

--debugger-location
-------------------
This option switch is used to specify the host:port your IDE is listening at.
Inside kohadevbox (using Vdebug with Vim) this would be localhost:9000. Outside
kohadevbox it would be 192.168.50.1:9000

--debugger-path
---------------
This is the path in which you installed the Komodo Remote Debugger library [1]. In kohadevbox
you could put the contents of the downloaded .tar.gz in /home/vagrant/dbgp/perllib. That
perllib seems to be required for things to work [2].

You can test with a simple CLI script things work:

PERL5LIB=/home/vagrant/dbgp/perllib:$PERL5LIB \
PERLDB="BEGIN { require q(/home/vagrant/dbgp/perllib/perl5db.pl) }" \
PERLDB_OPTS="RemotePort=192.168.50.1:9000" perl -d t/Prices.t

If you see action on your IDE, you are on the right track on the IDE side.

To test:
- Apply this patch
- Enable remote debugging on your IDE, on port 9000 (or adjust the command
  below to match your IDE's listening port).
- Download the Komodo Remote Debugger package, and place the package's contents
  in /home/vagrant/dbgp/perllib (you should see perl5db.pl in there).
- Run:
  $ sudo koha-plack --stop kohadev
  $ sudo kohaclone/debian/koha-plack --start \
                                     --debugger \
                                     --debugger-path /home/vagrant/dbgp/perllib \
                                     --debugger-location 192.168.50.1:9000 \
                                     kohadev
=> SUCCESS: You IDE/tool gets a connection from the Plack process.
- Sign off :-D

The explanation on how to use it assumes you are running kohadevbox.

WARNING: The main difficulty I found was setting the right dir/file mappings.

[1] http://code.activestate.com/komodo/remotedebugging/
[2] https://github.com/Komodo/KomodoEdit/issues/644#issuecomment-236268012

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-01-23 16:05:54 -03:00
..
koha-create Bug 17951: Make koha-create set template_cache_dir correctly 2017-12-22 13:15:39 -03:00
koha-create-dirs Bug 17951: Make koha-create set template_cache_dir correctly 2017-12-22 13:15:39 -03:00
koha-disable
koha-dump
koha-dump-defaults Bug 17265 - Make koha-create-defaults less greedy 2017-01-13 11:33:11 +00:00
koha-elasticsearch Bug 19462: Add a koha-elasticsearch command 2017-10-27 14:10:31 -03:00
koha-email-disable
koha-email-enable
koha-enable
koha-enable-sip
koha-foreach Bug 18709: Make koha-foreach use koha-shell internally 2017-10-11 12:40:32 -03:00
koha-functions.sh Bug 16749: Check instancename in adjust_paths_dev_install 2017-02-17 13:20:58 +00:00
koha-indexer Bug 18554: Adjust a few typos including responsability 2017-05-09 21:03:22 +00:00
koha-list Bug 15303 Letsencrypt option for Debian package installations 2016-04-29 13:04:31 +00:00
koha-mysql
koha-mysqlcheck
koha-passwd
koha-plack Bug 18964: Add --debugger option to koha-plack 2018-01-23 16:05:54 -03:00
koha-rebuild-zebra Bug 18069: Remove residue of rebuild_zebra -x 2017-03-22 21:14:31 +00:00
koha-remove Bug 17951: Make koha-create set template_cache_dir correctly 2017-12-22 13:15:39 -03:00
koha-reset-passwd
koha-restart-zebra
koha-restore
koha-run-backups
koha-shell Bug 18502: Make koha-shell set the right PERL5LIB on dev installs 2017-05-05 12:12:04 -03:00
koha-sitemap Bug 16733: Adjust other debian scripts using PERL5LIB 2017-01-20 14:15:27 +00:00
koha-start-sip Bug 16733: Adjust other debian scripts using PERL5LIB 2017-01-20 14:15:27 +00:00
koha-start-zebra
koha-stop-sip Bug 16733: Adjust other debian scripts using PERL5LIB 2017-01-20 14:15:27 +00:00
koha-stop-zebra Bug 16885: koha-stop-zebra should be more sure of stopping zebrasrv 2016-08-17 17:57:15 +00:00
koha-translate Bug 16749: Use is_instance to make sure the dev instance exist 2017-02-17 13:20:58 +00:00
koha-upgrade-schema Bug 16749: Add is_instance check to koha-upgrade-schema 2017-02-17 13:20:58 +00:00
koha-upgrade-to-3.4
koha-zebra Bug 17467: Add missing --status switch handling 2018-01-19 15:11:14 -03:00