Skip to content

Commit dafc5fa

Browse files
authored
Merge pull request #229 from appwrite/fix-cli-issues
feat(cli): move services from app/Appwrite/services to app/
2 parents 998034a + 8bce332 commit dafc5fa

File tree

12 files changed

+48
-30
lines changed

12 files changed

+48
-30
lines changed

src/SDK/Language/CLI.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,26 +192,26 @@ public function getFiles()
192192
],
193193
[
194194
'scope' => 'service',
195-
'destination' => '/app/{{ spec.title | caseUcfirst}}/services/{{service.name | caseDash}}.php',
196-
'template' => 'cli/app/services/service.php.twig',
195+
'destination' => '/app/{{service.name | caseDash}}.php',
196+
'template' => 'cli/app/service.php.twig',
197197
'minify' => false,
198198
],
199199
[
200200
'scope' => 'default',
201-
'destination' => 'app/{{ spec.title | caseUcfirst}}/services/client.php',
202-
'template' => 'cli/app/services/client.php.twig',
201+
'destination' => 'app/client.php',
202+
'template' => 'cli/app/client.php.twig',
203203
'minify' => false,
204204
],
205205
[
206206
'scope' => 'default',
207-
'destination' => 'app/{{ spec.title | caseUcfirst}}/services/help.php',
208-
'template' => 'cli/app/services/help.php.twig',
207+
'destination' => 'app/help.php',
208+
'template' => 'cli/app/help.php.twig',
209209
'minify' => false,
210210
],
211211
[
212212
'scope' => 'default',
213-
'destination' => 'app/{{ spec.title | caseUcfirst}}/services/init.php',
214-
'template' => 'cli/app/services/init.php.twig',
213+
'destination' => 'app/init.php',
214+
'template' => 'cli/app/init.php.twig',
215215
'minify' => false,
216216
],
217217
[
File renamed without changes.
File renamed without changes.

templates/cli/app/services/init.php.twig renamed to templates/cli/app/init.php.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use Utopia\Validator\Wildcard;
1010
use Utopia\CLI\Console;
1111
use {{ spec.title | caseUcfirst }}\Parser;
1212
13-
const USER_PREFERENCES_FILE = __DIR__."/../../.preferences/.prefs.json";
13+
const USER_PREFERENCES_FILE = __DIR__."/.preferences/.prefs.json";
1414
const PREFERENCE_ENDPOINT = "endpoint";
1515
1616
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ $cli
6363
{% for parameter in method.parameters.body %}
6464
{% if parameter.type == 'file' and method.packaging %}
6565
${{ parameter.name | caseCamel }} = \urldecode(${{ parameter.name | caseCamel }});
66-
$cloudFunctionPath = realpath(__DIR__.'/../../../files/'.${{ parameter.name | caseCamel }});
66+
$cloudFunctionPath = realpath(__DIR__.'/../files/'.${{ parameter.name | caseCamel }});
6767
$cloudFunctionParentDir = escapeshellarg(dirname($cloudFunctionPath, 1));
6868
$cloudFunctionDirName = escapeshellarg(basename($cloudFunctionPath));
6969
if (file_exists($cloudFunctionPath) === false ) {
7070
throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. ");
7171
}
7272
$archiveName = 'code.tar.gz';
73-
$volumeMountPoint = realpath(__DIR__.'/../../../files/');
73+
$volumeMountPoint = realpath(__DIR__.'/../files/');
7474
exec("tar -zcvf $archiveName -C $cloudFunctionParentDir $cloudFunctionDirName && mv $archiveName $volumeMountPoint");
7575
$archivePath = realpath($volumeMountPoint."/$archiveName");
7676
$cFile = new \CURLFile($archivePath, 'application/x-gzip' , basename($archivePath));
7777
$params['{{ parameter.name }}'] = $cFile;
7878
{% elseif parameter.type == 'file' %}
79-
${{ parameter.name | caseCamel }} = realpath(__DIR__.'/../../../files/'.\urldecode(${{ parameter.name | caseCamel }}));
79+
${{ parameter.name | caseCamel }} = realpath(__DIR__.'/../files/'.\urldecode(${{ parameter.name | caseCamel }}));
8080
if (file_exists(${{ parameter.name | caseCamel }}) === false ) {
8181
throw new Exception("Path doesn't exist. Please ensure that the path is within the current directory. ");
8282
}

templates/cli/bin/client.twig

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

33
if [[ $# -eq 0 ]]; then
4-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/client.php help
4+
php /usr/local/code/app/client.php help
55
else
6-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/client.php $@
6+
php /usr/local/code/app/client.php $@
77
fi

templates/cli/bin/help.twig

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

3-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/help.php $@
3+
php /usr/local/code/app/help.php $@

templates/cli/bin/init.twig

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

3-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/init.php init $@
3+
php /usr/local/code/app/init.php init $@

templates/cli/bin/service.twig

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

33
if [[ $# -eq 0 ]]; then
4-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/{{service.name | caseDash}}.php help
4+
php /usr/local/code/app/{{service.name | caseDash}}.php help
55
else
6-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/{{service.name | caseDash}}.php $@
6+
php /usr/local/code/app/{{service.name | caseDash}}.php $@
77
fi

templates/cli/bin/version.twig

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

3-
php /usr/local/code/app/{{ spec.title | caseUcfirst}}/services/client.php version
3+
php /usr/local/code/app/client.php version

0 commit comments

Comments
 (0)