get and git with any hosting solution #111
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I just discover your package today, very interesting!
I modified
packager:get
andpackager:git
to be more flexible.In other words, I created a class that will parse the source url via regular expressions and allow to use more git repository hosting solutions (including personal hosting). So it is therefore no longer necessary to specify whether you want to use github or bitbucket.
As a bonus, I added the recovery of the source url via the packagist api, it is now possible to do
packager:get jeroen-g/laravel-package
.Hope you'll enjoy my contribution.
How it works :
See the file: PackageRepository.php
I parse the given URL to check if it is a package name without hosting name and if so I ask packagist to get the associated repo url:
If given URL is a full URL, I get the pieces:
To get the zip url, I have an array of hosting solutions to retrieve the zip path:
To be more flexible, I added an empty array in the configuration file, this array will be merged with the existent one:
Tests
I added tests to check if the parser correctly works, see IntegratedTest.php#L10
Small fixes
I had to add a micro delay to display the progress bar correctly in the ProgressBar.php#L47 file.
I had to set an more important timeout for process (5 minutes) in file Conveyor.php#L173, my composer.json is heavy and when testing it fails because composer has not enough time to finish. Maybe this can be an configuration option?