diff options
author | dartcafe <github@dartcafe.de> | 2019-01-02 22:59:42 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2019-01-02 22:59:42 +0300 |
commit | 48fd198445bb1830453a7f4d20a919a74a5afec0 (patch) | |
tree | 320ff1ee8d02977a7a417c1f954509c33d8b0f6c /Makefile | |
parent | 0c54bca405dbc0d8fc14845b161ac349b93cf335 (diff) |
Updates env
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 95 |
1 files changed, 59 insertions, 36 deletions
@@ -6,18 +6,31 @@ # Dependencies: # * make # * which +# * npm # * curl: used if phpunit and composer are not installed to fetch them from the web # * tar: for building the archive app_name=$(notdir $(CURDIR)) -build_tools_directory=$(CURDIR)/build/tools -build_source_directory=$(CURDIR)/build/source -appstore_build_directory=$(CURDIR)/build/artifacts/appstore -appstore_package_name=$(appstore_build_directory)/$(app_name) -nc_cert_directory=$(HOME)/.nextcloud/certificates +build_dir=$(CURDIR)/build +build_tools_dir=$(build_dir)/tools +build_source_dir=$(build_dir)/source +appstore_build_dir=$(build_dir)/artifacts/appstore +sign_dir=$(build_dir)/sign +appstore_package_name=$(appstore_build_dir)/$(app_name) +nc_cert_dir=$(HOME)/.nextcloud/certificates composer=$(shell which composer 2> /dev/null) -all: composer +all: dev-setup lint build-js-production test + +# Dev environment setup +dev-setup: clean clean-dev npm-init composer + +npm-init: + npm install + +# Build js +build-js-production: + npm run build # Installs and updates the composer dependencies. If composer is not installed # a copy is fetched from the web @@ -25,66 +38,76 @@ all: composer composer: ifeq (,$(composer)) @echo "No composer command available, downloading a copy from the web" - mkdir -p $(build_tools_directory) + mkdir -p $(build_tools_dir) curl -sS https://getcomposer.org/installer | php - mv composer.phar $(build_tools_directory) - php $(build_tools_directory)/composer.phar install --prefer-dist - php $(build_tools_directory)/composer.phar update --prefer-dist + mv composer.phar $(build_tools_dir) + php $(build_tools_dir)/composer.phar install --prefer-dist + php $(build_tools_dir)/composer.phar update --prefer-dist else composer install --prefer-dist composer update --prefer-dist endif -# Removes the appstore build +# Lint +lint: + npm run lint + +lint-fix: + npm run lint:fix + +# Removes the appstore build and compiled js files .PHONY: clean clean: - rm -rf ./build + rm -rf $(build_dir) + rm -f js/polls.js + rm -f js/polls.js.map + +clean-dev: + rm -rf node_modules + # Builds the source package for the app store, ignores php and js tests .PHONY: appstore -appstore: - rm -rf $(appstore_build_directory) - rm -rf $(build_source_directory) - mkdir -p $(appstore_build_directory) - mkdir -p $(build_source_directory) - +appstore: dev-setup lint build-js-production composer + mkdir -p $(sign_dir) rsync -a \ - --include="js/vendor" \ - --include="css/vendor" \ + --exclude="ISSUE_TEMPLATE.md" \ --exclude="*.log" \ --exclude=".*" \ + --exclude="build" \ --exclude="bower.json" \ --exclude="composer.*" \ - --exclude="ISSUE_TEMPLATE.md" \ - --exclude="karma.*" \ - --exclude="Makefile" \ - --exclude="package*" \ - --exclude="phpunit*xml" \ - --exclude="protractor.*" \ - --exclude="build" \ + --include="css/vendor" \ --exclude="css/*.css" \ - --exclude="js/node_modules" \ - --exclude="js/tests" \ - --exclude="js/test" \ + --exclude="js/.*" \ --exclude="js/*.log" \ - --exclude="js/package.json" \ --exclude="js/bower.json" \ --exclude="js/karma.*" \ + --exclude="js/node_modules" \ + --exclude="js/package.json" \ --exclude="js/protractor.*" \ - --exclude="js/.*" \ + --exclude="js/test" \ + --exclude="js/tests" \ + --include="js/vendor" \ + --exclude="karma.*" \ --exclude="l10n/no-php" \ + --exclude="Makefile" \ --exclude="node_modules" \ + --exclude="package*" \ + --exclude="phpunit*xml" \ + --exclude="protractor.*" \ --exclude="screenshots" \ --exclude="src" \ --exclude="tests" \ --exclude="vendor" \ - ./ $(build_source_directory)/$(app_name) + ./ $(build_source_dir)/$(app_name) - tar cvzf $(appstore_package_name).tar.gz --directory="$(build_source_directory)" $(app_name) + tar cvzf $(appstore_package_name).tar.gz \ + --directory="$(build_source_dir)" $(app_name) - @if [ -f $(nc_cert_directory)/$(app_name).key ]; then \ + @if [ -f $(nc_cert_dir)/$(app_name).key ]; then \ echo "Signing package..."; \ - openssl dgst -sha512 -sign $(nc_cert_directory)/$(app_name).key $(appstore_build_directory)/$(app_name).tar.gz | openssl base64; \ + openssl dgst -sha512 -sign $(nc_cert_dir)/$(app_name).key $(appstore_build_dir)/$(app_name).tar.gz | openssl base64; \ fi .PHONY: test |