Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jflearn committed May 20, 2023
2 parents 5752513 + 4c3de62 commit 6ec7f88
Show file tree
Hide file tree
Showing 17 changed files with 308 additions and 94 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Continuous Integration"

on:
- pull_request
- push

jobs:

tests:
strategy:
fail-fast: false
matrix:
include:
- operating-system: 'ubuntu-latest'
php-version: '8.2'
- operating-system: 'ubuntu-latest'
php-version: '8.1'
- operating-system: 'ubuntu-latest'
php-version: '8.0'
- operating-system: 'ubuntu-latest'
php-version: '7.4'

name: PHP ${{ matrix.php-version }}
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php-version }}
php_extensions: intl
- run: |
./vendor/bin/phpunit -c phpunit.xml.dist \
--coverage-clover ./coverage.xml
39 changes: 39 additions & 0 deletions .github/workflows/t.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Annotate & Tidy"

on:
push:
branches:
- "feature/*"
- "release/*"
- "develop"

jobs:

tidy:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
php_extensions: xdebug intl
- name: Generate Code Coverage
run: |
XDEBUG_MODE=coverage \
./vendor/bin/phpunit -c phpunit.xml.dist \
--coverage-clover ./coverage.xml
- name: Annotate with Metrics
run: |
find src -name "*.php" | xargs ./vendor/bin/metrics annotate ./coverage.xml
- name: Tidy Source Code
run: |
find tests -name "*.php" | xargs ./vendor/bin/phptidy.php replace
find src -name "*.php" | xargs ./vendor/bin/phptidy.php replace
- name: Push Back Changes
run: |
git diff --exit-code src tests || ( \
git config user.name github-actions && \
git config user.email github-actions@github.com && \
git add src && git add tests && \
git commit -m "tidy" && \
git push \
)
20 changes: 20 additions & 0 deletions .github/workflows/v.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Github Autorelease"

on:
push:
tags:
- "v*"

jobs:

release:
name: "Create Release"
runs-on: "ubuntu-latest"

steps:
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false


12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
vendor
/app
/vendor
/resources
/assets
composer.lock
resources
run
app
assets
*.cache
*.bak
*~
9 changes: 9 additions & 0 deletions .phptidy-config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

$add_operator_space = true;
$fix_round_bracket_space = true;
$add_file_docblock = true;
$add_function_docblocks = true;
$add_doctags = true;
$fix_docblock_format = true;
$fix_docblock_space = true;
9 changes: 0 additions & 9 deletions .scrutinizer.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# silverstripe-rolluppage

