From a7140bb4e74fc7d3be3ada096cae937aa22abe58 Mon Sep 17 00:00:00 2001 From: Marcel Dillen Date: Mon, 5 Dec 2016 09:21:45 +0100 Subject: [PATCH 1/4] Add readme.txt to gitignore and remove --- .gitignore | 1 + readme.txt | 113 ----------------------------------------------------- 2 files changed, 1 insertion(+), 113 deletions(-) delete mode 100644 readme.txt diff --git a/.gitignore b/.gitignore index 869bb15..f52e68c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor/ /features/bootstrap/test_exports/ /wordpress/ +readme.txt diff --git a/readme.txt b/readme.txt deleted file mode 100644 index bad9dd4..0000000 --- a/readme.txt +++ /dev/null @@ -1,113 +0,0 @@ -=== Advanced Custom Fields WP-CLI === -Contributors: sebastiaandegeus -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. - -= Reasons to start this project = - -* Advanced custom fields did not interface with WP-CLI -* Sharing field-groups through XML or PHP code caused problems with differences between development, test, staging and production enviroments when shared with XML. -* No direct SVN or GIT support without manually putting the exported PHP or XML into a versioned directory. -* Naming convention for XML files was always the same, resulting in renaming hassle. -* Only using the generated field-groups on runtime through PHP code in functions.php disables the editing mode (which is an awesome UI that we require). So importing should be possible. -== Installation == - -= Requirements = - -* Advanced Custom Fields 5 Pro plugin -* `wp-cli` http://wp-cli.org/ - -= How to install = - -Install WP-CLI as described on [their website](http://wp-cli.org/ "WP-CLI") - -Clone this repo to your plugins directory -``` -git clone https://github.com/hoppinger/advanced-custom-fields-wpcli.git -``` -* Activate this plugin in the plugin menu or using: -``` -wp plugin activate advanced-custom-fields-wpcli -``` - -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'); -``` -== 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. - -**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; -} -```` -== 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 = -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: -``` -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. From 94ab75a324cbcc943a1530143670e9e23a4f48fe Mon Sep 17 00:00:00 2001 From: Marcel Dillen Date: Mon, 5 Dec 2016 10:16:33 +0100 Subject: [PATCH 2/4] Add changelog and description to the readme.txt --- README.md | 2 +- bin/generate_readme.php | 11 ++++++++++- readme/description.txt | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aaed65c..32cc143 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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/bin/generate_readme.php b/bin/generate_readme.php index db968f8..dc29166 100644 --- a/bin/generate_readme.php +++ b/bin/generate_readme.php @@ -1,7 +1,15 @@ Date: Mon, 5 Dec 2016 11:19:07 +0100 Subject: [PATCH 3/4] Change codeblocks for wordpress --- README.md | 5 +++-- bin/generate_readme.php | 9 +++++++++ readme/command.txt | 21 +++++++++++---------- readme/filters.txt | 4 ++-- readme/installation.txt | 16 ++++++++-------- readme/unitTest.txt | 16 ++++++++-------- 6 files changed, 41 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 32cc143..c379559 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,11 @@ This project adds the `acf` command to `wp-cli` with the following subcommands: wp acf ``` Prints the help overview and can be used as a default test to see if the plugin is working. -``` + ### 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: @@ -104,7 +105,7 @@ public function add_plugin_path( $paths ) { $paths['my_plugin'] = MY_PLUGIN_ROOT . '/lib/field-groups/'; return $paths; } -```` +``` ## Unit testing diff --git a/bin/generate_readme.php b/bin/generate_readme.php index dc29166..2fa2730 100644 --- a/bin/generate_readme.php +++ b/bin/generate_readme.php @@ -24,9 +24,18 @@ $wordpress_readme = combine_parts($wp_readme_parts); $github_readme = txt_to_md(combine_parts($github_readme_parts)); +$github_readme = replace_codeblocks($github_readme); + create_readme("readme.txt", $wordpress_readme); create_readme("readme.md", $github_readme); +function replace_codeblocks($readme) { + $readme = str_replace('
', '```', $readme);
+  $readme =  str_replace('
', '```', $readme); + + return $readme; +} + function combine_parts($parts) { $output = ''; diff --git a/readme/command.txt b/readme/command.txt index 19b26ee..0bd00a7 100644 --- a/readme/command.txt +++ b/readme/command.txt @@ -3,30 +3,31 @@ 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 = +

 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: -``` +

 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/filters.txt b/readme/filters.txt index e6ebec3..e2e2c4c 100644 --- a/readme/filters.txt +++ b/readme/filters.txt @@ -7,11 +7,11 @@ 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 e8ca346..4834d2f 100644 --- a/readme/installation.txt +++ b/readme/installation.txt @@ -10,22 +10,22 @@ Install WP-CLI as described on [their website](http://wp-cli.org/ "WP-CLI") Clone this repo to your plugins directory -``` +

 git clone https://github.com/hoppinger/advanced-custom-fields-wpcli.git
-```
+
* Activate this plugin in the plugin menu or using: -``` +

 wp plugin activate advanced-custom-fields-wpcli
-```
+
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. From b20808129ca018f473c025ae99dfa42243d15c57 Mon Sep 17 00:00:00 2001 From: Marcel Dillen Date: Mon, 5 Dec 2016 11:20:53 +0100 Subject: [PATCH 4/4] Fix in readme --- README.md | 2 +- readme/installation.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c379559..fcd9fc0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Fields can now easily be imported, exported and shared over SVN, GIT or comparab ### Requirements * Advanced Custom Fields 5 Pro plugin -* `wp-cli` http://wp-cli.org/ +* wp-cli http://wp-cli.org/ ### How to install diff --git a/readme/installation.txt b/readme/installation.txt index 4834d2f..157a925 100644 --- a/readme/installation.txt +++ b/readme/installation.txt @@ -3,7 +3,7 @@ = Requirements = * Advanced Custom Fields 5 Pro plugin -* `wp-cli` http://wp-cli.org/ +* wp-cli http://wp-cli.org/ = How to install =