Skip to content

Commit 354c3ff

Browse files
Merge branch 'port-to-3_5-895' into 'main'
Adapts to OJS 3.5.0 See merge request softwares-pkp/plugins_ojs/notificacao-atualizacao-plugins!3
2 parents 6eb27ef + 5e841e9 commit 354c3ff

12 files changed

Lines changed: 53 additions & 81 deletions

.github/workflows/generate-package.yml

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,8 @@ name: Create release and tar.gz package for it
77

88
jobs:
99
create-release:
10-
name: Create release and package
11-
env:
12-
PLUGIN_NAME: pluginUpdateNotification
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v2
17-
- name: Check version.xml
18-
run: |
19-
sudo apt install xmlstarlet
20-
application=$(xmlstarlet sel -t -v 'version/application' version.xml)
21-
if [ $application != $PLUGIN_NAME ]; then exit 1; fi
22-
release=$(xmlstarlet sel -t -v 'version/release' version.xml)
23-
tag=${{ github.ref }}
24-
tag=${tag/refs\/tags\/v}
25-
if [[ $release != $tag* ]]; then exit 1; fi
26-
date_version=$(xmlstarlet sel -t -v 'version/date' version.xml)
27-
current_date=$(date +'%Y-%m-%d')
28-
if [ $date_version != $current_date ]; then exit 1; fi
29-
shell: bash
30-
- name: Create the tar.gz package
31-
run: |
32-
mkdir $PLUGIN_NAME
33-
ls -la
34-
shopt -s extglob
35-
cp -r !($PLUGIN_NAME|.git*|tests|.|..) $PLUGIN_NAME
36-
ls -la
37-
tar -zcvf $PLUGIN_NAME.tar.gz $PLUGIN_NAME
38-
ls -la
39-
shell: bash
40-
- name: Create the release
41-
id: create_release
42-
uses: actions/create-release@v1
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
with:
46-
tag_name: ${{ github.ref }}
47-
release_name: Release ${{ github.ref }}
48-
draft: false
49-
prerelease: false
50-
- name: Upload the package as release asset
51-
id: upload-release-asset
52-
uses: actions/upload-release-asset@v1
53-
env:
54-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55-
with:
56-
upload_url: ${{ steps.create_release.outputs.upload_url }}
57-
asset_path: ./${{ env.PLUGIN_NAME }}.tar.gz
58-
asset_name: ${{ env.PLUGIN_NAME }}.tar.gz
59-
asset_content_type: application/x-compressed-tar
10+
uses: lepidus/github-workflows/.github/workflows/generate-package.yml@main
11+
with:
12+
plugin_name: pluginUpdateNotification
13+
permissions:
14+
contents: write

.gitlab-ci.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ variables:
33

44
include:
55
- project: 'documentacao-e-tarefas/modelosparaintegracaocontinua'
6-
ref: main
6+
ref: stable-3_5_0
77
file:
8-
- 'templates/groups/pkp_plugin.yml'
8+
- 'templates/groups/pkp_plugin.yml'
9+
- 'templates/groups/ojs/cypress_tests.yml'
10+
- 'templates/groups/ops/cypress_tests.yml'
11+
- 'templates/groups/omp/cypress_tests.yml'
12+
13+
ojs_integration_tests:
14+
rules:
15+
- when: never
16+
17+
ops_integration_tests:
18+
rules:
19+
- when: never
20+
21+
omp_integration_tests:
22+
rules:
23+
- when: never

PluginUpdateNotificationPlugin.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
use PKP\plugins\Hook;
1919
use PKP\plugins\GenericPlugin;
20+
use PKP\plugins\GalleryPlugin;
2021
use PKP\config\Config;
2122
use PKP\db\DAORegistry;
2223
use APP\core\Application;
23-
use APP\plugins\generic\pluginUpdateNotification\classes\PluginUpdateNotification;
2424

2525
class PluginUpdateNotificationPlugin extends GenericPlugin
2626
{
@@ -61,6 +61,8 @@ public function websiteSettingsCallback($hookName, $params)
6161
]);
6262
$output .= sprintf('%s', $smarty->fetch($this->getTemplateResource('updateNotificationPlugins.tpl')));
6363
}
64+
65+
return false;
6466
}
6567

