-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from OS2Forms/os2forms_get_organized
Added module code
- Loading branch information
Showing
21 changed files
with
1,484 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
on: pull_request | ||
name: PR Review | ||
jobs: | ||
changelog: | ||
runs-on: ubuntu-latest | ||
name: Changelog should be updated | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Git fetch | ||
run: git fetch | ||
|
||
- name: Check that changelog has been updated. | ||
run: git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md && exit 1 || exit 0 | ||
|
||
test-composer-files: | ||
name: Validate composer | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: [ '7.4', '8.0', '8.1' ] | ||
dependency-version: [ prefer-lowest, prefer-stable ] | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: json | ||
coverage: none | ||
tools: composer:v2 | ||
# https://github.com/shivammathur/setup-php#cache-composer-dependencies | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: Validate composer files | ||
run: | | ||
composer validate --strict composer.json | ||
# Check that dependencies resolve. | ||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction | ||
php-check-coding-standards: | ||
name: PHP - Check Coding Standards | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: [ '7.4', '8.0', '8.1' ] | ||
dependency-version: [ prefer-lowest, prefer-stable ] | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: json | ||
coverage: none | ||
tools: composer:v2 | ||
# https://github.com/shivammathur/setup-php#cache-composer-dependencies | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: Install Dependencies | ||
run: | | ||
composer install --no-interaction --no-progress | ||
- name: PHPCS | ||
run: | | ||
composer coding-standards-check/phpcs | ||
php-code-analysis: | ||
name: PHP - Code analysis | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php-versions: [ '7.4', '8.0', '8.1' ] | ||
dependency-version: [ prefer-lowest, prefer-stable ] | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Setup PHP, with composer and extensions | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: json, gd | ||
coverage: none | ||
tools: composer:v2 | ||
# https://github.com/shivammathur/setup-php#cache-composer-dependencies | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
- name: drupal-check | ||
run: | | ||
# We need a Drupal project to run drupal-check (cf. https://github.com/mglaman/drupal-check#usage) | ||
# Install Drupal | ||
composer --no-interaction create-project drupal/recommended-project:^9 --stability=dev drupal | ||
# Copy our module source code into the Drupal module folder. | ||
mkdir -p drupal/web/modules/contrib/os2forms_get_organized | ||
cp -r os2forms_get_organized.* composer.json src drupal/web/modules/contrib/os2forms_get_organized | ||
# Add our module as a composer repository. | ||
composer --no-interaction --working-dir=drupal config repositories.os2forms/os2forms_get_organized path web/modules/contrib/os2forms_get_organized | ||
# Restore Drupal composer repository. | ||
composer --no-interaction --working-dir=drupal config repositories.drupal composer https://packages.drupal.org/8 | ||
composer --no-interaction --working-dir=drupal config --no-plugins allow-plugins.cweagans/composer-patches true | ||
# @see https://getcomposer.org/doc/03-cli.md#modifying-extra-values | ||
composer --no-interaction --working-dir=drupal config --no-plugins --json extra.enable-patching true | ||
# Require our module. | ||
composer --no-interaction --working-dir=drupal require 'os2forms/os2forms_get_organized:*' | ||
# Check code | ||
composer --no-interaction --working-dir=drupal require --dev drupal/core-dev | ||
cd drupal/web/modules/contrib/os2forms_get_organized | ||
# Remove our non-dev dependencies to prevent duplicated Drupal installation | ||
# PHP Fatal error: Cannot redeclare drupal_get_filename() (previously declared in /home/runner/work/os2forms_get_organized/os2forms_get_organized/drupal/web/modules/contrib/os2forms_get_organized/vendor/drupal/core/includes/bootstrap.inc:190) in /home/runner/work/os2forms_get_organized/os2forms_get_organized/drupal/web/core/includes/bootstrap.inc on line 190 | ||
# Use sed to remove the "require" property in composer.json | ||
sed -i '/^\s*"require":/,/^\s*}/d' composer.json | ||
composer --no-interaction install | ||
composer code-analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- markdownlint-disable MD024 --> | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
See [keep a changelog](https://keepachangelog.com/en/1.0.0/) for information | ||
about writing changes to this log. | ||
|
||
## [Unreleased] | ||
|
||
[Unreleased]: https://github.com/OS2Forms/os2forms_get_organized/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# os2forms_get_organized | ||
# OS2Forms GetOrganized | ||
|
||
Adds [GetOrganized](https://www.getorganized.net/) handler for archiving purposes. | ||
|
||
## Installation | ||
|
||
```sh | ||
composer require os2forms/os2forms_get_organized | ||
vendor/bin/drush pm:enable os2forms_get_organized | ||
``` | ||
|
||
## Settings | ||
|
||
Set GetOrganized `username`, `password` and `base url` | ||
on `/admin/os2forms_get_organized/settings`. | ||
|
||
You can also test that the provided | ||
details work on `/admin/os2forms_get_organized/settings`. | ||
|
||
## Coding standards | ||
|
||
Check coding standards: | ||
|
||
```sh | ||
docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php7.4-fpm:latest composer install | ||
docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php7.4-fpm:latest composer coding-standards-check | ||
``` | ||
|
||
Apply coding standards: | ||
|
||
```shell | ||
docker run --rm --interactive --tty --volume ${PWD}:/app itkdev/php7.4-fpm:latest composer coding-standards-apply | ||
docker run --rm --interactive --tty --volume ${PWD}:/app node:18 yarn --cwd /app coding-standards-apply | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "os2forms/os2forms_get_organized", | ||
"description": "OS2Forms GetOrganized integration", | ||
"type": "drupal-module", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Jeppe Kuhlmann Andersen", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"repositories": [ | ||
{ | ||
"type": "composer", | ||
"url": "https://packages.drupal.org/8" | ||
} | ||
], | ||
"require": { | ||
"itk-dev/getorganized-api-client-php": "^1.2", | ||
"drupal/webform": "^6.1", | ||
"drupal/advancedqueue": "^1.0", | ||
"symfony/options-resolver": "^5.4" | ||
}, | ||
"require-dev": { | ||
"dealerdirect/phpcodesniffer-composer-installer": "^1.0", | ||
"drupal/coder": "^8.3", | ||
"mglaman/drupal-check": "^1.4" | ||
}, | ||
"scripts": { | ||
"code-analysis/drupal-check": [ | ||
"# @see https://github.com/mglaman/drupal-check/issues/261#issuecomment-1030141772 for details on exclude-dir value", | ||
"drupal-check --deprecations --analysis --exclude-dir='vendor,*/Client/*' *.* src" | ||
], | ||
"code-analysis": [ | ||
"@code-analysis/drupal-check" | ||
], | ||
"coding-standards-check/phpcs": [ | ||
"vendor/bin/phpcs --standard=phpcs.xml.dist" | ||
], | ||
"coding-standards-check": [ | ||
"@coding-standards-check/phpcs" | ||
], | ||
"coding-standards-apply/phpcs": [ | ||
"vendor/bin/phpcbf --standard=phpcs.xml.dist" | ||
], | ||
"coding-standards-apply": [ | ||
"@coding-standards-apply/phpcs" | ||
] | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
config/install/advancedqueue.advancedqueue_queue.get_organized_queue.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
langcode: da | ||
status: true | ||
dependencies: { } | ||
id: get_organized_queue | ||
label: 'Get Organized Queue' | ||
backend: database | ||
backend_configuration: | ||
lease_time: 300 | ||
processor: cron | ||
processing_time: 90 | ||
locked: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: 'OS2Forms GetOrganized' | ||
type: module | ||
description: 'GetOrganized integration' | ||
package: OS2Forms | ||
core_version_requirement: ^9 | ||
dependencies: | ||
- drupal:webform | ||
- drupal:advancedqueue | ||
- drupal:webform_entity_print_attachment | ||
configure: os2forms_get_organized.admin.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
os2forms_get_organized.admin.settings: | ||
title: OS2Forms Get Organized | ||
description: Configure the OS2Forms GetOrganized module | ||
parent: system.admin_config_system | ||
route_name: os2forms_get_organized.admin.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
os2forms_get_organized.admin.settings: | ||
path: '/admin/os2forms_get_organized/settings' | ||
defaults: | ||
_form: '\Drupal\os2forms_get_organized\Form\SettingsForm' | ||
_title: 'GetOrganized settings' | ||
requirements: | ||
_permission: 'administer site configuration' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
services: | ||
Drupal\os2forms_get_organized\Helper\Settings: | ||
arguments: | ||
- "@keyvalue" | ||
|
||
Drupal\os2forms_get_organized\Helper\ArchiveHelper: | ||
arguments: | ||
- '@entity_type.manager' | ||
- '@Drupal\os2forms_get_organized\Helper\Settings' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PHP_CodeSniffer"> | ||
<description>The coding standard.</description> | ||
|
||
<file>.</file> | ||
|
||
<exclude-pattern>vendor/</exclude-pattern> | ||
|
||
<!-- Show progress of the run --> | ||
<arg value="p"/> | ||
|
||
<arg name="extensions" value="php,module,inc,install,test,profile,theme,css,info,txt,yml"/> | ||
<config name="drupal_core_version" value="9"/> | ||
|
||
<rule ref="Drupal"> | ||
<!-- <exclude name="Drupal.Files.TxtFileLineLength.TooLong"/> --> | ||
<!-- We want to be able to use "package" and "version" in our custom modules --> | ||
<exclude name="Drupal.InfoFiles.AutoAddedKeys.Project"/> | ||
<exclude name="Drupal.InfoFiles.AutoAddedKeys.Version"/> | ||
</rule> | ||
|
||
<rule ref="DrupalPractice"/> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_get_organized\Exception; | ||
|
||
/** | ||
* Archiving method Exception. | ||
*/ | ||
class ArchivingMethodException extends \Exception { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_get_organized\Exception; | ||
|
||
/** | ||
* Citizen archiving Exception. | ||
*/ | ||
class CitizenArchivingException extends \Exception { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_get_organized\Exception; | ||
|
||
/** | ||
* GetOrganized case id Exception. | ||
*/ | ||
class GetOrganizedCaseIdException extends \Exception { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_get_organized\Exception; | ||
|
||
/** | ||
* GetOrganized queue Exception. | ||
*/ | ||
class GetOrganizedQueueException extends \Exception { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Drupal\os2forms_get_organized\Exception; | ||
|
||
/** | ||
* Invalid setting exception. | ||
*/ | ||
class InvalidSettingException extends \Exception { | ||
|
||
} |
Oops, something went wrong.