Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Xdebug on 9000 for PHPUnit",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/nextcloud/custom_apps/cookbook": "${workspaceFolder:cookbook}"
}
},
{
"name": "Xdebug on 9000 for Live-Test",
"type": "php",
"request": "launch",
"port": 9000,
"pathMappings": {
"/var/www/html/custom_apps/cookbook": "${workspaceFolder:cookbook}",
"/var/www/html": "${workspaceFolder:base}"
}
},
{
"name": "Xdebug on 9003 for PHPUnit",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/nextcloud/custom_apps/cookbook": "${workspaceFolder:cookbook}"
}
},
{
"name": "Xdebug on 9003 for Live-Test",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html/custom_apps/cookbook": "${workspaceFolder:cookbook}",
"/var/www/html": "${workspaceFolder:base}"
}
}
]
}
24 changes: 24 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"intelephense.environment.includePaths": [
"../../base/lib",
],
"intelephense.files.exclude": [
"**/.git/**",
"**/.svn/**",
"**/.hg/**",
"**/CVS/**",
"**/.DS_Store/**",
"**/node_modules/**",
"**/bower_components/**",
"**/vendor/**/{Tests,tests}/**",
"**/.history/**",
"**/vendor/**/vendor/**",
".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**",
".github/actions/run-tests/volumes/nextcloud/3rdparty/**",
".github/actions/run-tests/volumes/**",
".github/actions/run-tests/volumes"
]
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased]

