diff --git a/.gitignore b/.gitignore index b95b1cd..f52e68c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /vendor/ /features/bootstrap/test_exports/ /wordpress/ -readme.txt \ No newline at end of file +readme.txt diff --git a/README.md b/README.md index 078d684..92d6b32 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,35 @@ -# WP-CLI for Advanced Custom Fields +# WP-CLI for Advanced Custom Fields -### Description +## Description WP-CLI for Advanced Custom Fields helps you manage your field-groups through WP-CLI. The reason we started this project is to make life easier for developers working on Wordpress projects using the Advanced Custom Fields Pro plugin. Fields can now easily be imported, exported and shared over SVN, GIT or comparable systems. -## Installation +## Installation -### Requirements +### Requirements * Advanced Custom Fields 5 Pro plugin -* `wp-cli` http://wp-cli.org/ +* wp-cli http://wp-cli.org/ -### How to install +### How to install -Install WP-CLI as described on [http://wp-cli.org/](http://wp-cli.org/ "WP-CLI") +Install WP-CLI as described on [their website](http://wp-cli.org/ "WP-CLI") -Using composer: -``` -composer require wpackagist-plugin/advanced-custom-fields-wpcli -``` - -By GIT clone in plugins directory: +Clone this repo to your plugins directory ``` git clone https://github.com/hoppinger/advanced-custom-fields-wpcli.git ``` - -WordPress plugin installation: -Download zip and put the files in the plugins directory. - -* Activate this plugin in the plugin menu or using: +* Activate this plugin in the plugin menu or by using: ``` wp plugin activate advanced-custom-fields-wpcli ``` -Go the wordpress directory in your terminal and run: +Go the wordpress directory in your terminal and try out to: ``` wp acf ``` @@ -50,40 +41,38 @@ If you would like to disable this behaviour you can remove the `acf_wpcli_regist remove_action('plugins_loaded', 'acf_wpcli_register_groups'); ``` -## Commands +## Commands This project adds the `acf` command to `wp-cli` with the following subcommands: -### Help +### Help ``` wp acf ``` Prints the help overview and can be used as a default test to see if the plugin is working. - -### Export - -Export a field-group to a json file in the directory set by a filter. +### Export ``` wp acf export ``` +Export a field-group to a json file in the directory set by a filter. You want to export all field-groups all at once you can use: -You want to export all field-groups all at once you can use: +If you want to export all field-groups all at once you can use: ``` wp acf export --all ``` -### Import +### Import ``` wp acf import ``` Import all or specific fields from a option menu, -### Clean +### Clean ``` wp acf clean ``` @@ -91,14 +80,16 @@ Delete all Advanced Custom Fields Records from the database. Do this after you have edited fields-groups from the UI and exported the changes. **Warning: This can not be undone, please use carefully** -## Filters +## Filters -### acfwpcli_fieldgroup_paths +### acfwpcli_fieldgroup_paths The acfwpcli_fieldgroup_paths gives you the ability to add more paths where ACF-CLI should load/export from/to. You should always add at least one path to this filter. + +**Example:** ``` add_filter( 'acfwpcli_fieldgroup_paths', 'add_plugin_path' ); @@ -106,9 +97,9 @@ public function add_plugin_path( $paths ) { $paths['my_plugin'] = MY_PLUGIN_ROOT . '/lib/field-groups/'; return $paths; } -```` +``` -## Unit testing +## Unit testing To test changes to the plugin you can use unit testing. Start by making sure all the necessary dependencies are installed, if not run: ``` @@ -137,10 +128,10 @@ vendor/bin/behat features/testname.feature If you need a different test you can create your own by added it to the features in the features folder. -## Upgrade Notice +## Upgrade Notice -### 3.0 +### 3.0 * Make sure you import all your custom fields before updating. * Make sure you are you using ACF5, ACF4 is not supported. * Update the plugin @@ -148,15 +139,15 @@ If you need a different test you can create your own by added it to the features * Export you fields * Remove unnecessary files like your old import directory, php files and json files. -## Changelog +## Changelog -### 3.0 +### 3.0 * Bugfix: Import no longer created duplicates * Add unit testing with behat and PHPUnit -### 2.0 +### 2.0 * Removed uniqid feature (no longer needed). * Bugfix: database fieldgroups are now prefered over exported fieldgroups. * Cleaned up legacy xml import/export libraries. diff --git a/bin/generate_readme.php b/bin/generate_readme.php index db968f8..2fa2730 100644 --- a/bin/generate_readme.php +++ b/bin/generate_readme.php @@ -1,7 +1,15 @@ ', '```', $readme); + $readme = str_replace('', '```', $readme); + + return $readme; +} + function combine_parts($parts) { $output = ''; @@ -35,4 +52,5 @@ function txt_to_md($readme) { function create_readme($filename, $content) { file_put_contents ( $filename , $content ); + echo "{$filename} created! \n"; } diff --git a/readme.txt b/readme.txt deleted file mode 100644 index df1c5d9..0000000 --- a/readme.txt +++ /dev/null @@ -1,116 +0,0 @@ -=== Advanced Custom Fields WP-CLI === -Contributors: sebastiaandegeus, marceldillen -Tags: WP-CLI, Advanced, Custom Fields, acf -Requires at least: 4.5 -Stable tag: 3.0 -Tested up to: 4.6.1 -License: MIT - -Manage Advanced Custom Fields through WP-CLI -=== WP-CLI for Advanced Custom Fields === - -= Description = - -WP-CLI for Advanced Custom Fields helps you manage your field-groups through WP-CLI. -The reason we started this project is to make life easier for developers working on Wordpress projects using the Advanced Custom Fields Pro plugin. -Fields can now easily be imported, exported and shared over SVN, GIT or comparable systems. -== Installation == - -= Requirements = - -* Advanced Custom Fields 5 Pro plugin -* `wp-cli` http://wp-cli.org/ - -= How to install = - -Install WP-CLI as described on [http://wp-cli.org/](http://wp-cli.org/ "WP-CLI") - -Using composer: -``` -composer require wpackagist-plugin/advanced-custom-fields-wpcli -``` - -By GIT clone in plugins directory: -``` -git clone https://github.com/hoppinger/advanced-custom-fields-wpcli.git -``` - -WordPress plugin installation: -Download zip and put the files in the plugins directory. - -* Activate this plugin in the plugin menu or using: -``` -wp plugin activate advanced-custom-fields-wpcli -``` - -Go the wordpress directory in your terminal and run: -``` -wp acf -``` -To see if everything is working correctly. - -When the plugin is enabled, any exported field groups found on the filesystem in your registered paths will be added to Wordpress at runtime. -If you would like to disable this behaviour you can remove the `acf_wpcli_register_groups` action: -``` -remove_action('plugins_loaded', 'acf_wpcli_register_groups'); -``` -== Filters == - -= acfwpcli_fieldgroup_paths = - -The acfwpcli_fieldgroup_paths gives you the ability to add more paths where ACF-CLI should load/export from/to. -You should always add at least one path to this filter. - -``` -add_filter( 'acfwpcli_fieldgroup_paths', 'add_plugin_path' ); - -public function add_plugin_path( $paths ) { - $paths['my_plugin'] = MY_PLUGIN_ROOT . '/lib/field-groups/'; - return $paths; -} -```` -== Commands == - -This project adds the `acf` command to `wp-cli` with the following subcommands: - -= Help = -``` -wp acf -``` -Prints the help overview and can be used as a default test to see if the plugin is working. - - -= Export = - -Export a field-group to a json file in the directory set by a filter. -``` -wp acf export -``` - -You want to export all field-groups all at once you can use: -``` -wp acf export --all -``` - -= Import = -``` -wp acf import -``` -Import all or specific fields from a option menu, - -= Clean = -``` -wp acf clean -``` -Delete all Advanced Custom Fields Records from the database. -Do this after you have edited fields-groups from the UI and exported the changes. -**Warning: This can not be undone, please use carefully** -== Upgrade Notice == - -= 3.0 = -* Make sure you import all your custom fields before updating. -* Make sure you are you using ACF5, ACF4 is not supported. -* Update the plugin -* Add the filter to your project (See Filters) -* Export you fields -* Remove unnecessary files like your old import directory, php files and json files. diff --git a/readme/command.txt b/readme/command.txt index 3a21c3d..b600f06 100644 --- a/readme/command.txt +++ b/readme/command.txt @@ -3,34 +3,32 @@ This project adds the `acf` command to `wp-cli` with the following subcommands: = Help = -``` +

 wp acf
-```
+
Prints the help overview and can be used as a default test to see if the plugin is working. - = Export = - -Export a field-group to a json file in the directory set by a filter. -``` +

 wp acf export
-```
+
+Export a field-group to a json file in the directory set by a filter. You want to export all field-groups all at once you can use: -You want to export all field-groups all at once you can use: -``` +If you want to export all field-groups all at once you can use: +

 wp acf export --all
-```
+
= Import = -``` +

 wp acf import
-```
+
Import all or specific fields from a option menu, = Clean = -``` +

 wp acf clean
-```
+
Delete all Advanced Custom Fields Records from the database. Do this after you have edited fields-groups from the UI and exported the changes. **Warning: This can not be undone, please use carefully** diff --git a/readme/description.txt b/readme/description.txt index f8fbf22..8d8b9c8 100644 --- a/readme/description.txt +++ b/readme/description.txt @@ -1,6 +1,6 @@ === WP-CLI for Advanced Custom Fields === -= Description = +== Description == WP-CLI for Advanced Custom Fields helps you manage your field-groups through WP-CLI. The reason we started this project is to make life easier for developers working on Wordpress projects using the Advanced Custom Fields Pro plugin. diff --git a/readme/filters.txt b/readme/filters.txt index c65e01d..2929ec7 100644 --- a/readme/filters.txt +++ b/readme/filters.txt @@ -5,11 +5,13 @@ The acfwpcli_fieldgroup_paths gives you the ability to add more paths where ACF-CLI should load/export from/to. You should always add at least one path to this filter. -``` + +**Example:** +

 add_filter( 'acfwpcli_fieldgroup_paths', 'add_plugin_path' );
 
 public function add_plugin_path( $paths ) {
   $paths['my_plugin'] = MY_PLUGIN_ROOT . '/lib/field-groups/';
   return $paths;
 }