6668
private function getUpgradablePlugins()
@@ -70,7 +72,7 @@ private function getUpgradablePlugins()
7072
$updatePluginsNames = array();
7173

7274
foreach ($pluginsGallery as $plugin) {
73-
if ($plugin->getCurrentStatus() == PLUGIN_GALLERY_STATE_UPGRADABLE) {
75+
if ($plugin->getCurrentStatus() == GalleryPlugin::PLUGIN_GALLERY_STATE_UPGRADABLE) {
7476
$updatePluginsNames[] = $plugin->getLocalizedName();
7577
}
7678
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This plugin generates a notification in `Settings`>` Website` informing all the
55
## Compatibility
66

77
This plugin is compatible with **OJS**, **OPS** and **OMP** in the following versions:
8+
* 3.5.0
89
* 3.4.0
910
* 3.3.0
1011
* 3.2.1

cypress/support/commands.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Cypress.Commands.add('loginAdmin', () => {
1616

1717
Cypress.Commands.add('goToWebsiteSettings', () => {
1818
cy.loginAdmin();
19-
cy.get('.app__nav a')
19+
cy.get('nav')
2020
.contains('Website')
21-
.click();
21+
.click( {force: true});
2222
});
2323

2424
Cypress.Commands.add('goToPluginSettings', () => {
-14.5 KB
Binary file not shown.
682 KB
Binary file not shown.

cypress/tests/Test1_setupScenario.cy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ describe('Setup scenario', function () {
1313
});
1414
});
1515

16-
it('install plugin doiInSummary version 1.3.1 ', function () {
17-
const fileName = 'plugins/generic/pluginUpdateNotification/cypress/testData/doiInSummary.tar.gz';
16+
it('install plugin shariff version 3.5.1.0 ', function () {
17+
const fileName = 'plugins/generic/pluginUpdateNotification/cypress/testData/shariff-3_5_0.tar.gz';
1818
cy.goToPluginSettings();
1919
cy.get('.pkp_linkaction_upload').contains('Upload A New Plugin').click();
2020
cy.get('#plupload-pkpUploaderDropZone').selectFile(fileName, { action: 'drag-drop' });
21-
cy.get('.pkp_uploader_details').contains('doiInSummary.tar.gz');
21+
cy.get('.pkp_uploader_details').contains('shariff-3_5_0.tar.gz');
2222
cy.get('.submitFormButton').contains('Save').click();
23-
cy.get('div').contains('Successfully installed version 1.3.1.0');
23+
cy.get('div').contains('Successfully installed version 3.5.1.0');
2424
});
2525
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import '../support/commands';
22

33
describe('Validate PluginUpdateNotification plugin works', function () {
4-
it('shows a notification informing doiInSummary plugin can be updgraded', function () {
4+
it('Shows a notification informing shariff plugin can be updgraded', function () {
55
cy.goToWebsiteSettings();
6-
cy.get('.pkp_notification').get('.notifyWarning').contains('The following plugins have updates available: DOI in Summary');
6+
cy.get('#pluginUpdateNotification').contains('The following plugins have updates available: Shariff');
77
});
88
});
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import '../support/commands';
22

33
describe('Tear down scenario', function () {
4-
it ('uninstalls the doiInSummary plugin', function () {
4+
it ('Uninstalls the Shariff plugin', function () {
55
cy.goToPluginSettings();
6-
cy.get('#component-grid-settings-plugins-settingsplugingrid-category-generic-row-doiinsummaryplugin > .first_column > .show_extras').click();
6+
cy.get('#component-grid-settings-plugins-settingsplugingrid-category-generic-row-shariffplugin > .first_column > .show_extras').click();
77
cy.get(
8-
'#component-grid-settings-plugins-settingsplugingrid-category-generic-row-doiinsummaryplugin-control-row'
8+
'#component-grid-settings-plugins-settingsplugingrid-category-generic-row-shariffplugin-control-row'
99
).contains('Delete').click();
10-
cy.get('.ok').click();
10+
cy.get('.pkpButton').contains('OK').click();
1111
cy.get('div').should('include.text', ' successfuly deleted');
12+
cy.reload();
13+
cy.contains('The following plugins have updates available: Shariff')
14+
.should('not.exist');
1215
});
1316
});

0 commit comments

Comments
 (0)