Skip to content
Open
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
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
'@nextcloud',
]
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/js/* binary
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
/vendor/
/build/
node_modules/
/.php_cs.cache
js/*hot-update.*
/.php-cs-fixer.cache
js/*hot-update.*
/vendor-bin/**/vendor
/.vscode
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->notPath('lib/Vendor')
->in(__DIR__);
return $config;
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

174 changes: 45 additions & 129 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,155 +1,71 @@
# This file is licensed under the Affero General Public License version 3 or
# later. See the COPYING file.
# @author Bernhard Posselt <dev@bernhard-posselt.com>
# @copyright Bernhard Posselt 2016

# Generic Makefile for building and packaging a Nextcloud app which uses npm and
# Composer.
#
# Dependencies:
# * make
# * which
# * curl: used if phpunit and composer are not installed to fetch them from the web
# * 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.
#
# The following npm scripts in your package.json install and update the bower
# and npm dependencies and use gulp as build system (notice how everything is
# run from the node_modules folder):
#
# "scripts": {
# "test": "node node_modules/gulp-cli/bin/gulp.js karma",
# "prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
# "build": "node node_modules/gulp-cli/bin/gulp.js"
# },

app_name=$(notdir $(CURDIR))
build_tools_directory=$(CURDIR)/build/tools
source_build_directory=$(CURDIR)/build/artifacts/source
source_package_name=$(source_build_directory)/$(app_name)
appstore_build_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_build_directory)/$(app_name)
npm=$(shell which npm 2> /dev/null)
composer=$(shell which composer 2> /dev/null)

all: build
all: dev-setup lint build-js-production test

# Dev env management
dev-setup: clean clean-dev composer npm-init

# 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

# Installs and updates the composer dependencies. If composer is not installed
# a copy is fetched from the web
.PHONY: composer
composer:
ifeq (, $(composer))
@echo "No composer command available, downloading a copy from the web"
mkdir -p $(build_tools_directory)
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
else
composer install --prefer-dist
composer update --prefer-dist
endif

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

npm-update:
npm update

# Building
build-js:
npm run dev

build-js-production:
npm run build
endif

# Removes the appstore build
.PHONY: clean
watch-js:
npm run watch

serve-js:
npm run serve

# Linting
lint:
npm run lint

lint-fix:
npm run lint:fix

# Style linting
stylelint:
npm run stylelint

stylelint-fix:
npm run stylelint:fix

