-
Notifications
You must be signed in to change notification settings - Fork 10
Allow GravityFormsCLI to be Installed by Packagist #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+148
−97
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d6a2e15
initial changes from #47 & #48
ibd21 8cd5163
Add all available commands; fix spacing
SherifMesallam 3146ab3
Fix formatting
SherifMesallam ce68b06
Update required WP CLI version in readme
SherifMesallam 37bc032
Cleaner early return
SherifMesallam b037017
formatting
SherifMesallam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,101 +2,108 @@ | |
|
|
||
| defined( 'ABSPATH' ) || defined( 'WP_CLI' ) || die(); | ||
|
|
||
| // Include the Gravity Forms add-on framework | ||
| GFForms::include_addon_framework(); | ||
| // Include the Gravity Forms add-on framework, if available. | ||
| // When running as a standalone WP-CLI package, GFForms is not loaded. | ||
| if ( class_exists('GFForms' ) ) { | ||
| GFForms::include_addon_framework(); | ||
| } | ||
|
|
||
| if ( ! class_exists( 'GFAddOn' ) ) { | ||
| return; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a cleaner exit instead of wrapping the whole class into the check. |
||
|
|
||
| class GF_CLI extends GFAddOn { | ||
| /** | ||
| * Contains an instance of this class, if available. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access private | ||
| * @var object $_instance If available, contains an instance of this class | ||
| */ | ||
| private static $_instance = null; | ||
| /** | ||
| * Contains an instance of this class, if available. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access private | ||
| * @var object $_instance If available, contains an instance of this class | ||
| */ | ||
| private static $_instance = null; | ||
|
|
||
| /** | ||
| * Defines the version of the WP-CLI add-on. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_version Contains the version, defined from cli.php | ||
| */ | ||
| protected $_version = GF_CLI_VERSION; | ||
| /** | ||
| * Defines the minimum Gravity Forms version required. | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_min_gravityforms_version The minimum version required. | ||
| */ | ||
| protected $_min_gravityforms_version = GF_CLI_MIN_GF_VERSION; | ||
| /** | ||
| * Defines the plugin slug. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_slug The slug used for this plugin. | ||
| */ | ||
| protected $_slug = 'gravityformscli'; | ||
| /** | ||
| * Defines the main plugin file. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_path The path to the main plugin file, relative to the plugins folder. | ||
| */ | ||
| protected $_path = 'gravityformscli/cli.php'; | ||
| /** | ||
| * Defines the full path to this class file. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_full_path The full path. | ||
| */ | ||
| protected $_full_path = __FILE__; | ||
| /** | ||
| * Defines the URL where this add-on can be found. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string | ||
| */ | ||
| protected $_url = 'http://www.gravityforms.com'; | ||
| /** | ||
| * Defines the title of this add-on. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_title The title of the add-on. | ||
| */ | ||
| protected $_title = 'Gravity Forms CLI Add-On'; | ||
| /** | ||
| * Defines the short title of the add-on. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_short_title The short title. | ||
| */ | ||
| protected $_short_title = 'CLI'; | ||
| /** | ||
| * Defines the version of the WP-CLI add-on. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_version Contains the version, defined from cli.php | ||
| */ | ||
| protected $_version = GF_CLI_VERSION; | ||
| /** | ||
| * Defines the minimum Gravity Forms version required. | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_min_gravityforms_version The minimum version required. | ||
| */ | ||
| protected $_min_gravityforms_version = GF_CLI_MIN_GF_VERSION; | ||
| /** | ||
| * Defines the plugin slug. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_slug The slug used for this plugin. | ||
| */ | ||
| protected $_slug = 'gravityformscli'; | ||
| /** | ||
| * Defines the main plugin file. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_path The path to the main plugin file, relative to the plugins folder. | ||
| */ | ||
| protected $_path = 'gravityformscli/cli.php'; | ||
| /** | ||
| * Defines the full path to this class file. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_full_path The full path. | ||
| */ | ||
| protected $_full_path = __FILE__; | ||
| /** | ||
| * Defines the URL where this add-on can be found. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string | ||
| */ | ||
| protected $_url = 'http://www.gravityforms.com'; | ||
| /** | ||
| * Defines the title of this add-on. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_title The title of the add-on. | ||
| */ | ||
| protected $_title = 'Gravity Forms CLI Add-On'; | ||
| /** | ||
| * Defines the short title of the add-on. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access protected | ||
| * @var string $_short_title The short title. | ||
| */ | ||
| protected $_short_title = 'CLI'; | ||
|
|
||
| /** | ||
| * Returns an instance of this class, and stores it in the $_instance property. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access public | ||
| * @static | ||
| * @return object $_instance An instance of the GF_CLI class | ||
| */ | ||
| public static function get_instance() { | ||
| if ( self::$_instance == null ) { | ||
| self::$_instance = new GF_CLI(); | ||
| } | ||
| /** | ||
| * Returns an instance of this class, and stores it in the $_instance property. | ||
| * | ||
| * @since 1.0-beta-1 | ||
| * @access public | ||
| * @static | ||
| * @return object $_instance An instance of the GF_CLI class | ||
| */ | ||
| public static function get_instance() { | ||
| if ( self::$_instance == null ) { | ||
| self::$_instance = new GF_CLI(); | ||
| } | ||
|
|
||
| return self::$_instance; | ||
| } | ||
| return self::$_instance; | ||
| } | ||
|
|
||
| private function __clone() { | ||
| } /* do nothing */ | ||
| private function __clone() { | ||
| } /* do nothing */ | ||
|
|
||
| } | ||
|
|
||
|
|
||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -2,11 +2,17 @@ | |
| "name": "gravityforms/gravityformscli", | ||
| "description": "A set of WP-CLI commands to manage Gravity Forms.", | ||
| "type": "wp-cli-package", | ||
| "keywords": [ | ||
| "wp-cli", | ||
| "gravityforms", | ||
| "cli", | ||
| "wordpress" | ||
| ], | ||
| "homepage": "https://github.com/gravityforms/gravityformscli", | ||
| "support": { | ||
| "issues": "https://gravityforms.com" | ||
| }, | ||
| "license": "GPLv3", | ||
| "license": "GPL-3.0-or-later", | ||
| "authors": [ | ||
| { | ||
| "name": "Rocketgenius", | ||
|
|
@@ -15,9 +21,24 @@ | |
| } | ||
| ], | ||
| "require": { | ||
| "php": ">=5.3.29" | ||
| "php": ">=5.6", | ||
| "wp-cli/wp-cli": "^2.5" | ||
| }, | ||
| "autoload": { | ||
| "files": [ "cli.php" ] | ||
| }, | ||
| "extra": { | ||
| "commands": [ | ||
| "gf", | ||
| "gf form", | ||
| "gf form notification", | ||
| "gf form field", | ||
| "gf notification", | ||
| "gf field", | ||
| "gf entry", | ||
| "gf entry notification", | ||
| "gf license", | ||
| "gf tool" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add all the commands that are actually registered in cli.php |
||
| ] | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need this as a minimum now