Skip to content

Commit

Permalink
Merge pull request #94 from wp-cli/90-prefer-packagist
Browse files Browse the repository at this point in the history
Prefer Packagist over GitHub
  • Loading branch information
schlessera authored Aug 7, 2018
2 parents 0b0dcd1 + 2af2599 commit bcc65ae
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 115 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
],
"require": {
"ext-json": "*",
"composer/composer": ">=1.2.0 <1.7.0 || ^1.7.1",
"wp-cli/wp-cli": "^2"
},
Expand Down
90 changes: 43 additions & 47 deletions features/package-install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,10 @@ Feature: Install WP-CLI packages
Scenario: Install a package from Git using a shortened package identifier
Given an empty directory

When I run `wp package install wp-cli-test/test-command`
When I run `wp package install wp-cli-test/github-test-command`
Then STDOUT should contain:
"""
Installing package wp-cli-test/test-command (dev-master)
Installing package wp-cli-test/github-test-command (dev-master)
"""
# This path is sometimes changed on Macs to prefix with /private
And STDOUT should contain:
Expand All @@ -298,7 +298,7 @@ Feature: Install WP-CLI packages
"""
And STDOUT should contain:
"""
Registering https://github.com/wp-cli-test/test-command.git as a VCS repository...
Registering https://github.com/wp-cli-test/github-test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
Expand All @@ -308,16 +308,16 @@ Feature: Install WP-CLI packages

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| wp-cli-test/test-command | dev-master |
| name | version |
| wp-cli-test/github-test-command | dev-master |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version E.
"""

When I run `wp package uninstall wp-cli-test/test-command`
When I run `wp package uninstall wp-cli-test/github-test-command`
Then STDOUT should contain:
"""
Removing require statement from
Expand All @@ -330,18 +330,17 @@ Feature: Install WP-CLI packages
When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
wp-cli-test/test-command
wp-cli-test/github-test-command
"""

# Older releases of wp-cli-test/test-command are PHP 5.5 dependent.
@github-api @shortened @require-php-5.5
@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier with a version requirement
Given an empty directory

When I run `wp package install wp-cli-test/test-command:^0`
When I try `wp package install wp-cli-test/github-test-command:^0`
Then STDOUT should contain:
"""
Installing package wp-cli-test/test-command (^0)
Installing package wp-cli-test/github-test-command (^0)
"""
# This path is sometimes changed on Macs to prefix with /private
And STDOUT should contain:
Expand All @@ -350,7 +349,7 @@ Feature: Install WP-CLI packages
"""
And STDOUT should contain:
"""
Registering https://github.com/wp-cli-test/test-command.git as a VCS repository...
Registering https://github.com/wp-cli-test/github-test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
Expand All @@ -360,16 +359,16 @@ Feature: Install WP-CLI packages

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| wp-cli-test/test-command | v0.2.0 |
| name | version |
| wp-cli-test/github-test-command | v0.2.0 |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version C.
"""

When I run `wp package uninstall wp-cli-test/test-command`
When I run `wp package uninstall wp-cli-test/github-test-command`
Then STDOUT should contain:
"""
Removing require statement from
Expand All @@ -382,25 +381,24 @@ Feature: Install WP-CLI packages
When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
wp-cli-test/test-command
wp-cli-test/github-test-command
"""

# Older releases of wp-cli-test/test-command are PHP 5.5 dependent.
@github-api @shortened @require-php-5.5
@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier with a specific version
Given an empty directory

# Need to specify actual tag.
When I try `wp package install wp-cli-test/test-command:0.1.0`
When I try `wp package install wp-cli-test/github-test-command:0.1.0`
Then STDERR should contain:
"""
Warning: Couldn't download composer.json file from 'https://raw.githubusercontent.com/wp-cli-test/test-command/0.1.0/composer.json' (HTTP code 404).
Warning: Couldn't download composer.json file from 'https://raw.githubusercontent.com/wp-cli-test/github-test-command/0.1.0/composer.json' (HTTP code 404).
"""

