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