Skip to content

Commit 08d6dc7

Browse files
authored
Merge pull request #106 from christyjacob4/fix-cli-function-packaging-issue
Fix cli function packaging issue
2 parents c31edf7 + 54c255c commit 08d6dc7

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

templates/cli/app/services/help.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ printf("\nUsage : appwrite [SERVICE] [COMMAND] --[OPTION]\n\n");
1616
printf("Services :\n");
1717
$mask = "\t%-20.20s %-125.125s\n";
1818
{% for service in spec.services %}
19-
printf($mask, "{{ service.name }}", "{{ service.description }}");
19+
printf($mask, "{{ service.name }}", "{{ service.description | replace({'"':'\''}) | raw }}");
2020
{% endfor %}
2121
printf("\nRun 'appwrite [SERVICE] help' for more information on a service.\n");

templates/cli/app/services/service.php.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ $cli
7272
{% if parameter.type == 'file' and method.packaging %}
7373
$cloudFunctionPath = realpath(__DIR__.'/../../../files/'.${{ parameter.name | caseCamel }});
7474
$cloudFunctionParentDir = dirname($cloudFunctionPath, 1);
75-
$cloudFunctionDirName = basename(${{ parameter.name | caseCamel }});
75+
$cloudFunctionDirName = basename($cloudFunctionPath);
7676
if (file_exists($cloudFunctionPath) === false ) {
7777
throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. ");
7878
}
7979
$archiveName = 'code.tar.gz';
8080
$volumeMountPoint = realpath(__DIR__.'/../../../files/');
81-
exec("tar -zcvf $archiveName --exclude=$archiveName -C ${cloudFunctionParentDir} $cloudFunctionDirName && mv ${archiveName} ${volumeMountPoint}");
82-
$archivePath = realpath($volumeMountPoint."/$archiveName");$archivePath = realpath($volumeMountPoint."/$archiveName");
81+
exec("tar -zcvf $archiveName -C $cloudFunctionParentDir $cloudFunctionDirName && mv $archiveName $volumeMountPoint");
82+
$archivePath = realpath($volumeMountPoint."/$archiveName");
8383
$cFile = new \CURLFile($archivePath, 'application/x-gzip' , basename($archivePath));
8484
8585
$params['{{ parameter.name }}'] = $cFile;

templates/cli/bin/service.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
#!/bin/sh
22

3-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseDash}}.php $@
3+
if [[ -z "$@" ]]; then
4+
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseDash}}.php help
5+
else
6+
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/Services/{{service.name | caseDash}}.php $@
7+
fi

0 commit comments

Comments
 (0)