When I run `wp package install wp-cli-test/test-command:v0.1.0`
When I run `wp package install wp-cli-test/github-test-command:v0.1.0`
Then STDOUT should contain:
"""
Installing package wp-cli-test/test-command (v0.1.0)
Installing package wp-cli-test/github-test-command (v0.1.0)
"""
# This path is sometimes changed on Macs to prefix with /private
And STDOUT should contain:
Expand All @@ -409,7 +407,7 @@ Feature: Install WP-CLI packages
"""
And STDOUT should contain:
"""
Registering https://github.com/wp-cli-test/test-command.git as a VCS repository...
Registering https://github.com/wp-cli-test/github-test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
Expand All @@ -419,16 +417,16 @@ Feature: Install WP-CLI packages

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| wp-cli-test/test-command | v0.1.0 |
| name | version |
| wp-cli-test/github-test-command | v0.1.0 |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version A.
"""

When I run `wp package uninstall wp-cli-test/test-command`
When I run `wp package uninstall wp-cli-test/github-test-command`
Then STDOUT should contain:
"""
Removing require statement from
Expand All @@ -441,18 +439,17 @@ Feature: Install WP-CLI packages
When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
wp-cli-test/test-command
wp-cli-test/github-test-command
"""

# Older releases of wp-cli-test/test-command are PHP 5.5 dependent.
@github-api @shortened @require-php-5.5
@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier and a specific commit hash
Given an empty directory

When I run `wp package install wp-cli-test/test-command:dev-master#e1b60d6d2af5799231ce7c84f2089c16dd845be1`
When I run `wp package install wp-cli-test/github-test-command:dev-master#bcfac95e2193e9f5f8fbd3004fab9d902a5e4de3`
Then STDOUT should contain:
"""
Installing package wp-cli-test/test-command (dev-master#e1b60d6d2af5799231ce7c84f2089c16dd845be1)
Installing package wp-cli-test/github-test-command (dev-master#bcfac95e2193e9f5f8fbd3004fab9d902a5e4de3)
"""
# This path is sometimes changed on Macs to prefix with /private
And STDOUT should contain:
Expand All @@ -461,7 +458,7 @@ Feature: Install WP-CLI packages
"""
And STDOUT should contain:
"""
Registering https://github.com/wp-cli-test/test-command.git as a VCS repository...
Registering https://github.com/wp-cli-test/github-test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
Expand All @@ -471,16 +468,16 @@ Feature: Install WP-CLI packages

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| wp-cli-test/test-command | dev-master |
| name | version |
| wp-cli-test/github-test-command | dev-master |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version B.
"""

When I run `wp package uninstall wp-cli-test/test-command`
When I run `wp package uninstall wp-cli-test/github-test-command`
Then STDOUT should contain:
"""
Removing require statement from
Expand All @@ -493,18 +490,17 @@ Feature: Install WP-CLI packages
When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
wp-cli-test/test-command
wp-cli-test/github-test-command
"""

# Older releases of wp-cli-test/test-command are PHP 5.5 dependent.
@github-api @shortened @require-php-5.5
@github-api @shortened
Scenario: Install a package from Git using a shortened package identifier and a branch
Given an empty directory

When I run `wp package install wp-cli-test/test-command:dev-custom-branch`
When I run `wp package install wp-cli-test/github-test-command:dev-custom-branch`
Then STDOUT should contain:
"""
Installing package wp-cli-test/test-command (dev-custom-branch)
Installing package wp-cli-test/github-test-command (dev-custom-branch)
"""
# This path is sometimes changed on Macs to prefix with /private
And STDOUT should contain:
Expand All @@ -513,7 +509,7 @@ Feature: Install WP-CLI packages
"""
And STDOUT should contain:
"""
Registering https://github.com/wp-cli-test/test-command.git as a VCS repository...
Registering https://github.com/wp-cli-test/github-test-command.git as a VCS repository...
Using Composer to install the package...
"""
And STDOUT should contain:
Expand All @@ -523,16 +519,16 @@ Feature: Install WP-CLI packages

When I run `wp package list --fields=name,version`
Then STDOUT should be a table containing rows:
| name | version |
| wp-cli-test/test-command | dev-custom-branch |
| name | version |
| wp-cli-test/github-test-command | dev-custom-branch |

When I run `wp test-command`
Then STDOUT should contain:
"""
Success: Version D.
"""

When I run `wp package uninstall wp-cli-test/test-command`
When I run `wp package uninstall wp-cli-test/github-test-command`
Then STDOUT should contain:
"""
Removing require statement from
Expand All @@ -545,7 +541,7 @@ Feature: Install WP-CLI packages
When I run `wp package list --fields=name`
Then STDOUT should not contain:
"""
wp-cli-test/test-command
wp-cli-test/github-test-command
"""

@github-api
Expand Down Expand Up @@ -1060,13 +1056,13 @@ Feature: Install WP-CLI packages
Then the return code should be 1
And STDERR should contain:
"""
Warning: Couldn't download composer.json file from 'https://raw.githubusercontent.com/non-existent-git-user-asdfasdf/non-existent-git-repo-asdfasdf/master/composer.json' (HTTP code 404). Presuming package name is 'non-existent-git-repo-asdfasdf'.
Warning: Couldn't download composer.json file from 'https://raw.githubusercontent.com/non-existent-git-user-asdfasdf/non-existent-git-repo-asdfasdf/master/composer.json' (HTTP code 404). Presuming package name is 'non-existent-git-user-asdfasdf/non-existent-git-repo-asdfasdf'.
"""

When I try `wp package install https://github.com/wp-cli-tests/private-repository.git`
Then STDERR should contain:
"""
Warning: Couldn't download composer.json file from 'https://raw.githubusercontent.com/wp-cli-tests/private-repository/master/composer.json' (HTTP code 404). Presuming package name is 'private-repository'.
Warning: Couldn't download composer.json file from 'https://raw.githubusercontent.com/wp-cli-tests/private-repository/master/composer.json' (HTTP code 404). Presuming package name is 'wp-cli-tests/private-repository'.
"""

When I try `wp package install non-existent-git-user-asdfasdf/non-existent-git-repo-asdfasdf`
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<phpunit
bootstrap="tests/bootstrap.php"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
Expand Down
Loading

0 comments on commit bcc65ae

Please sign in to comment.