[![Build Status](https://travis-ci.org/logicbrush/silverstripe-rolluppage.svg?branch=master)](https://travis-ci.org/logicbrush/silverstripe-rolluppage)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/logicbrush/silverstripe-rolluppage/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/logicbrush/silverstripe-rolluppage/?branch=master)
[![codecov.io](https://codecov.io/github/logicbrush/silverstripe-rolluppage/coverage.svg?branch=master)](https://codecov.io/github/logicbrush/silverstripe-rolluppage?branch=master)

A fairly simple module for the SilverStripe CMS which rolls up the contents of
child pages for display on a single page.

Expand Down
13 changes: 11 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"email": "jflearn@logicbrush.com"
}],
"require": {
"php": ">=7.2.0",
"php": "^7.4||^8.0",
"silverstripe/cms": "^4.0"
},
"extra": {
Expand All @@ -24,7 +24,10 @@
]
},
"require-dev": {
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^9.5",
"silverstripe/sqlite3": "^2.2",
"logicbrush/metrics": "^0.2.0",
"cmrcx/phptidy": "^3.3"
},
"autoload": {
"psr-4": {
Expand All @@ -35,5 +38,11 @@
"psr-4": {
"Logicbrush\\RollupPage\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"composer/installers": true,
"silverstripe/vendor-plugin": true
}
}
}
37 changes: 25 additions & 12 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
</whitelist>
</filter>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">tests/</directory>
</exclude>
<report>
<clover outputFile="clover.xml"/>
</report>
</coverage>
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<logging/>
<php>
<includePath>app/code</includePath>
<env name="SS_DATABASE_CLASS" value="SQLite3Database"/>
<env name="SS_SQLITE_DATABASE_PATH" value=":memory:"/>
<env name="SS_DATABASE_NAME" value="testing"/>
<env name="SS_DATABASE_USERNAME" value=""/>
<env name="SS_DATABASE_PASSWORD" value=""/>
</php>
</phpunit>
15 changes: 15 additions & 0 deletions src/Controllers/RollupPageController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?php
/**
* src/Controllers/RollupPageController.php
*
* @package default
*/


namespace Logicbrush\RollupPage\Controllers;

Expand All @@ -8,6 +14,10 @@

class RollupPageController extends PageController
{

/**
*
*/
public function init() {
parent::init();

Expand All @@ -22,6 +32,11 @@ public function init() {
}
}


/**
*
* @return unknown
*/
public function index() {
// return composite.
return [
Expand Down
39 changes: 36 additions & 3 deletions src/Model/RollupPage.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?php
/**
* src/Model/RollupPage.php
*
* @package default
*/


namespace Logicbrush\RollupPage\Model;

Expand Down Expand Up @@ -30,18 +36,25 @@ class RollupPage extends Page

/**
* Set this to true to disable automatic inclusion of CSS files
*
* @config
* @var bool
*/
private static $block_default_rollup_page_css = false;

/**
* Set this to true to disable automatic inclusion of Javascript files
*
* @config
* @var bool
*/
private static $block_default_rollup_page_js = false;

/**
*
* @Metrics( crap = 1 )
* @return unknown
*/
public function getCMSFields() {
$fields = parent::getCMSFields();

Expand All @@ -63,6 +76,11 @@ public function getCMSFields() {
}


/**
*
* @Metrics( crap = 2 )
* @return unknown
*/
public function Children() {
if ( $this->ShowLinksOnly !== 1 ) {
return ArrayList::create();
Expand All @@ -73,11 +91,21 @@ public function Children() {
}


/**
*
* @Metrics( crap = 1 )
* @return unknown
*/
public function getRollupPageDisplayType() {
return self::ROLLUP_PAGE_DISPLAY_TYPE[$this->ShowLinksOnly];
}


/**
*
* @Metrics( crap = 21 )
* @return unknown
*/
public function Content() {
// original content.
$content = $this->Content;
Expand Down Expand Up @@ -110,7 +138,7 @@ public function Content() {
$childContent = $child->hasMethod( 'Content' ) ? $child->Content() : $child->Content;
if ( $childContent ) {

if ($this->ShowLinksOnly > 0) {
if ( $this->ShowLinksOnly > 0 ) {
$content .= '<div class="rollup-page-content' . ( $index === 0 ? ' active' : '' ) . '" id="rollup-page-content-' . $child->URLSegment . '">';
}

Expand All @@ -121,7 +149,7 @@ public function Content() {
$content .= $child->BeforeRollup();
}

if ($this->ShowLinksOnly != self::DISPLAY_TABS) {
if ( $this->ShowLinksOnly != self::DISPLAY_TABS ) {
// For tabs, the display of the header is redundant.
$content .= '<h2><a name="' . $child->URLSegment . '"></a>' . $child->Title . '</h2>';
}
Expand All @@ -132,7 +160,7 @@ public function Content() {
$content .= $child->AfterRollup();
}

if ($this->ShowLinksOnly > 0) {
if ( $this->ShowLinksOnly > 0 ) {
$content .= '</div>';
}
}
Expand All @@ -144,6 +172,11 @@ public function Content() {
}


/**
*
* @Metrics( crap = 1 )
* @return unknown
*/
public function getControllerName() {
return RollupPageController::class;
}
Expand Down
Loading

0 comments on commit 6ec7f88

Please sign in to comment.