Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ nbproject
# Mac OS
.DS_Store

# test files
clover.xml

60 changes: 60 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
language: php
php:
- 5.6
- 7.0
- 7.1

env:
global:
- CORE_BRANCH=master
- APP_NAME=customgroups
matrix:
- DB=sqlite

branches:
only:
- master

before_install:
- wget https://raw.githubusercontent.com/owncloud/administration/master/travis-ci/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB

# Add some output debugging information
- cd ../core
- ./occ check
- ./occ status
- ./occ app:list

script:
- cd apps/$APP_NAME/

# Test the app
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' = '1' ]; then make test-codecheck; fi"
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' = '1' ]; then make test-codecheck; fi"
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' = '2' ]; then make test-codecheck-deprecations; fi"
- cd apps/$APP_NAME/

# Run phpunit tests
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then make test-php; fi"

# Create and upload coverage report
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then make test-upload-coverage; fi"

# Run Javascript unit tests
- make test-js

matrix:
include:
- php: 5.6
env: DB=mysql
- php: 5.6
env: DB=pgsql
- php: 5.6
env: DB=mysql;CODECHECK=1
- php: 5.6
env: DB=mysql;CODECHECK=2
- php: 5.6
env: DB=mysql;JSTESTS=1
allow_failures:
- env: DB=mysql;CODECHECK=2
fast_finish: true
50 changes: 45 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Makefile for building the project
# Makefile

OWNCLOUD_PATH=$(CURDIR)/../..
OCC=$(OWNCLOUD_PATH)/occ
PHPUNIT=$(OWNCLOUD_PATH)/lib/composer/phpunit/phpunit/phpunit

app_name=customgroups
project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build
doc_files=README.md
src_files=
src_dirs=appinfo controller css img js l10n lib templates
src_dirs=appinfo lib
all_src=$(src_files) $(src_dirs) $(doc_files)
market_dir=$(build_dir)/market

.PHONY: all
all: dist market
all: market

.PHONE: market
market: dist
cd $(build_dir); tar cvzf $(app_name).tar.gz $(app_name)
rm -Rf $(market_dir); mkdir -p $(market_dir)
mv $(build_dir)/$(app_name).tar.gz $(market_dir)


$(build_dir)/$(app_name):
rm -Rf $@; mkdir -p $@
cp -R $(all_src) $@
Expand All @@ -29,6 +33,42 @@ dist: $(build_dir)/$(app_name)
distclean: clean

.PHONY: clean
clean:
clean: clean-test
rm -rf $(build_dir)

.PHONY: clean-test
clean-test:
rm tests/unit/clover.xml
rm tests/unit/*.phar

.PHONY: test-syntax
test-syntax:
for F in $(shell find . -name \*.php); do \
php -l "$$F" || exit $?; \
done

.PHONY: test-codecheck
test-codecheck: test-syntax
$(OCC) app:check-code $(app_name) -c private -c strong-comparison

.PHONY: test-codecheck-deprecations
test-codecheck-deprecations:
$(OCC) app:check-code $(app_name) -c deprecation

.PHONY: test-php
test-php: test-syntax
$(OCC) app:enable $(app_name)
cd tests/unit && $(PHPUNIT) --configuration phpunit.xml

.PHONY: test-upload-coverage
test-upload-coverage:
cd tests/unit && wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover clover.xml

.PHONY: test-js
test-js:
@echo No JS unit tests currently
#cd tests/js && npm install --deps; node_modules/karma/bin/karma start karma.config.js --single-run;

.PHONY: test
test: test-codecheck test-codecheck-deprecations test-php test-js

23 changes: 23 additions & 0 deletions appinfo/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* @author Vincent Petry <pvince81@owncloud.com>
*
* @copyright Copyright (c) 2016, ownCloud GmbH.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

$app = new \OCA\CustomGroups\Application();
$app->registerGroupBackend();
80 changes: 80 additions & 0 deletions appinfo/database.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
<charset>utf8</charset>
<table>
<name>*dbprefix*custom_group</name>
<declaration>
<!-- Generated numeric group id -->
<field>
<name>group_id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<length>4</length>
</field>
<!-- URI for Webdav usage -->
<field>
<name>uri</name>
<type>text</type>
<length>255</length>
</field>
<!-- Display name -->
<field>
<name>display_name</name>
<type>text</type>
<default></default>
<length>64</length>
</field>
<index>
<name>cg_uri_index</name>
<unique>true</unique>
<field>
<name>uri</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
<table>
<name>*dbprefix*custom_group_member</name>
<declaration>
<field>
<name>group_id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<length>4</length>
</field>
<field>
<name>user_id</name>
<type>text</type>
<default></default>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>is_admin</name>
<type>integer</type>
<default>1</default>
<notnull>false</notnull>
</field>
<index>
<name>cg_gid_uid_index</name>
<primary>true</primary>
<unique>true</unique>
<field>
<name>group_id</name>
<sorting>ascending</sorting>
</field>
<field>
<name>user_id</name>
<sorting>ascending</sorting>
</field>
</index>
</declaration>
</table>
</database>
2 changes: 2 additions & 0 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<info>
<id>customgroups</id>
<name>User-defined custom groups</name>
<namespace>CustomGroups</namespace>
<description>Let users create and manage custom groups for sharing.</description>
<website>https://github.com/owncloud/customgroups/</website>
<bugs>https://github.com/owncloud/customgroups/issues</bugs>
Expand All @@ -11,6 +12,7 @@
<version>0.1</version>
<types>
<authentication/>
<dav/>
</types>
<dependencies>
<owncloud min-version="9.2" max-version="9.2" />
Expand Down
38 changes: 38 additions & 0 deletions lib/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/**
* @author Vincent Petry <pvince81@owncloud.com>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

namespace OCA\CustomGroups;

use OCP\AppFramework\App;

class Application extends App {
public function __construct (array $urlParams = array()) {
parent::__construct('customgroups', $urlParams);
}

/**
* Register the group manager
*/
public function registerGroupBackend() {
$backend = $this->getContainer()->query('\OCA\CustomGroups\CustomGroupsBackend');
$this->getContainer()->getServer()->getGroupManager()->addBackend($backend);
}
}
Loading