Skip to content

Commit

Permalink
Update dependency installer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Hemberger committed Nov 13, 2019
1 parent f7e3296 commit 7ea44dd
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 43 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"afragen/wp-dependency-installer": "^1.4"
"afragen/wp-dependency-installer": "^2"
}
}
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions vendor/afragen/wp-dependency-installer/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# WP Dependency Installer
* Contributors: [Andy Fragen](https://github.com/afragen), [Matt Gibbs](https://github.com/mgibbs189), [contributors](https://github.com/afragen/wp-dependency-installer/graphs/contributors)
* Tags: plugin, dependency, install
* Requires at least: 3.8
* Requires PHP: 5.3
* Requires at least: 5.1
* Requires PHP: 5.6
* Stable tag: master
* Donate link: <https://thefragens.com/wp-dependency-installer-donate>
* License: MIT
Expand All @@ -17,6 +17,8 @@ This contains an example plugin and an example JSON configuration file. Only req

## Installation

WP Dependency Installer v2.0.0 or greater now requires PHP 5.6 or greater and WordPress 5.1 or greater.

Install the package via composer.

Run the composer command: ```composer require afragen/wp-dependency-installer```
Expand Down Expand Up @@ -62,8 +64,7 @@ This file must be named `wp-dependencies.json` and it must be in the root direct
"slug": "test-plugin-notags/test-plugin-notags.php",
"uri": "https://bitbucket.org/afragen/test-plugin-notags",
"branch": "master",
"optional": true,
"token": null
"optional": true
},
{
"name": "Test Gitlab Plugin2",
Expand Down
4 changes: 2 additions & 2 deletions vendor/afragen/wp-dependency-installer/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "afragen/wp-dependency-installer",
"description": "Library that helps WordPress plugin dependency management.",
"version": "1.4.11",
"version": "2.0.0",
"license": "MIT",
"authors": [
{
Expand All @@ -17,7 +17,7 @@
],
"prefer-stable": true,
"require": {
"php": ">=5.3",
"php": ">=5.6",
"collizo4sky/persist-admin-notices-dismissal": "^1"
},
"support": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* Version: 1.0
* Author: Andy Fragen, Matt Gibbs
* License: MIT
* Requires WP: 4.0
* Requires PHP: 5.3
* Requires WP: 5.1
* Requires PHP: 5.6
*/

require_once __DIR__ . '/vendor/autoload.php';
Expand Down
22 changes: 10 additions & 12 deletions vendor/afragen/wp-dependency-installer/wp-dependency-installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
* It can install a plugin from w.org, GitHub, Bitbucket, GitLab, Gitea or direct URL.
*
* @package WP_Dependency_Installer
* @author Andy Fragen
* @author Matt Gibbs
* @author Andy Fragen, Matt Gibbs
* @license MIT
* @link https://github.com/afragen/wp-dependency-installer
*/
Expand Down Expand Up @@ -130,11 +129,10 @@ public function apply_config() {
$api = parse_url( $uri, PHP_URL_HOST );
$scheme = parse_url( $uri, PHP_URL_SCHEME );
$scheme = ! empty( $scheme ) ? $scheme . '://' : 'https://';
$host = $dependency['host'];
$path = parse_url( $uri, PHP_URL_PATH );
$owner_repo = str_replace( '.git', '', trim( $path, '/' ) );

switch ( $host ) {
switch ( $dependency['host'] ) {
case 'github':
$base = null === $api || 'github.com' === $api ? 'api.github.com' : $api;
$download_link = "{$scheme}{$base}/repos/{$owner_repo}/zipball/{$dependency['branch']}";
Expand All @@ -143,15 +141,14 @@ public function apply_config() {
}
break;
case 'bitbucket':
$hosted = 'bitbucket.org';
$base = null === $api || $hosted === $api ? $hosted : $api;
$base = null === $api || 'bitbucket.org' === $api ? 'bitbucket.org' : $api;
$download_link = "{$scheme}{$base}/{$owner_repo}/get/{$dependency['branch']}.zip";
break;
case 'gitlab':
$hosted = 'gitlab.com';
$base = null === $api || $hosted === $api ? $hosted : $api;
$download_link = "{$scheme}{$base}/{$owner_repo}/repository/archive.zip";
$download_link = add_query_arg( 'ref', $dependency['branch'], $download_link );
$base = null === $api || 'gitlab.com' === $api ? 'gitlab.com' : $api;
$project_id = rawurlencode( $owner_repo );
$download_link = "{$scheme}{$base}/api/v4/projects/{$project_id}/repository/archive.zip";
$download_link = add_query_arg( 'sha', $dependency['branch'], $download_link );
if ( ! empty( $dependency['token'] ) ) {
$download_link = add_query_arg( 'private_token', $dependency['token'], $download_link );
}
Expand All @@ -161,7 +158,8 @@ public function apply_config() {
if ( ! empty( $dependency['token'] ) ) {
$download_link = add_query_arg( 'access_token', $dependency['token'], $download_link );
}
case 'wordpress':
break;
case 'wordpress': // phpcs:ignore WordPress.WP.CapitalPDangit.Misspelled
$download_link = $this->get_dot_org_latest_download( basename( $owner_repo ) );
break;
case 'direct':
Expand Down Expand Up @@ -547,7 +545,7 @@ class WPDI_Plugin_Installer_Skin extends Plugin_Installer_Skin {
public function header() {}
public function footer() {}
public function error( $errors ) {}
public function feedback( $string ) {}
public function feedback( $string, ...$args ) {}
}

}
22 changes: 11 additions & 11 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[
{
"name": "afragen/wp-dependency-installer",
"version": "1.4.11",
"version_normalized": "1.4.11.0",
"version": "2.0.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/afragen/wp-dependency-installer.git",
"reference": "59941012624fdf979b15c1b9333edb5bd080ef9d"
"reference": "05ba1f94bf8268d1a66ebe6a3d510a78281d6d5d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/afragen/wp-dependency-installer/zipball/59941012624fdf979b15c1b9333edb5bd080ef9d",
"reference": "59941012624fdf979b15c1b9333edb5bd080ef9d",
"url": "https://api.github.com/repos/afragen/wp-dependency-installer/zipball/05ba1f94bf8268d1a66ebe6a3d510a78281d6d5d",
"reference": "05ba1f94bf8268d1a66ebe6a3d510a78281d6d5d",
"shasum": ""
},
"require": {
"collizo4sky/persist-admin-notices-dismissal": "^1",
"php": ">=5.3"
"php": ">=5.6"
},
"time": "2019-03-09T17:57:11+00:00",
"time": "2019-09-16T15:45:10+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -31,15 +31,15 @@
"MIT"
],
"authors": [
{
"name": "Matt Gibbs",
"role": "Developer"
},
{
"name": "Andy Fragen",
"email": "[email protected]",
"homepage": "https://thefragens.com",
"role": "Developer"
},
{
"name": "Matt Gibbs",
"role": "Developer"
}
],
"description": "Library that helps WordPress plugin dependency management."
Expand Down

0 comments on commit 7ea44dd

Please sign in to comment.