xref: /plugin/combo/contrib.md (revision d8add9b6d6dddc5a1630f969f72a7f91a2da8f6d)
1f47bee6bSNicolas GERARD# Contrib
2f47bee6bSNicolas GERARD
3f47bee6bSNicolas GERARD## Main
4f47bee6bSNicolas GERARD
5f47bee6bSNicolas GERARDThe main entrypoint is the [docustom.php action script](action/docustom.php). ie
6f47bee6bSNicolas GERARD(ie a `do` custom action) that takes over action such as `show` (default).
7f47bee6bSNicolas GERARD
8f01167beSNicolas GERARD## Laptop Dev Installation Steps
9f01167beSNicolas GERARD
10*d8add9b6SNicolas GERARD* Install php7.4 on debian with
11*d8add9b6SNicolas GERARD  the [sury repo](https://github.com/oerdnj/deb.sury.org/wiki/Frequently-Asked-Questions#how-to-enable-the-debsuryorg-repository)
12b9ba2b0cSNicolas GERARD* https://packages.sury.org/php/pool/main/p/php7.4/
13*d8add9b6SNicolas GERARD
14b9ba2b0cSNicolas GERARD```bash
15b9ba2b0cSNicolas GERARDcurl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
16b9ba2b0cSNicolas GERARDsudo apt update
17b9ba2b0cSNicolas GERARDsudo apt install -y php7.4 \
18b9ba2b0cSNicolas GERARD  php7.4-mbstring \
19b9ba2b0cSNicolas GERARD  php7.4-xml \
20b9ba2b0cSNicolas GERARD  php7.4-gd \
21b9ba2b0cSNicolas GERARD  php7.4-intl \
22*d8add9b6SNicolas GERARD  php7.4-curl \
23*d8add9b6SNicolas GERARD  php7.4-xdebug
24b9ba2b0cSNicolas GERARD# openssl not found
25*d8add9b6SNicolas GERARD# curl is needed for snapshot
26*d8add9b6SNicolas GERARD# pdo-sqlite seems to be installed with php7.4
27*d8add9b6SNicolas GERARDwhich php7.4 # /usr/bin/php7.4
28b9ba2b0cSNicolas GERARD# ini
29b9ba2b0cSNicolas GERARDcat /etc/php/7.4/cli/php.ini
30b9ba2b0cSNicolas GERARDcat /etc/php/7.4/mods-available/xdebug.ini
31b9ba2b0cSNicolas GERARD```
32f01167beSNicolas GERARD
33f01167beSNicolas GERARD* Clone Dokuwiki to get:
34f01167beSNicolas GERARD    * the base DokuWikiTest class
35f01167beSNicolas GERARD    * and `_test\phpunit.xml`
36*d8add9b6SNicolas GERARD
37f01167beSNicolas GERARD```bash
38f01167beSNicolas GERARDgit clone https://github.com/dokuwiki/dokuwiki combo
39f01167beSNicolas GERARDcd combo
40f01167beSNicolas GERARD```
41*d8add9b6SNicolas GERARD
42f01167beSNicolas GERARD* Clone Combo
43*d8add9b6SNicolas GERARD
44f01167beSNicolas GERARD```bash
45*d8add9b6SNicolas GERARDcd dokuwiki_home/lib/plugins/
46f01167beSNicolas GERARDgit clone git@github.com:ComboStrap/combo
47f01167beSNicolas GERARD```
48*d8add9b6SNicolas GERARD
49*d8add9b6SNicolas GERARD* Clone the dependent plugins found in [requirements](requirements.txt)
50*d8add9b6SNicolas GERARD
51*d8add9b6SNicolas GERARD```bash
52*d8add9b6SNicolas GERARDcd dokuwiki_home/lib/plugins/
53*d8add9b6SNicolas GERARDgit clone https://github.com/cosmocode/sqlite sqlite
54*d8add9b6SNicolas GERARDgit clone https://github.com/michitux/dokuwiki-plugin-move/ move
55*d8add9b6SNicolas GERARDgit clone https://github.com/dokufreaks/plugin-include include
56*d8add9b6SNicolas GERARDgit clone https://github.com/tatewake/dokuwiki-plugin-googleanalytics googleanalytics
57*d8add9b6SNicolas GERARDgit clone https://github.com/alexlehm/dokuwiki-plugin-gtm googletagmanager
58*d8add9b6SNicolas GERARD```
59*d8add9b6SNicolas GERARD
60f01167beSNicolas GERARD* Clone the tests
61f01167beSNicolas GERARD```bash
62*d8add9b6SNicolas GERARDcd dokuwiki_home/lib/plugins/combo
63f01167beSNicolas GERARDgit clone git@github.com:ComboStrap/combo_test.git _test
64f01167beSNicolas GERARD```
65*d8add9b6SNicolas GERARD
66*d8add9b6SNicolas GERARD* Install Node dependency
67f01167beSNicolas GERARD```bash
68*d8add9b6SNicolas GERARDcd dokuwiki_home/lib/plugins/combo
69*d8add9b6SNicolas GERARDnpm install
70*d8add9b6SNicolas GERARD```
71*d8add9b6SNicolas GERARD
72*d8add9b6SNicolas GERARD* Install phpunit
73*d8add9b6SNicolas GERARD
74*d8add9b6SNicolas GERARD```bash
75*d8add9b6SNicolas GERARDcd dokuwiki_home/_test
76f01167beSNicolas GERARDcomposer install
77f01167beSNicolas GERARD```
78f01167beSNicolas GERARD
79*d8add9b6SNicolas GERARD
80*d8add9b6SNicolas GERARD
81f01167beSNicolas GERARD### Intellij Php WSL
82f01167beSNicolas GERARD
83*d8add9b6SNicolas GERARD* Git
84*d8add9b6SNicolas GERARD    * add lib/plugins/combo as a registered root (Intellij> Version Control > Directory Mapping)
85*d8add9b6SNicolas GERARD    * Check that Set it as a source root
86f01167beSNicolas GERARD
87f01167beSNicolas GERARDFollowing [](https://www.jetbrains.com/help/phpstorm/how-to-use-wsl-development-environment-in-product.html#open-a-project-in-wsl)
88f01167beSNicolas GERARD
89f01167beSNicolas GERARD* Install the plugin PHP WSL Support
90f01167beSNicolas GERARD* Add Php Cli Interpreter on WSL. Intellij > Settings > Php > Cli Interpreter
91f01167beSNicolas GERARD* Firewall from an elevated PowerShell
92*d8add9b6SNicolas GERARD
93f01167beSNicolas GERARD```powershell
94f01167beSNicolas GERARDNew-NetFirewallRule -DisplayName "WSL" -Direction Inbound  -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))"  -Action Allow
95f01167beSNicolas GERARDGet-NetFirewallProfile -Name Public | Get-NetFirewallRule | where DisplayName -ILike "IntelliJ IDEA*" | Disable-NetFirewallRule
96f01167beSNicolas GERARD```
97*d8add9b6SNicolas GERARD
98f01167beSNicolas GERARD* Intellij > Settings > Php > Test Framework
99*d8add9b6SNicolas GERARD
100f01167beSNicolas GERARD```yaml
101b9ba2b0cSNicolas GERARDUse_autoloader: combo\_test\vendor\autoload.php
102f01167beSNicolas GERARDUse_default_configuration_file: combo/_test/phpunit.xml
103f01167beSNicolas GERARDUse_default_bootstrap_file: combo/lib/plugins/combo/_test/bootstrap.php
104f01167beSNicolas GERARD```
105*d8add9b6SNicolas GERARD
106f01167beSNicolas GERARD* Intellij Test Runner Configuration
107*d8add9b6SNicolas GERARD
108f01167beSNicolas GERARD```yaml
109f01167beSNicolas GERARDUse_alternative_configuration_file: combo/_test/phpunit.xml
110f01167beSNicolas GERARDUse_alternative_bootstrap_file: combo/lib/plugins/combo/_test/bootstrap.php
111b9ba2b0cSNicolas GERARDInterpreter_cli: use wsl
112b9ba2b0cSNicolas GERARDInterpreter_options: |
113b9ba2b0cSNicolas GERARD    # put this ip if you are not in mirrored mode and intellij keep using 127.0.0.1
114b9ba2b0cSNicolas GERARD    -dxdebug.client_host=$(echo $(ip route list default | awk '{print $3}'))
115f01167beSNicolas GERARD```
116