You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.7 KiB

4 years ago
4 years ago
4 years ago
  1. ROPTS=-zav --no-p --chmod=u=rw,g=rw,o=r --delete --exclude=www/.htaccess --exclude=.svn --exclude=.git --exclude=*.mtt --exclude=tpl/css --exclude=www/file --exclude=*node_modules* --exclude=*.php --exclude=tests.n
  2. LANG=fr
  3. PLUGINS?=0
  4. ENV?="dev"
  5. #To compile project with plugins, add PLUGINS=1 or type `export PLUGINS=1`
  6. install:
  7. #copy config file from template
  8. cp config.xml.dist config.xml
  9. @if [ $(ENV) = "dev" ]; then \
  10. make install_dev; \
  11. fi
  12. #setup dev environnement from source
  13. install_dev:
  14. #set config file to debug=1
  15. #@sed -e 's?debug=.*?debug="1"?g' --in-place config.xml
  16. #install haxe dependencies in .haxelib
  17. haxelib newrepo
  18. haxelib -always install cagette.hxml
  19. haxelib -always install cagetteJs.hxml
  20. #template tools
  21. haxelib run templo
  22. sudo mv temploc2 /usr/bin
  23. #extra plugins
  24. @if [ $(PLUGINS) = 1 ]; then \
  25. haxelib git cagette-pro git@bitbucket.org:bubar/cagette-pro.git; \
  26. haxelib git cagette-hosted git@bitbucket.org:bubar/cagette-hosted.git; \
  27. haxelib git cagette-wholesale-order git@github.com:bablukid/cagette-wholesale-order.git; \
  28. fi
  29. #install npm dependencies
  30. npm install
  31. npm run libs:dev
  32. npm run build:js
  33. #compile
  34. @make css
  35. @make compile
  36. @make frontend
  37. @make templates
  38. @echo "Well, it looks like everything is fine : librairies are installed, backend and frontend has been compiled !"
  39. #compile backend to Neko
  40. compile:
  41. @if [ $(PLUGINS) = 1 ]; then \
  42. echo "compile Cagette.net with plugins"; \
  43. haxe cagetteAllPlugins.hxml; \
  44. else \
  45. echo "compile Cagette.net core"; \
  46. haxe cagette.hxml; \
  47. fi
  48. #compile SASS files to CSS
  49. css:
  50. npm run build:sass
  51. #compile frontend to JS
  52. frontend:
  53. @if [ $(PLUGINS) = 1 ]; then \
  54. haxe cagetteAllPluginsJs.hxml; \
  55. else \
  56. haxe cagetteJs.hxml; \
  57. fi
  58. #update POT file from source
  59. i18n:
  60. haxe potGeneration.hxml
  61. #compile templates in each language, required for production env.
  62. templates:
  63. mkdir -p lang/master/tmp
  64. haxe cagette.hxml -D i18n_generation
  65. @make LANG=fr ctemplates
  66. msgfmt www/lang/texts_fr.po -o www/lang/texts_fr.mo
  67. chown www-data:www-data -R www
  68. ctemplates:
  69. # (cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt */*/*/*.mtt */*/*/*/*.mtt)
  70. (cd lang/$(LANG)/tpl; temploc2 -macros macros.mtt -output ../tmp/ *.mtt */*.mtt */*/*.mtt)
  71. #Compile and run unit tests
  72. tests:
  73. @if [ $(PLUGINS) = 1 ]; then \
  74. haxe testsPlugins.hxml; \
  75. else \
  76. haxe tests.hxml; \
  77. fi
  78. @docker-compose run --workdir="/var/www/www" neko neko tests.n mysql://root:root@mysql/tests
  79. cp_plugin:
  80. cp -R .haxelib/cagette-hosted/git/tpl/* lang/master/tpl/plugin/hosted/
  81. cp -R .haxelib/cagette-pro/git/tpl/* lang/master/tpl/plugin/pro/
  82. cp -R .haxelib/cagette-wholesale-order/git/tpl/* lang/master/tpl/plugin/who/