Skip to content

Commit

Permalink
Ajout d'un script d'installation pour Windows (#5390)
Browse files Browse the repository at this point in the history
* Script pour installer Windows

* pm2 n'est plus installé en global

* add `gitdb==0.6.4`
  • Loading branch information
A-312 authored Feb 23, 2020
1 parent 180cd29 commit a4bec36
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ clean-front: ## Clean the frontend builds
ZMD_URL="http://localhost:27272"

zmd-install: ## Install the Node.js packages for zmarkdown
cd zmd && npm -g install pm2 && npm install --production
cd zmd && npm install --production

zmd-start: ## Start the zmarkdown server
cd zmd/node_modules/zmarkdown && npm run server
Expand All @@ -75,7 +75,7 @@ zmd-check: ## Check if the zmarkdown server is running
@curl -s $(ZMD_URL) || echo 'Use `make zmd-start` to start zmarkdown server'

zmd-stop: ## Stop the zmarkdown server
pm2 kill
node ./zmd/node_modules/pm2/bin/pm2 kill

##
## ~ Elastic Search
Expand Down
34 changes: 34 additions & 0 deletions doc/source/install/install-windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,40 @@ Cas numéro 1 : windows 10 et sous-système linux
Cas numéro 2 : fonctionnement sur windows lui-même
==================================================

Installation automatique
---------------------

Commencez par télécharger et installer Python <https://www.python.org/>`.

Ensuite, ouvrez la console de Windows et faites :

.. sourcecode:: batch

cd /ton/path/zds-site/
powershell .\scripts\win\install_zds.ps1 +full


Une fois l'installation fini, utilisez la **console PowerShell** et chargez l'environnement virtuel de votre espace de développement avec :

.. sourcecode:: powershell

. .\zdsenv\Scripts\activate.ps1

Vous devriez obtenir :

.. sourcecode:: bat

(zdsenv)PS C:\dev\zestedesavoir\

Vous pouvez finalement lancer ZdS:

- Démarrer ZMD : `pm2 start --name=zmarkdown -f zmd/node_modules/zmarkdown/server/index.js -i 1`
- Démarrer Django : `python manage.py runserver`


Installation manuelle
---------------------

- Téléchargez `zlib <http://gnuwin32.sourceforge.net/downlinks/zlib.php>`_ (prérequis pour la bibliothèque ``Pillow``)
- Téléchargez et installez les outils suivants :
- `PowerShell 3.0+ <http://www.microsoft.com/fr-fr/download/details.aspx?id=40855>`_. Uniquement pour les PC tournant sous Windows 7 ou antérieur (installé par défaut avec Windows depuis).
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ toml==0.10.0
requests==2.22.0
homoglyphs==1.3.5

# Unknown but missing during installation
gitdb==0.6.4

# Api dependencies
djangorestframework==3.11.0
djangorestframework-xml==1.4.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/define_function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function zds_start_zmd {


function zds_stop_zmd {
pm2 kill; exVal=$?
node ./zmd/node_modules/pm2/bin/pm2 kill; exVal=$?

if [[ $exVal != 0 ]]; then
print_error "Warning: Cannot stop zmd"
Expand Down
2 changes: 1 addition & 1 deletion scripts/travis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fi
# print zmarkdown log
if [[ "$1" == "print_zmarkdown_log" ]] && [[ "$ZDS_TEST_JOB" == *"zds."* ]]; then
zds_fold_start "zmarkdown_log" "* Print zmarkdown log"
pm2 logs --nostream --raw --lines 1000
node ./zmd/node_modules/pm2/bin/pm2 logs --nostream --raw --lines 1000
zds_fold_end
fi

Expand Down
34 changes: 34 additions & 0 deletions scripts/win/define_function.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function red {
process { Write-Host $_ -ForegroundColor red }
}

function cyan {
process { Write-Host $_ -ForegroundColor cyan }
}

function green {
process { Write-Host $_ -ForegroundColor green }
}

function Error {
param($Message = "Error!", $ErrorCode = 1)
Write-Output $Message | red
$host.SetShouldExit($ErrorCode)
Exit
}

function ErrorInSourcedFile {
param($Message = "Error!", $ErrorCode = 1)
Write-Output $Message | red
[Environment]::Exit($ErrorCode)
}

function PrintInfo {
param($Message = "Info?")
Write-Output $Message | cyan
}

function End_OK {
$host.SetShouldExit(0)
Exit
}
Loading

0 comments on commit a4bec36

Please sign in to comment.