-````
+
diff --git a/readme/installation.txt b/readme/installation.txt index e734823..95bd5c1 100644 --- a/readme/installation.txt +++ b/readme/installation.txt @@ -3,38 +3,29 @@ = Requirements = * Advanced Custom Fields 5 Pro plugin -* `wp-cli` http://wp-cli.org/ +* wp-cli http://wp-cli.org/ = How to install = -Install WP-CLI as described on [http://wp-cli.org/](http://wp-cli.org/ "WP-CLI") +Install WP-CLI as described on [their website](http://wp-cli.org/ "WP-CLI") -Using composer: -``` -composer require wpackagist-plugin/advanced-custom-fields-wpcli -``` - -By GIT clone in plugins directory: -``` +Clone this repo to your plugins directory +

 git clone https://github.com/hoppinger/advanced-custom-fields-wpcli.git
-```
-
-WordPress plugin installation:
-Download zip and put the files in the plugins directory.
-
-* Activate this plugin in the plugin menu or using:
-```
+
+* Activate this plugin in the plugin menu or by using: +

 wp plugin activate advanced-custom-fields-wpcli
-```
+
-Go the wordpress directory in your terminal and run: -``` +Go the wordpress directory in your terminal and try out to: +

 wp acf
-```
+
To see if everything is working correctly. When the plugin is enabled, any exported field groups found on the filesystem in your registered paths will be added to Wordpress at runtime. If you would like to disable this behaviour you can remove the `acf_wpcli_register_groups` action: -``` +

 remove_action('plugins_loaded', 'acf_wpcli_register_groups');
-```
+
diff --git a/readme/unitTest.txt b/readme/unitTest.txt index 5620427..a7d8eae 100644 --- a/readme/unitTest.txt +++ b/readme/unitTest.txt @@ -1,28 +1,28 @@ == Unit testing == To test changes to the plugin you can use unit testing. Start by making sure all the necessary dependencies are installed, if not run: -``` +

 composer install
-```
+
You will need a new Wordpress installation to make sure the tests run independent from your Wordpress installation and database. To create a wordpress installation for testing run the following command: -``` +

 bash bin/test_wp_install.sh wordpress_test db_username db_password localhost latest
-```
+
Where 'wordpress_test' is the name for the database used to run the tests. Make sure this database doesn't exist or can be deleted. When the database already exists the script will ask you if the database can be deleted. 'Latest' can be changed if you want to test with a specific version of Wordpress, 3.6.2 for example. After you installed you can start running tests using the follow command: -``` +

 vendor/bin/behat
-```
+
This will run all test. These tests include an import and export of all types of fields, cleaning, multiple fields in one field-group and tests for the menu options. If you want to run one specific test you can do this by running: -``` +

 vendor/bin/behat features/testname.feature
-```
+
If you need a different test you can create your own by added it to the features in the features folder.