Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Prepare composer compatibility#41

Merged
coderkevin merged 6 commits intomasterfrom
add/composer-json
Aug 11, 2017
Merged

Prepare composer compatibility#41
coderkevin merged 6 commits intomasterfrom
add/composer-json

Conversation

@coderkevin
Copy link
Contributor

@coderkevin coderkevin commented Aug 11, 2017

This prepares wc-api-dev to be used by a composer install:

  1. Removes the auto-update as it has been unreliable.
  2. Adds composer.json for autoload
  3. Add check for existing install to avoid conflicts with installed version of plugin

To Test:

  1. Download this version in zip form: https://github.com/woocommerce/wc-api-dev/archive/add/composer-json.zip
  2. Delete existing wc-api-dev from test site.
  3. Install downloaded version
  4. Verify normal operation

The composer functionality will have to be tested from the code that installs it, which will have to come after this is merged.

This adds a composer.json so this plugin can be installed via composer.
1. Remove auto-update as it's no longer needed.
2. Add check to see if classes have already been defined
(this only happens in the transitionary period where the previously
installed instance of the plugin exists before it's deleted by wpcomsh)
There's a transitionary state that is possible.
This guards against it.

Also, it removes the rest of the auto updating code.
Because the plugin class can still be loaded by the existing installed
plugin, and there's no way to tell which way it was loaded, the main
plugin class is now moved to a separate file that is dynamically loaded
only after making sure it hasn't already been loaded by the previously
installed plugin.
This updates the versions everywhere from 0.8.3 to 0.8.4
It leaves the stable version at 0.8.3 for now.
And updates the readme
Copy link
Contributor

@allendav allendav Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant The WooCommerce plugin is inactive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks like it's been this way for a while. Good catch!

composer.json Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version does not follow the composer.json schema https://getcomposer.org/doc/04-schema.md#version because of the . between v and the major.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

@@ -0,0 +1,7 @@
{
"name": "woocommerce/wc-api-dev",
Copy link
Contributor

@allendav allendav Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The composer.json schema recommends avoiding non alphanumeric characters in the name https://getcomposer.org/doc/04-schema.md#name (and yet their example shows dashes so 🤷 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there are dashes in the others here: https://github.com/Automattic/wpcomsh/blob/master/composer.json

I'm not worried about it, but thanks for being thorough!

Copy link
Contributor

@allendav allendav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests well. A couple small things to look at. Pre-approving.

1. Fixed version format.
2. Fixed type on error notification
@coderkevin
Copy link
Contributor Author

Thanks, Allen!

@coderkevin coderkevin merged commit 6f923bb into master Aug 11, 2017
@coderkevin coderkevin deleted the add/composer-json branch August 31, 2017 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments