Skip to content

Commit 6095808

Browse files
committed
refactor: Renaming init to pull and deploy to push
1 parent af7e4b5 commit 6095808

File tree

7 files changed

+127
-127
lines changed

7 files changed

+127
-127
lines changed

src/SDK/Language/CLI.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ public function getFiles(): array
159159
],
160160
[
161161
'scope' => 'default',
162-
'destination' => 'lib/commands/init.js',
163-
'template' => 'cli/lib/commands/init.js.twig',
162+
'destination' => 'lib/commands/pull.js',
163+
'template' => 'cli/lib/commands/pull.js.twig',
164164
],
165165
[
166166
'scope' => 'default',
167-
'destination' => 'lib/commands/deploy.js',
168-
'template' => 'cli/lib/commands/deploy.js.twig',
167+
'destination' => 'lib/commands/push.js',
168+
'template' => 'cli/lib/commands/push.js.twig',
169169
],
170170
[
171171
'scope' => 'service',

templates/cli/index.js.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const { commandDescriptions, cliConfig } = require("./lib/parser");
1212
const { client } = require("./lib/commands/generic");
1313
{% if sdk.test != "true" %}
1414
const { login, logout } = require("./lib/commands/generic");
15-
const { init } = require("./lib/commands/init");
16-
const { deploy } = require("./lib/commands/deploy");
15+
const { pull } = require("./lib/commands/pull");
16+
const { push } = require("./lib/commands/push");
1717
{% endif %}
1818
{% for service in spec.services %}
1919
const { {{ service.name | caseLower }} } = require("./lib/commands/{{ service.name | caseLower }}");
@@ -37,14 +37,14 @@ program
3737
.showSuggestionAfterError()
3838
{% if sdk.test != "true" %}
3939
.addCommand(login)
40-
.addCommand(init)
41-
.addCommand(deploy)
40+
.addCommand(pull)
41+
.addCommand(push)
4242
.addCommand(logout)
4343
{% endif %}
4444
{% for service in spec.services %}
4545
.addCommand({{ service.name | caseLower }})
4646
{% endfor %}
4747
.addCommand(client)
4848
.parse(process.argv);
49-
50-
process.stdout.columns = oldWidth;
49+
50+
process.stdout.columns = oldWidth;

templates/cli/lib/commands/init.js.twig renamed to templates/cli/lib/commands/pull.js.twig

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ const { storageListBuckets } = require("./storage");
1111
const { sdkForConsole } = require("../sdks");
1212
const { localConfig } = require("../config");
1313
const { paginate } = require("../paginate");
14-
const { questionsInitProject, questionsInitFunction, questionsInitCollection } = require("../questions");
14+
const { questionsPullProject, questionsPullFunction, questionsPullCollection } = require("../questions");
1515
const { success, log, actionRunner, commandDescriptions } = require("../parser");
1616

17-
const init = new Command("init")
18-
.description(commandDescriptions['init'])
17+
const pull = new Command("pull")
18+
.description(commandDescriptions['pull'])
1919
.configureHelp({
2020
helpWidth: process.stdout.columns || 80
2121
})
2222
.action(actionRunner(async (_options, command) => {
2323
command.help();
2424
}));
2525

26-
const initProject = async () => {
26+
const pullProject = async () => {
2727
let response = {}
28-
const answers = await inquirer.prompt(questionsInitProject)
28+
const answers = await inquirer.prompt(questionsPullProject)
2929
if (!answers.project) process.exit(1)
3030

3131
let sdk = await sdkForConsole();
@@ -52,9 +52,9 @@ const initProject = async () => {
5252
success();
5353
}
5454

55-
const initFunction = async () => {
55+
const pullFunction = async () => {
5656
// TODO: Add CI/CD support (ID, name, runtime)
57-
const answers = await inquirer.prompt(questionsInitFunction)
57+
const answers = await inquirer.prompt(questionsPullFunction)
5858
const functionFolder = path.join(process.cwd(), 'functions');
5959

6060
if (!fs.existsSync(functionFolder)) {
@@ -70,11 +70,11 @@ const initFunction = async () => {
7070
}
7171

7272
if (!answers.runtime.entrypoint) {
73-
log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first deploy the function.`);
73+
log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first push the function.`);
7474
}
7575

7676
if (!answers.runtime.commands) {
77-
log(`Installation command for this runtime not found. You will be asked to configure the install command when you first deploy the function.`);
77+
log(`Installation command for this runtime not found. You will be asked to configure the install command when you first push the function.`);
7878
}
7979

8080
let response = await functionsCreate({
@@ -161,7 +161,7 @@ const initFunction = async () => {
161161
success();
162162
}
163163

164-
const initCollection = async ({ all, databaseId } = {}) => {
164+
const pullCollection = async ({ all, databaseId } = {}) => {
165165
const databaseIds = [];
166166

167167
if (databaseId) {
@@ -175,7 +175,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
175175
}
176176

177177
if (databaseIds.length <= 0) {
178-
let answers = await inquirer.prompt(questionsInitCollection)
178+
let answers = await inquirer.prompt(questionsPullCollection)
179179
if (!answers.databases) process.exit(1)
180180
databaseIds.push(...answers.databases);
181181
}
@@ -208,7 +208,7 @@ const initCollection = async ({ all, databaseId } = {}) => {
208208
success();
209209
}
210210

211-
const initBucket = async () => {
211+
const pullBucket = async () => {
212212
const { buckets } = await paginate(storageListBuckets, { parseOutput: false }, 100, 'buckets');
213213

214214
log(`Found ${buckets.length} buckets`);
@@ -221,7 +221,7 @@ const initBucket = async () => {
221221
success();
222222
}
223223

224-
const initTeam = async () => {
224+
const pullTeam = async () => {
225225
const { teams } = await paginate(teamsList, { parseOutput: false }, 100, 'teams');
226226

227227
log(`Found ${teams.length} teams`);
@@ -235,33 +235,33 @@ const initTeam = async () => {
235235
success();
236236
}
237237

238-
init
238+
pull
239239
.command("project")
240-
.description("Initialise your {{ spec.title|caseUcfirst }} project")
241-
.action(actionRunner(initProject));
240+
.description("Pulling your {{ spec.title|caseUcfirst }} project")
241+
.action(actionRunner(pullProject));
242242

243-
init
243+
pull
244244
.command("function")
245-
.description("Initialise your {{ spec.title|caseUcfirst }} cloud function")
246-
.action(actionRunner(initFunction))
245+
.description("Pulling your {{ spec.title|caseUcfirst }} cloud function")
246+
.action(actionRunner(pullFunction))
247247

248-
init
248+
pull
249249
.command("collection")
250-
.description("Initialise your {{ spec.title|caseUcfirst }} collections")
250+
.description("Pulling your {{ spec.title|caseUcfirst }} collections")
251251
.option(`--databaseId <databaseId>`, `Database ID`)
252-
.option(`--all`, `Flag to initialize all databases`)
253-
.action(actionRunner(initCollection))
252+
.option(`--all`, `Flag to pullialize all databases`)
253+
.action(actionRunner(pullCollection))
254254

255-
init
255+
pull
256256
.command("bucket")
257-
.description("Initialise your Appwrite buckets")
258-
.action(actionRunner(initBucket))
257+
.description("Pulling your Appwrite buckets")
258+
.action(actionRunner(pullBucket))
259259

260-
init
260+
pull
261261
.command("team")
262-
.description("Initialise your Appwrite teams")
263-
.action(actionRunner(initTeam))
262+
.description("Pulling your Appwrite teams")
263+
.action(actionRunner(pullTeam))
264264

265265
module.exports = {
266-
init,
266+
pull,
267267
};

0 commit comments

Comments
 (0)