-
Notifications
You must be signed in to change notification settings - Fork 17
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 #21 from wojsmol/tov2
convert to v2
- Loading branch information
Showing
8 changed files
with
242 additions
and
49 deletions.
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,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,73 @@ | ||
sudo: false | ||
dist: trusty | ||
|
||
language: php | ||
php: 7.2 | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
env: | ||
global: | ||
- PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH" | ||
- WP_CLI_BIN_DIR="$TRAVIS_BUILD_DIR/vendor/bin" | ||
|
||
before_install: | ||
- | | ||
# Remove Xdebug for a huge performance increase: | ||
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then | ||
phpenv config-rm xdebug.ini | ||
else | ||
echo "xdebug.ini does not exist" | ||
fi | ||
- | | ||
# Raise PHP memory limit to 2048MB | ||
echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini | ||
- composer validate | ||
|
||
install: | ||
- composer install | ||
- composer prepare-tests | ||
|
||
script: | ||
- composer phpunit | ||
- composer behat | ||
|
||
jobs: | ||
include: | ||
- stage: sniff | ||
script: | ||
- composer lint | ||
- composer phpcs | ||
env: BUILD=sniff | ||
- stage: test | ||
php: 7.2 | ||
env: WP_VERSION=latest | ||
- stage: test | ||
php: 7.1 | ||
env: WP_VERSION=latest | ||
- stage: test | ||
php: 7.0 | ||
env: WP_VERSION=latest | ||
- stage: test | ||
php: 5.6 | ||
env: WP_VERSION=latest | ||
- stage: test | ||
php: 5.6 | ||
env: WP_VERSION=3.7.11 | ||
- stage: test | ||
php: 5.6 | ||
env: WP_VERSION=trunk | ||
- stage: test | ||
php: 5.4 | ||
env: WP_VERSION=latest |
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
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,24 @@ | ||
Feature: Generate cache | ||
|
||
Scenario: Manage wp-super-cache via CLI | ||
Given a WP install | ||
|
||
When I run `wp plugin install wp-super-cache` | ||
Then STDOUT should contain: | ||
""" | ||
Plugin installed successfully. | ||
""" | ||
And the wp-content/plugins/wp-super-cache directory should exist | ||
|
||
When I try `wp super-cache enable` | ||
Then STDERR should contain: | ||
""" | ||
Error: WP Super Cache needs to be enabled to use its WP-CLI commands. | ||
""" | ||
|
||
When I run `wp plugin activate wp-super-cache` | ||
And I run `wp super-cache enable` | ||
Then STDOUT should contain: | ||
""" | ||
Success: The WP Super Cache is enabled. | ||
""" |
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,61 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="WP-CLI"> | ||
<description>Custom ruleset for WP-CLI</description> | ||
|
||
<!-- For help in understanding this file: /~https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> | ||
<!-- For help in using PHPCS: /~https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> | ||
|
||
<!-- What to scan --> | ||
<file>.</file> | ||
<!-- Ignoring Files and Folders: | ||
/~https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders --> | ||
<exclude-pattern>*/.git/*</exclude-pattern> | ||
<exclude-pattern>*/ci/*</exclude-pattern> | ||
<exclude-pattern>*/features/*</exclude-pattern> | ||
<exclude-pattern>*/packages/*</exclude-pattern> | ||
<exclude-pattern>*/tests/*</exclude-pattern> | ||
<exclude-pattern>*/utils/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
|
||
<!-- How to scan --> | ||
<arg value="sp"/> <!-- Show sniff and progress --> | ||
<arg name="colors"/> <!-- Show results with colors --> | ||
<arg name="extensions" value="php"/> <!-- Limit to PHP files --> | ||
|
||
<!-- Rules: Check PHP version compatibility - see | ||
/~https://github.com/PHPCompatibility/PHPCompatibilityWP --> | ||
<rule ref="PHPCompatibilityWP"> | ||
<!-- Polyfill package is used so array_column() is available for PHP 5.4- --> | ||
<exclude name="PHPCompatibility.PHP.NewFunctions.array_columnFound"/> | ||
<!-- Both magic quotes directives set in wp-settings-cli.php to provide consistent starting point. --> | ||
<exclude name="PHPCompatibility.PHP.DeprecatedIniDirectives.magic_quotes_runtimeDeprecatedRemoved"/> | ||
<exclude name="PHPCompatibility.PHP.DeprecatedIniDirectives.magic_quotes_sybaseDeprecatedRemoved"/> | ||
</rule> | ||
|
||
<!-- For help in understanding this testVersion: | ||
/~https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions --> | ||
<config name="testVersion" value="5.4-"/> | ||
|
||
<!-- Ignore php_uname mode issue, we're conditionally providing a callback --> | ||
<rule ref="PHPCompatibility.PHP.NewFunctionParameters.php_uname_modeFound"> | ||
<exclude-pattern>*/php/commands/src/CLI_Command.php</exclude-pattern> | ||
</rule> | ||
|
||
<!-- Rules: WordPress Coding Standards - see | ||
/~https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> | ||
<rule ref="WordPress-Core"> | ||
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" /> | ||
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar" /> | ||
<exclude name="WordPress.NamingConventions.ValidVariableName.MemberNotSnakeCase" /> | ||
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCase" /> | ||
</rule> | ||
|
||
<!-- For help in understanding these custom sniff properties: | ||
/~https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties --> | ||
<rule ref="WordPress.Files.FileName"> | ||
<properties> | ||
<property name="strict_class_file_names" value="false"/> | ||
</properties> | ||
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" /> | ||
</rule> | ||
</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
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 @@ | ||
require: | ||
- wp-super-cache-cli.php |
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,15 +1,21 @@ | ||
<?php | ||
/* | ||
Plugin Name: WP Super Cache CLI | ||
Version: 1.0 | ||
Description: A CLI interface for the WP Super Cache plugin | ||
Author: WP-CLI Team | ||
Author URI: http://github.com/wp-cli | ||
Plugin URI: http://github.com/wp-cli/wp-super-cache-cli | ||
License: MIT | ||
*/ | ||
|
||
if ( defined( 'WP_CLI' ) && WP_CLI ) { | ||
require_once dirname( __FILE__ ) . '/cli.php'; | ||
|
||
$autoload = dirname( __FILE__ ) . '/vendor/autoload.php'; | ||
|
||
if ( file_exists( $autoload ) ) { | ||
require_once $autoload; | ||
} | ||
|
||
if ( ! class_exists( 'WP_CLI' ) ) { | ||
return; | ||
} | ||
|
||
WP_CLI::add_command( | ||
'super-cache', 'WP_Super_Cache_Command', array( | ||
'before_invoke' => function() { | ||
if ( ! function_exists( 'wp_super_cache_enable' ) ) { | ||
WP_CLI::error( 'WP Super Cache needs to be enabled to use its WP-CLI commands.' ); | ||
} | ||
}, | ||
) | ||
); |