### Added
- Add IDE configuration to codebase to prevent small issues
[#978](https://github.com/nextcloud/cookbook/pull/978) @christianlupus

### Fixed
- Refactor the code for image handling to make it testable
[#933](https://github.com/nextcloud/cookbook/pull/933) @christianlupus
Expand Down
73 changes: 26 additions & 47 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,10 @@
# * tar: for building the archive
# * npm: for building and testing everything JS
#
# If no composer.json is in the app root directory, the Composer step
# will be skipped. The same goes for the package.json which can be located in
# the app root or the js/ directory.
#
# The npm command by launches the npm build script:
#
# npm run build
#
# The npm test command launches the npm test script:
#
# npm run test
#
# The idea behind this is to be completely testing and build tool agnostic. All
# build tools and additional package managers should be installed locally in
# your project, since this won't pollute people's global namespace.
Expand All @@ -48,23 +40,19 @@ appstore_package_name=$(appstore_build_directory)/$(app_name)
npm=$(shell which npm 2> /dev/null)
composer=$(shell which composer 2> /dev/null)

ifeq (, $(composer))
composer_bin:=php $(build_tools_directory)/composer.phar
else
composer_bin:=composer
endif

all: build appinfo/info.xml

# Fetches the PHP and JS dependencies and compiles the JS. If no composer.json
# is present, the composer step is skipped, if no package.json or js/package.json
# is present, the npm step is skipped
.PHONY: build
build:
ifneq (,$(wildcard $(CURDIR)/composer.json))
$(MAKE) composer
endif
ifneq (,$(wildcard $(CURDIR)/package.json))
$(MAKE) npm
endif
ifneq (,$(wildcard $(CURDIR)/js/package.json))
$(MAKE) npm
endif

build: prepare_phpunit composer npm

.PHONY: install_composer
install_composer:
Expand All @@ -75,34 +63,25 @@ ifeq (, $(composer))
mv composer.phar $(build_tools_directory)
endif

.PHONY: prepare_phpunit
prepare_phpunit: install_composer
cd tests/phpunit && $(composer_bin) install --prefer-dist

# Installs and updates the composer dependencies. If composer is not installed
# a copy is fetched from the web
.PHONY: composer
composer: install_composer
ifeq (, $(composer))
php $(build_tools_directory)/composer.phar install --prefer-dist
php $(build_tools_directory)/composer.phar update --prefer-dist
else
composer install --prefer-dist
composer update --prefer-dist
endif
$(composer_bin) install --prefer-dist
$(composer_bin) update --prefer-dist

.PHONY: composer_dist
composer_dist: install_composer
ifeq (, $(composer))
php $(build_tools_directory)/composer.phar install --prefer-dist --no-dev
else
composer install --prefer-dist --no-dev
endif
$(composer_bin) install --prefer-dist --no-dev

# Installs npm dependencies
.PHONY: npm
npm:
ifeq (,$(wildcard $(CURDIR)/package.json))
cd js && $(npm) run build
else
npm run build
endif

# Removes the appstore build
.PHONY: clean
Expand All @@ -113,10 +92,7 @@ clean:
# npm
.PHONY: distclean
distclean: clean
rm -rf vendor
rm -rf node_modules
rm -rf js/vendor
rm -rf js/node_modules
rm -rf vendor node_modules tests/phpunit/vendor

# Builds the source and appstore package
.PHONY: dist
Expand All @@ -137,6 +113,8 @@ source: appinfo/info.xml
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/js/*.log" \
--exclude="../$(app_name)/.hooks" \
--exclude="../$(app_name)/.github/actions/run-tests/volumes" \
--exclude="../$(app_name)/cookbook.code-workspace" \
../$(app_name)

# Builds the source package for the app store, ignores php and js tests
Expand All @@ -147,20 +125,13 @@ appstore: appinfo/info.xml
tar cvzf $(appstore_package_name).tar.gz \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--exclude="../$(app_name)/docs" \
--exclude="../$(app_name)/documentation" \
--exclude="../$(app_name)/tests" \
--exclude="../$(app_name)/Makefile" \
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/phpunit*xml" \
--exclude="../$(app_name)/composer.*" \
--exclude="../$(app_name)/js/node_modules" \
--exclude="../$(app_name)/js/tests" \
--exclude="../$(app_name)/js/test" \
--exclude="../$(app_name)/js/*.log" \
--exclude="../$(app_name)/js/package.json" \
--exclude="../$(app_name)/js/bower.json" \
--exclude="../$(app_name)/js/karma.*" \
--exclude="../$(app_name)/js/protractor.*" \
--exclude="../$(app_name)/node_modules" \
--exclude="../$(app_name)/src" \
--exclude="../$(app_name)/translationfiles" \
Expand All @@ -172,13 +143,21 @@ appstore: appinfo/info.xml
--exclude="../$(app_name)/protractor\.*" \
--exclude="../$(app_name)/.*" \
--exclude="../$(app_name)/webpack.*.js" \
--exclude="../$(app_name)/stylelint.config.js" \
--exclude="../$(app_name)/js/.*" \
--exclude="../$(app_name)/.hooks" \
--exclude="../$(app_name)/cookbook.code-workspace" \
../$(app_name)

.PHONY: test
test: composer
@echo "This functionality has been move to the file .github/acrions/run-tests/run-locally.sh. See its output with parameter --help."

.PHONY: code_style
code_style:
$(composer_bin) cs:fix
npm run stylelint-fix
npm run prettier-fix

appinfo/info.xml: .github/actions/deploy/patch .github/actions/deploy/minor .github/actions/deploy/major .github/actions/deploy/appinfo/info.xml.dist
.github/actions/deploy/update-data.sh
49 changes: 49 additions & 0 deletions cookbook.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"folders": [
{
"path": "."
},
{
"path": "../../base"
},
{
"path": "tests/phpunit/vendor",
"name": "phpunit-composer"
}
],
"settings": {
"editor.insertSpaces": false,
"files.exclude": {
".github/actions/run-tests/volumes/cookbook/**/*": true,
".github/actions/run-tests/volumes/coverage/**/*": true,
".github/actions/run-tests/volumes/data/**/*": true,
".github/actions/run-tests/volumes/dumps/**/*": true,
".github/actions/run-tests/volumes/mysql/**/*": true,
".github/actions/run-tests/volumes/output/**/*": true,
".github/actions/run-tests/volumes/postgres/**/*": true,
".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**/*": true,
".github/actions/run-tests/volumes/**/*": true
},
"files.watcherExclude": {
".github/actions/run-tests/volumes/nextcloud/custom_apps/cookbook/**/*": true,
".github/actions/run-tests/volumes/nextcloud/**/*": true
},
"intelephense.trace.server": "message",
"intelephense.files.exclude": [
"**/.git/**",
"**/.svn/**",
"**/.hg/**",
"**/CVS/**",
"**/.DS_Store/**",
"**/node_modules/**",
"**/bower_components/**",
"**/vendor/**/{Tests,tests}/**",
"**/.history/**",
"**/vendor/**/vendor/**",
"3rdparty/**"
],
"cSpell.words": [
"Nextcloud"
]
}
}