New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add system to import functions from remote #136
Conversation
f1fad0e
to
0bcf1c5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool
@@ -9,7 +9,7 @@ class ArgsAnotherArgsTest extends TaskTestCase | |||
// args:another-args | |||
public function test(): void | |||
{ | |||
$process = $this->runTask(['args:another-args', 'FIXME(required)', '--test2', 1]); | |||
$process = $this->runTask(['args:another-args', 'FIXME(required)', '--test2', 1, '--no-trust']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to not update all tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not find a way, so I'm open to any suggestions
d661b23
to
d6d36ad
Compare
37c0429
to
b0e455f
Compare
I would put all the code in a |
function, formatted like this: | ||
|
||
``` | ||
github://<user>/<repository>/<path of the php file to import>@<version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document what version
could be. A branch? A tag? A commit hash?
Hey, Not a lot of movement here? ^^ I'm waiting for this PR to split the common code to share it with different projects 😁 |
For the record we sometimes talk internally about this feature we all want. But we do not fully agree on some details, mainly where to store the downloaded files. I hope we can find a solution soon but not sure it will find its way before the release of the v1 |
We had a very good talk with @pyrech and @joelwurtz and here the ADR The goal is to generate a Default usage, package is published on packagist.orgimport('composer://jolicode/jolitypo'); Add this to composer.json {
"require": {
"jolicode/castor": "*",
}
} Then execute at runtime require_once PathHelper::getRoot() . '/.castor/vendor/autoload.php'; More complex usageimport('composer://jolicode/jolitypo',
file: 'path/to/file.php',
version: 'v1.2.34',
); Add this to composer.json {
"require": {
"jolicode/castor": "v1.2.34",
}
} Then execute at runtime require_once PathHelper::getRoot() . '/.castor/vendor/autoload.php';
require_once PathHelper::getRoot() . '/.castor/vendor/jolicode/jolitypo/path/to/file.php'; Package that is not published on packagist.orgimport('composer://jolicode/jolitypo',
file: 'path/to/file.php',
version: 'v1.2.34',
vcs: 'https://github.com/jolicode/jolitypo.git',
); Add this to composer.json {
"repositories": [
{
"type": "vcs",
"url": "https://github.com/jolicode/jolitypo.git"
}
],
"require": {
"jolicode/castor": "v1.2.34",
}
} Then execute at runtime require_once PathHelper::getRoot() . '/.castor/vendor/autoload.php';
require_once PathHelper::getRoot() . '/.castor/vendor/jolicode/jolitypo/path/to/file.php'; Not a packageimport('package://what/you-want',
file: 'path/to/file.php',
// version: 'dev-main', // Not allowed here
source: [
"url" => "https://github.com/soyuka/php-wasm.git",
"type" => "git",
"reference" => "main"
],
); Add this to composer.json {
"repositories": [
{
"type": "package",
"package": {
"name": "what/you-want",
"version": "dev-main",
"source": {
"url": "https://github.com/soyuka/php-wasm.git",
"type": "git",
"reference": "main"
}
}
},
],
"require": {
"what/you-want": "*",
}
} Then execute at runtime require_once PathHelper::getRoot() . '/.castor/vendor/autoload.php'; |
Closing in favor of #297 |
For now, only import from GitHub repositories is supported.
A trust system is embedded to avoid malicious remote execution and ask users if they allow to import remote functions.
See the documentation for how it works: https://github.com/jolicode/castor/blob/remote-imports/doc/15-remote.md
Future ideas:
import('github://jolicode/docker-starter/worker')
import('github://jolicode/docker-starter/v4/.castor/qa.php')