# Cleaning
clean:
rm -rf ./build
rm -rf js/*

# Same as clean but also removes dependencies installed by composer, bower and
# npm
.PHONY: distclean
distclean: clean
rm -rf vendor
clean-dev:
rm -rf node_modules
rm -rf js/vendor
rm -rf js/node_modules

# Builds the source and appstore package
.PHONY: dist
dist:
make source
make appstore

# Builds the source package
.PHONY: source
source:
rm -rf $(source_build_directory)
mkdir -p $(source_build_directory)
tar cvzf $(source_package_name).tar.gz ../$(app_name) \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--exclude="../$(app_name)/js/node_modules" \
--exclude="../$(app_name)/node_modules" \
--exclude="../$(app_name)/*.log" \
--exclude="../$(app_name)/js/*.log" \

# Builds the source package for the app store, ignores php and js tests
.PHONY: appstore
appstore:
rm -rf $(appstore_build_directory)
mkdir -p $(appstore_build_directory)
tar cvzf $(appstore_package_name).tar.gz ../$(app_name) \
--exclude-vcs \
--exclude="../$(app_name)/build" \
--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)/package.json" \
--exclude="../$(app_name)/bower.json" \
--exclude="../$(app_name)/karma.*" \
--exclude="../$(app_name)/protractor\.*" \
--exclude="../$(app_name)/.*" \
--exclude="../$(app_name)/js/.*" \

.PHONY: test
test: composer
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.xml
$(CURDIR)/vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml

# Tests
test:
./vendor/phpunit/phpunit/phpunit -c tests/phpunit.xml
./vendor/phpunit/phpunit/phpunit -c tests/phpunit.integration.xml
46 changes: 14 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
# VO Federation
Place this app in **nextcloud/apps/**

## Building the app
## Try it
To install it change into your Nextcloud's apps directory:

The app can be built by using the provided Makefile by running:
cd nextcloud/apps

make
Then clone this repository into a folder named **vo_federation**:

This requires the following things to be present:
* make
* which
* tar: for building the archive
* curl: used if phpunit and composer are not installed to fetch them from the web
* npm: for building and testing everything JS, only required if a package.json is placed inside the **js/** folder
git clone https://github.com/nextcloud/vo_federation.git

The make command will install or update Composer dependencies if a composer.json is present and also **npm run build** if a package.json is present in the **js/** folder. The npm **build** script should use local paths for build systems and package managers, so people that simply want to build the app won't need to install npm libraries globally, e.g.:
Then install the dependencies using:

**package.json**:
```json
"scripts": {
"test": "node node_modules/gulp-cli/bin/gulp.js karma",
"prebuild": "npm install && node_modules/bower/bin/bower install && node_modules/bower/bin/bower update",
"build": "node node_modules/gulp-cli/bin/gulp.js"
}
```
make composer

## Frontend development

## Publish to App Store
The app uses [Vue.js](https://vuejs.org/). To build the frontend code after doing changes to its source in `src/` requires to have Node and npm installed.

First get an account for the [App Store](http://apps.nextcloud.com/) then run:
- 👩‍💻 Run `make dev-setup` to install the frontend dependencies
- 🏗 To build the Javascript whenever you make changes, run `make build-js`

make && make appstore

The archive is located in build/artifacts/appstore and can then be uploaded to the App Store.
To continuously run the build when editing source files you can make use of the `make watch-js` command.

## Running tests
You can use the provided Makefile to run all tests by using:
Expand All @@ -41,12 +29,6 @@ You can use the provided Makefile to run all tests by using:

This will run the PHP unit and integration tests and if a package.json is present in the **js/** folder will execute **npm run test**

Of course you can also install [PHPUnit](http://phpunit.de/getting-started.html) and use the configurations directly:

phpunit -c phpunit.xml

or:

phpunit -c phpunit.integration.xml
## Documentation

for integration tests
Please refer to the User guide and Administrator guide of the [documentation](https://nextcloud-vo-federation.readthedocs.io) for detailed explanations on how to use the app. Developers may find useful resources in the development section.
24 changes: 16 additions & 8 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@
The VO Federation app for Community AAIs allows federated sharing across VO groups independent of the Nextcloud instance any particular group member is using. Nextcloud users who want to participate in VO groups need to link their user account to their Community AAI using OpenID Connect.

VO Federation enhances existing federation features by allowing Community AAIs to define groups on the shared user directory of all trusted Nextcloud instances using the app.]]></description>
<version>0.0.1</version>
<version>0.3.0</version>
<licence>agpl</licence>
<author>publicplan GmbH</author>
<namespace>VO_Federation</namespace>
<category>social</category>
<bugs>https://github.com/nextcloud/vo_federation/issues</bugs>
<dependencies>
<nextcloud min-version="25" max-version="25"/>
<nextcloud min-version="26" max-version="26"/>
</dependencies>
<navigations>
<navigation>
<name>VO Federation</name>
<route>vo_federation.page.index</route>
</navigation>
</navigations>
<settings>
<admin>OCA\VO_Federation\Settings\Admin</admin>
<admin-section>OCA\VO_Federation\Settings\AdminSection</admin-section>
<personal>OCA\VO_Federation\Settings\Personal</personal>
<personal-section>OCA\VO_Federation\Settings\PersonalSection</personal-section>
</settings>
<collaboration>
<plugins>
<plugin type="collaborator-search" share-type="SHARE_TYPE_FEDERATED_GROUP">OCA\VO_Federation\Collaboration\FederatedGroupPlugin</plugin>
</plugins>
</collaboration>
<background-jobs>
<job>OCA\VO_Federation\BackgroundJob\OCMNotificationJob</job>
</background-jobs>
</info>
Loading