@backstage/plugin-scaffolder-backend-module-rails 0.5.1-next.0 → 0.5.1-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/actions/fetch/rails/index.cjs.js +189 -0
- package/dist/actions/fetch/rails/index.cjs.js.map +1 -0
- package/dist/actions/fetch/rails/index.examples.cjs.js +356 -0
- package/dist/actions/fetch/rails/index.examples.cjs.js.map +1 -0
- package/dist/actions/fetch/rails/railsArgumentResolver.cjs.js +94 -0
- package/dist/actions/fetch/rails/railsArgumentResolver.cjs.js.map +1 -0
- package/dist/actions/fetch/rails/railsNewRunner.cjs.js +85 -0
- package/dist/actions/fetch/rails/railsNewRunner.cjs.js.map +1 -0
- package/dist/index.cjs.js +4 -711
- package/dist/index.cjs.js.map +1 -1
- package/dist/module.cjs.js +27 -0
- package/dist/module.cjs.js.map +1 -0
- package/package.json +10 -10
package/dist/index.cjs.js
CHANGED
|
@@ -2,718 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
|
|
8
|
-
var path = require('path');
|
|
9
|
-
var commandExists = require('command-exists');
|
|
10
|
-
var stream = require('stream');
|
|
11
|
-
var yaml = require('yaml');
|
|
12
|
-
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
13
|
-
var alpha = require('@backstage/plugin-scaffolder-node/alpha');
|
|
14
|
-
var integration = require('@backstage/integration');
|
|
5
|
+
var index = require('./actions/fetch/rails/index.cjs.js');
|
|
6
|
+
var module$1 = require('./module.cjs.js');
|
|
15
7
|
|
|
16
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
8
|
|
|
18
|
-
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
19
|
-
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
20
|
-
var commandExists__default = /*#__PURE__*/_interopDefaultCompat(commandExists);
|
|
21
|
-
var yaml__default = /*#__PURE__*/_interopDefaultCompat(yaml);
|
|
22
9
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Webpacker2["vue"] = "vue";
|
|
26
|
-
Webpacker2["angular"] = "angular";
|
|
27
|
-
Webpacker2["elm"] = "elm";
|
|
28
|
-
Webpacker2["stimulus"] = "stimulus";
|
|
29
|
-
return Webpacker2;
|
|
30
|
-
})(Webpacker || {});
|
|
31
|
-
var Database = /* @__PURE__ */ ((Database2) => {
|
|
32
|
-
Database2["mysql"] = "mysql";
|
|
33
|
-
Database2["postgresql"] = "postgresql";
|
|
34
|
-
Database2["sqlite3"] = "sqlite3";
|
|
35
|
-
Database2["oracle"] = "oracle";
|
|
36
|
-
Database2["sqlserver"] = "sqlserver";
|
|
37
|
-
Database2["jdbcmysql"] = "jdbcmysql";
|
|
38
|
-
Database2["jdbcsqlite3"] = "jdbcsqlite3";
|
|
39
|
-
Database2["jdbcpostgresql"] = "jdbcpostgresql";
|
|
40
|
-
Database2["jdbc"] = "jdbc";
|
|
41
|
-
return Database2;
|
|
42
|
-
})(Database || {});
|
|
43
|
-
var RailsVersion = /* @__PURE__ */ ((RailsVersion2) => {
|
|
44
|
-
RailsVersion2["dev"] = "dev";
|
|
45
|
-
RailsVersion2["edge"] = "edge";
|
|
46
|
-
RailsVersion2["master"] = "master";
|
|
47
|
-
RailsVersion2["fromImage"] = "fromImage";
|
|
48
|
-
return RailsVersion2;
|
|
49
|
-
})(RailsVersion || {});
|
|
50
|
-
const railsArgumentResolver = (projectRoot, options, executionOnContainer = false) => {
|
|
51
|
-
const argumentsToRun = [];
|
|
52
|
-
if (options?.minimal) {
|
|
53
|
-
argumentsToRun.push("--minimal");
|
|
54
|
-
}
|
|
55
|
-
if (options?.api) {
|
|
56
|
-
argumentsToRun.push("--api");
|
|
57
|
-
}
|
|
58
|
-
if (options?.skipBundle) {
|
|
59
|
-
argumentsToRun.push("--skip-bundle");
|
|
60
|
-
}
|
|
61
|
-
if (options?.skipWebpackInstall) {
|
|
62
|
-
argumentsToRun.push("--skip-webpack-install");
|
|
63
|
-
}
|
|
64
|
-
if (options?.skipActiveRecord) {
|
|
65
|
-
argumentsToRun.push("--skip-active-record");
|
|
66
|
-
}
|
|
67
|
-
if (options?.skipTest) {
|
|
68
|
-
argumentsToRun.push("--skip-test");
|
|
69
|
-
}
|
|
70
|
-
if (options?.skipActionCable) {
|
|
71
|
-
argumentsToRun.push("--skip-action-cable");
|
|
72
|
-
}
|
|
73
|
-
if (options?.skipActionMailer) {
|
|
74
|
-
argumentsToRun.push("--skip-action-mailer");
|
|
75
|
-
}
|
|
76
|
-
if (options?.skipActionMailbox) {
|
|
77
|
-
argumentsToRun.push("--skip-action-mailbox");
|
|
78
|
-
}
|
|
79
|
-
if (options?.skipActiveStorage) {
|
|
80
|
-
argumentsToRun.push("--skip-active-storage");
|
|
81
|
-
}
|
|
82
|
-
if (options?.skipActionText) {
|
|
83
|
-
argumentsToRun.push("--skip-action-text");
|
|
84
|
-
}
|
|
85
|
-
if (options?.force) {
|
|
86
|
-
argumentsToRun.push("--force");
|
|
87
|
-
}
|
|
88
|
-
if (options?.webpacker && Object.values(Webpacker).includes(options?.webpacker)) {
|
|
89
|
-
argumentsToRun.push("--webpack");
|
|
90
|
-
argumentsToRun.push(options.webpacker);
|
|
91
|
-
}
|
|
92
|
-
if (options?.database && Object.values(Database).includes(options?.database)) {
|
|
93
|
-
argumentsToRun.push("--database");
|
|
94
|
-
argumentsToRun.push(options.database);
|
|
95
|
-
}
|
|
96
|
-
if (options?.railsVersion !== "fromImage" /* fromImage */ && Object.values(RailsVersion).includes(options?.railsVersion)) {
|
|
97
|
-
argumentsToRun.push(`--${options.railsVersion}`);
|
|
98
|
-
}
|
|
99
|
-
if (options?.template) {
|
|
100
|
-
argumentsToRun.push("--template");
|
|
101
|
-
argumentsToRun.push(
|
|
102
|
-
options.template.replace(
|
|
103
|
-
`.${path.sep}`,
|
|
104
|
-
`${projectRoot}${executionOnContainer ? "/" : path.sep}`
|
|
105
|
-
)
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
return argumentsToRun;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
class RailsNewRunner {
|
|
112
|
-
containerRunner;
|
|
113
|
-
constructor({ containerRunner }) {
|
|
114
|
-
this.containerRunner = containerRunner;
|
|
115
|
-
}
|
|
116
|
-
async run({
|
|
117
|
-
workspacePath,
|
|
118
|
-
values,
|
|
119
|
-
logStream
|
|
120
|
-
}) {
|
|
121
|
-
const intermediateDir = path__default.default.join(workspacePath, "intermediate");
|
|
122
|
-
await fs__default.default.ensureDir(intermediateDir);
|
|
123
|
-
const resultDir = path__default.default.join(workspacePath, "result");
|
|
124
|
-
const { name, imageName, railsArguments } = values;
|
|
125
|
-
const mountDirs = {
|
|
126
|
-
[workspacePath]: "/input",
|
|
127
|
-
[intermediateDir]: "/output"
|
|
128
|
-
};
|
|
129
|
-
const baseCommand = "rails";
|
|
130
|
-
const baseArguments = ["new"];
|
|
131
|
-
const commandExistsToRun = await commandExists__default.default(baseCommand);
|
|
132
|
-
if (commandExistsToRun) {
|
|
133
|
-
const arrayExtraArguments = railsArgumentResolver(
|
|
134
|
-
workspacePath,
|
|
135
|
-
railsArguments
|
|
136
|
-
);
|
|
137
|
-
await pluginScaffolderNode.executeShellCommand({
|
|
138
|
-
command: baseCommand,
|
|
139
|
-
args: [
|
|
140
|
-
...baseArguments,
|
|
141
|
-
`${intermediateDir}${path__default.default.sep}${name}`,
|
|
142
|
-
...arrayExtraArguments
|
|
143
|
-
],
|
|
144
|
-
logStream
|
|
145
|
-
});
|
|
146
|
-
} else {
|
|
147
|
-
if (!imageName) {
|
|
148
|
-
throw new Error("No imageName provided");
|
|
149
|
-
}
|
|
150
|
-
if (!this.containerRunner) {
|
|
151
|
-
throw new Error(
|
|
152
|
-
"Command is not available and no container runner provided"
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
const arrayExtraArguments = railsArgumentResolver(
|
|
156
|
-
"/input",
|
|
157
|
-
railsArguments,
|
|
158
|
-
true
|
|
159
|
-
);
|
|
160
|
-
await this.containerRunner.runContainer({
|
|
161
|
-
imageName,
|
|
162
|
-
command: baseCommand,
|
|
163
|
-
args: [...baseArguments, `/output/${name}`, ...arrayExtraArguments],
|
|
164
|
-
mountDirs,
|
|
165
|
-
workingDir: "/input",
|
|
166
|
-
// Set the home directory inside the container as something that applications can
|
|
167
|
-
// write to, otherwise they will just fail trying to write to /
|
|
168
|
-
envVars: { HOME: "/tmp" },
|
|
169
|
-
logStream
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
const [generated] = await fs__default.default.readdir(intermediateDir);
|
|
173
|
-
if (generated === void 0) {
|
|
174
|
-
throw new Error(`No data generated by ${baseCommand}`);
|
|
175
|
-
}
|
|
176
|
-
await fs__default.default.move(path__default.default.join(intermediateDir, generated), resultDir);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const examples = [
|
|
181
|
-
{
|
|
182
|
-
description: "Fetch and template a minimal Rails app",
|
|
183
|
-
example: yaml__default.default.stringify({
|
|
184
|
-
steps: [
|
|
185
|
-
{
|
|
186
|
-
id: "fetchTemplate",
|
|
187
|
-
action: "fetch:rails",
|
|
188
|
-
name: "Fetch and Template Rails App",
|
|
189
|
-
input: {
|
|
190
|
-
url: "https://github.com/backstage/backstage",
|
|
191
|
-
values: {
|
|
192
|
-
railsArguments: {
|
|
193
|
-
minimal: true,
|
|
194
|
-
skipBundle: true,
|
|
195
|
-
skipWebpackInstall: true,
|
|
196
|
-
skipTest: true,
|
|
197
|
-
skipActionCable: true,
|
|
198
|
-
skipActionMailer: true,
|
|
199
|
-
skipActionMailbox: true,
|
|
200
|
-
skipActiveStorage: true,
|
|
201
|
-
skipActionText: true,
|
|
202
|
-
skipActiveRecord: true,
|
|
203
|
-
force: true,
|
|
204
|
-
api: true,
|
|
205
|
-
webpacker: "react",
|
|
206
|
-
database: "postgresql",
|
|
207
|
-
railsVersion: "dev"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
]
|
|
213
|
-
})
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
description: "Fetch and template a Rails app with custom options",
|
|
217
|
-
example: yaml__default.default.stringify({
|
|
218
|
-
steps: [
|
|
219
|
-
{
|
|
220
|
-
id: "fetchTemplate",
|
|
221
|
-
action: "fetch:rails",
|
|
222
|
-
name: "Fetch and Template Rails App",
|
|
223
|
-
input: {
|
|
224
|
-
url: "https://github.com/backstage/backstage",
|
|
225
|
-
targetPath: "custom-path",
|
|
226
|
-
values: {
|
|
227
|
-
railsArguments: {
|
|
228
|
-
minimal: false,
|
|
229
|
-
skipBundle: false,
|
|
230
|
-
skipWebpackInstall: false,
|
|
231
|
-
skipTest: false,
|
|
232
|
-
skipActionCable: false,
|
|
233
|
-
skipActionMailer: false,
|
|
234
|
-
skipActionMailbox: false,
|
|
235
|
-
skipActiveStorage: false,
|
|
236
|
-
skipActionText: false,
|
|
237
|
-
skipActiveRecord: false,
|
|
238
|
-
force: false,
|
|
239
|
-
api: false,
|
|
240
|
-
webpacker: "vue",
|
|
241
|
-
database: "mysql",
|
|
242
|
-
railsVersion: "edge"
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
})
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
description: "Fetch and template a Rails app with Docker image",
|
|
252
|
-
example: yaml__default.default.stringify({
|
|
253
|
-
steps: [
|
|
254
|
-
{
|
|
255
|
-
id: "fetchTemplate",
|
|
256
|
-
action: "fetch:rails",
|
|
257
|
-
name: "Fetch and Template Rails App",
|
|
258
|
-
input: {
|
|
259
|
-
url: "https://github.com/backstage/backstage",
|
|
260
|
-
values: {
|
|
261
|
-
railsArguments: {
|
|
262
|
-
minimal: true,
|
|
263
|
-
skipBundle: true,
|
|
264
|
-
skipWebpackInstall: true,
|
|
265
|
-
skipTest: true,
|
|
266
|
-
skipActionCable: true,
|
|
267
|
-
skipActionMailer: true,
|
|
268
|
-
skipActionMailbox: true,
|
|
269
|
-
skipActiveStorage: true,
|
|
270
|
-
skipActionText: true,
|
|
271
|
-
skipActiveRecord: true,
|
|
272
|
-
force: true,
|
|
273
|
-
api: true,
|
|
274
|
-
webpacker: "react",
|
|
275
|
-
database: "postgresql",
|
|
276
|
-
railsVersion: "dev"
|
|
277
|
-
},
|
|
278
|
-
imageName: "custom/rails-image"
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
]
|
|
283
|
-
})
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
description: "Fetch and template a Rails app with different database and action mailer settings",
|
|
287
|
-
example: yaml__default.default.stringify({
|
|
288
|
-
steps: [
|
|
289
|
-
{
|
|
290
|
-
id: "fetchTemplate",
|
|
291
|
-
action: "fetch:rails",
|
|
292
|
-
name: "Fetch and Template Rails App",
|
|
293
|
-
input: {
|
|
294
|
-
url: "https://github.com/backstage/backstage",
|
|
295
|
-
values: {
|
|
296
|
-
railsArguments: {
|
|
297
|
-
minimal: false,
|
|
298
|
-
skipBundle: false,
|
|
299
|
-
skipWebpackInstall: false,
|
|
300
|
-
skipTest: false,
|
|
301
|
-
skipActionCable: false,
|
|
302
|
-
skipActionMailer: false,
|
|
303
|
-
skipActionMailbox: true,
|
|
304
|
-
skipActiveStorage: false,
|
|
305
|
-
skipActionText: false,
|
|
306
|
-
skipActiveRecord: false,
|
|
307
|
-
force: true,
|
|
308
|
-
api: true,
|
|
309
|
-
webpacker: "angular",
|
|
310
|
-
database: "sqlite3",
|
|
311
|
-
railsVersion: "master"
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
]
|
|
317
|
-
})
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
description: "Fetch and template a Rails app with full options including action mailer and active storage",
|
|
321
|
-
example: yaml__default.default.stringify({
|
|
322
|
-
steps: [
|
|
323
|
-
{
|
|
324
|
-
id: "fetchTemplate",
|
|
325
|
-
action: "fetch:rails",
|
|
326
|
-
name: "Fetch and Template Rails App",
|
|
327
|
-
input: {
|
|
328
|
-
url: "https://github.com/backstage/backstage",
|
|
329
|
-
values: {
|
|
330
|
-
railsArguments: {
|
|
331
|
-
minimal: false,
|
|
332
|
-
skipBundle: false,
|
|
333
|
-
skipWebpackInstall: false,
|
|
334
|
-
skipTest: false,
|
|
335
|
-
skipActionCable: false,
|
|
336
|
-
skipActionMailer: false,
|
|
337
|
-
skipActionMailbox: false,
|
|
338
|
-
skipActiveStorage: false,
|
|
339
|
-
skipActionText: false,
|
|
340
|
-
skipActiveRecord: false,
|
|
341
|
-
force: false,
|
|
342
|
-
api: false,
|
|
343
|
-
webpacker: "stimulus",
|
|
344
|
-
database: "postgresql",
|
|
345
|
-
railsVersion: "fromImage"
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
]
|
|
351
|
-
})
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
description: "Fetch and template a Rails app with API-only stack and custom template path",
|
|
355
|
-
example: yaml__default.default.stringify({
|
|
356
|
-
steps: [
|
|
357
|
-
{
|
|
358
|
-
id: "fetchTemplate",
|
|
359
|
-
action: "fetch:rails",
|
|
360
|
-
name: "Fetch and Template Rails App",
|
|
361
|
-
input: {
|
|
362
|
-
url: "https://github.com/backstage/backstage",
|
|
363
|
-
values: {
|
|
364
|
-
railsArguments: {
|
|
365
|
-
minimal: false,
|
|
366
|
-
skipBundle: true,
|
|
367
|
-
skipWebpackInstall: true,
|
|
368
|
-
skipTest: true,
|
|
369
|
-
skipActionCable: true,
|
|
370
|
-
skipActionMailer: true,
|
|
371
|
-
skipActionMailbox: true,
|
|
372
|
-
skipActiveStorage: true,
|
|
373
|
-
skipActionText: true,
|
|
374
|
-
skipActiveRecord: true,
|
|
375
|
-
force: true,
|
|
376
|
-
api: true,
|
|
377
|
-
webpacker: "elm",
|
|
378
|
-
database: "mysql",
|
|
379
|
-
railsVersion: "dev",
|
|
380
|
-
template: "path/to/custom/template"
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
]
|
|
386
|
-
})
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
description: "Fetch and template a Rails app with custom Webpack setup",
|
|
390
|
-
example: yaml__default.default.stringify({
|
|
391
|
-
steps: [
|
|
392
|
-
{
|
|
393
|
-
id: "fetchTemplate",
|
|
394
|
-
action: "fetch:rails",
|
|
395
|
-
name: "Fetch and Template Rails App",
|
|
396
|
-
input: {
|
|
397
|
-
url: "https://github.com/backstage/backstage",
|
|
398
|
-
values: {
|
|
399
|
-
railsArguments: {
|
|
400
|
-
minimal: false,
|
|
401
|
-
skipBundle: false,
|
|
402
|
-
skipWebpackInstall: false,
|
|
403
|
-
skipTest: false,
|
|
404
|
-
skipActionCable: false,
|
|
405
|
-
skipActionMailer: false,
|
|
406
|
-
skipActionMailbox: false,
|
|
407
|
-
skipActiveStorage: false,
|
|
408
|
-
skipActionText: false,
|
|
409
|
-
skipActiveRecord: false,
|
|
410
|
-
force: false,
|
|
411
|
-
api: false,
|
|
412
|
-
webpacker: "angular",
|
|
413
|
-
database: "postgresql",
|
|
414
|
-
railsVersion: "dev"
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
]
|
|
420
|
-
})
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
description: "Fetch and template a Rails app with specific Rails version and Action Mailer enabled",
|
|
424
|
-
example: yaml__default.default.stringify({
|
|
425
|
-
steps: [
|
|
426
|
-
{
|
|
427
|
-
id: "fetchTemplate",
|
|
428
|
-
action: "fetch:rails",
|
|
429
|
-
name: "Fetch and Template Rails App",
|
|
430
|
-
input: {
|
|
431
|
-
url: "https://github.com/backstage/backstage",
|
|
432
|
-
values: {
|
|
433
|
-
railsArguments: {
|
|
434
|
-
minimal: false,
|
|
435
|
-
skipBundle: false,
|
|
436
|
-
skipWebpackInstall: false,
|
|
437
|
-
skipTest: false,
|
|
438
|
-
skipActionCable: false,
|
|
439
|
-
skipActionMailer: false,
|
|
440
|
-
skipActionMailbox: false,
|
|
441
|
-
skipActiveStorage: false,
|
|
442
|
-
skipActionText: false,
|
|
443
|
-
skipActiveRecord: false,
|
|
444
|
-
force: true,
|
|
445
|
-
api: true,
|
|
446
|
-
webpacker: "react",
|
|
447
|
-
database: "sqlite3",
|
|
448
|
-
railsVersion: "master"
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
]
|
|
454
|
-
})
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
description: "Fetch and template a Rails app with specific database and Active Storage enabled",
|
|
458
|
-
example: yaml__default.default.stringify({
|
|
459
|
-
steps: [
|
|
460
|
-
{
|
|
461
|
-
id: "fetchTemplate",
|
|
462
|
-
action: "fetch:rails",
|
|
463
|
-
name: "Fetch and Template Rails App",
|
|
464
|
-
input: {
|
|
465
|
-
url: "https://github.com/backstage/backstage",
|
|
466
|
-
values: {
|
|
467
|
-
railsArguments: {
|
|
468
|
-
minimal: false,
|
|
469
|
-
skipBundle: false,
|
|
470
|
-
skipWebpackInstall: false,
|
|
471
|
-
skipTest: false,
|
|
472
|
-
skipActionCable: false,
|
|
473
|
-
skipActionMailer: false,
|
|
474
|
-
skipActionMailbox: false,
|
|
475
|
-
skipActiveStorage: false,
|
|
476
|
-
skipActionText: false,
|
|
477
|
-
skipActiveRecord: false,
|
|
478
|
-
force: true,
|
|
479
|
-
api: true,
|
|
480
|
-
webpacker: "vue",
|
|
481
|
-
database: "postgresql",
|
|
482
|
-
railsVersion: "fromImage"
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
]
|
|
488
|
-
})
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
description: "Fetch and template a Rails app with full options including database and skip options",
|
|
492
|
-
example: yaml__default.default.stringify({
|
|
493
|
-
steps: [
|
|
494
|
-
{
|
|
495
|
-
id: "fetchTemplate",
|
|
496
|
-
action: "fetch:rails",
|
|
497
|
-
name: "Fetch and Template Rails App",
|
|
498
|
-
input: {
|
|
499
|
-
url: "https://github.com/backstage/backstage",
|
|
500
|
-
values: {
|
|
501
|
-
railsArguments: {
|
|
502
|
-
minimal: false,
|
|
503
|
-
skipBundle: true,
|
|
504
|
-
skipWebpackInstall: true,
|
|
505
|
-
skipTest: true,
|
|
506
|
-
skipActionCable: true,
|
|
507
|
-
skipActionMailer: true,
|
|
508
|
-
skipActionMailbox: true,
|
|
509
|
-
skipActiveStorage: true,
|
|
510
|
-
skipActionText: true,
|
|
511
|
-
skipActiveRecord: true,
|
|
512
|
-
force: false,
|
|
513
|
-
api: false,
|
|
514
|
-
webpacker: "stimulus",
|
|
515
|
-
database: "sqlite3",
|
|
516
|
-
railsVersion: "dev"
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
]
|
|
522
|
-
})
|
|
523
|
-
}
|
|
524
|
-
];
|
|
525
|
-
|
|
526
|
-
function createFetchRailsAction(options) {
|
|
527
|
-
const { reader, integrations, containerRunner } = options;
|
|
528
|
-
return pluginScaffolderNode.createTemplateAction({
|
|
529
|
-
id: "fetch:rails",
|
|
530
|
-
description: "Downloads a template from the given `url` into the workspace, and runs a rails new generator on it.",
|
|
531
|
-
examples,
|
|
532
|
-
schema: {
|
|
533
|
-
input: {
|
|
534
|
-
type: "object",
|
|
535
|
-
required: ["url"],
|
|
536
|
-
properties: {
|
|
537
|
-
url: {
|
|
538
|
-
title: "Fetch URL",
|
|
539
|
-
description: "Relative path or absolute URL pointing to the directory tree to fetch",
|
|
540
|
-
type: "string"
|
|
541
|
-
},
|
|
542
|
-
targetPath: {
|
|
543
|
-
title: "Target Path",
|
|
544
|
-
description: "Target path within the working directory to download the contents to.",
|
|
545
|
-
type: "string"
|
|
546
|
-
},
|
|
547
|
-
values: {
|
|
548
|
-
title: "Template Values",
|
|
549
|
-
description: "Values to pass on to rails for templating",
|
|
550
|
-
type: "object",
|
|
551
|
-
properties: {
|
|
552
|
-
railsArguments: {
|
|
553
|
-
title: "Arguments to pass to new command",
|
|
554
|
-
description: "You can provide some arguments to create a custom app",
|
|
555
|
-
type: "object",
|
|
556
|
-
properties: {
|
|
557
|
-
minimal: {
|
|
558
|
-
title: "minimal",
|
|
559
|
-
description: "Preconfigure a minimal rails app",
|
|
560
|
-
type: "boolean"
|
|
561
|
-
},
|
|
562
|
-
skipBundle: {
|
|
563
|
-
title: "skipBundle",
|
|
564
|
-
description: "Don't run bundle install",
|
|
565
|
-
type: "boolean"
|
|
566
|
-
},
|
|
567
|
-
skipWebpackInstall: {
|
|
568
|
-
title: "skipWebpackInstall",
|
|
569
|
-
description: "Don't run Webpack install",
|
|
570
|
-
type: "boolean"
|
|
571
|
-
},
|
|
572
|
-
skipTest: {
|
|
573
|
-
title: "skipTest",
|
|
574
|
-
description: "Skip test files",
|
|
575
|
-
type: "boolean"
|
|
576
|
-
},
|
|
577
|
-
skipActionCable: {
|
|
578
|
-
title: "skipActionCable",
|
|
579
|
-
description: "Skip Action Cable files",
|
|
580
|
-
type: "boolean"
|
|
581
|
-
},
|
|
582
|
-
skipActionMailer: {
|
|
583
|
-
title: "skipActionMailer",
|
|
584
|
-
description: "Skip Action Mailer files",
|
|
585
|
-
type: "boolean"
|
|
586
|
-
},
|
|
587
|
-
skipActionMailbox: {
|
|
588
|
-
title: "skipActionMailbox",
|
|
589
|
-
description: "Skip Action Mailbox gem",
|
|
590
|
-
type: "boolean"
|
|
591
|
-
},
|
|
592
|
-
skipActiveStorage: {
|
|
593
|
-
title: "skipActiveStorage",
|
|
594
|
-
description: "Skip Active Storage files",
|
|
595
|
-
type: "boolean"
|
|
596
|
-
},
|
|
597
|
-
skipActionText: {
|
|
598
|
-
title: "skipActionText",
|
|
599
|
-
description: "Skip Action Text gem",
|
|
600
|
-
type: "boolean"
|
|
601
|
-
},
|
|
602
|
-
skipActiveRecord: {
|
|
603
|
-
title: "skipActiveRecord",
|
|
604
|
-
description: "Skip Active Record files",
|
|
605
|
-
type: "boolean"
|
|
606
|
-
},
|
|
607
|
-
force: {
|
|
608
|
-
title: "force",
|
|
609
|
-
description: "Overwrite files that already exist",
|
|
610
|
-
type: "boolean"
|
|
611
|
-
},
|
|
612
|
-
api: {
|
|
613
|
-
title: "api",
|
|
614
|
-
description: "Preconfigure smaller stack for API only apps",
|
|
615
|
-
type: "boolean"
|
|
616
|
-
},
|
|
617
|
-
template: {
|
|
618
|
-
title: "template",
|
|
619
|
-
description: "Path to some application template (can be a filesystem path or URL)",
|
|
620
|
-
type: "string"
|
|
621
|
-
},
|
|
622
|
-
webpacker: {
|
|
623
|
-
title: "webpacker",
|
|
624
|
-
description: "Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus)",
|
|
625
|
-
type: "string",
|
|
626
|
-
enum: ["react", "vue", "angular", "elm", "stimulus"]
|
|
627
|
-
},
|
|
628
|
-
database: {
|
|
629
|
-
title: "database",
|
|
630
|
-
description: "Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)",
|
|
631
|
-
type: "string",
|
|
632
|
-
enum: [
|
|
633
|
-
"mysql",
|
|
634
|
-
"postgresql",
|
|
635
|
-
"sqlite3",
|
|
636
|
-
"oracle",
|
|
637
|
-
"sqlserver",
|
|
638
|
-
"jdbcmysql",
|
|
639
|
-
"jdbcsqlite3",
|
|
640
|
-
"jdbcpostgresql",
|
|
641
|
-
"jdbc"
|
|
642
|
-
]
|
|
643
|
-
},
|
|
644
|
-
railsVersion: {
|
|
645
|
-
title: "Rails version in Gemfile",
|
|
646
|
-
description: "Set up the application with Gemfile pointing to a specific version (options: fromImage, dev, edge, master)",
|
|
647
|
-
type: "string",
|
|
648
|
-
enum: ["dev", "edge", "master", "fromImage"]
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
},
|
|
654
|
-
imageName: {
|
|
655
|
-
title: "Rails Docker image",
|
|
656
|
-
description: "Specify a Docker image to run rails new. Used only when a local rails is not found.",
|
|
657
|
-
type: "string"
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
async handler(ctx) {
|
|
663
|
-
ctx.logger.info("Fetching and then templating using rails");
|
|
664
|
-
const workDir = await ctx.createTemporaryDirectory();
|
|
665
|
-
const resultDir = path.resolve(workDir, "result");
|
|
666
|
-
await pluginScaffolderNode.fetchContents({
|
|
667
|
-
reader,
|
|
668
|
-
integrations,
|
|
669
|
-
baseUrl: ctx.templateInfo?.baseUrl,
|
|
670
|
-
fetchUrl: ctx.input.url,
|
|
671
|
-
outputPath: workDir
|
|
672
|
-
});
|
|
673
|
-
const templateRunner = new RailsNewRunner({ containerRunner });
|
|
674
|
-
const { imageName } = ctx.input;
|
|
675
|
-
if (imageName && !options.allowedImageNames?.includes(imageName)) {
|
|
676
|
-
throw new Error(`Image ${imageName} is not allowed`);
|
|
677
|
-
}
|
|
678
|
-
const logStream = new stream.PassThrough();
|
|
679
|
-
logStream.on("data", (chunk) => {
|
|
680
|
-
ctx.logger.info(chunk.toString());
|
|
681
|
-
});
|
|
682
|
-
await templateRunner.run({
|
|
683
|
-
workspacePath: workDir,
|
|
684
|
-
logStream,
|
|
685
|
-
values: { ...ctx.input.values, imageName }
|
|
686
|
-
});
|
|
687
|
-
const targetPath = ctx.input.targetPath ?? "./";
|
|
688
|
-
const outputPath = path.resolve(ctx.workspacePath, targetPath);
|
|
689
|
-
if (!outputPath.startsWith(ctx.workspacePath)) {
|
|
690
|
-
throw new errors.InputError(
|
|
691
|
-
`Fetch action targetPath may not specify a path outside the working directory`
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
|
-
await fs__default.default.copy(resultDir, outputPath);
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
const railsModule = backendPluginApi.createBackendModule({
|
|
700
|
-
pluginId: "scaffolder",
|
|
701
|
-
moduleId: "rails",
|
|
702
|
-
register({ registerInit }) {
|
|
703
|
-
registerInit({
|
|
704
|
-
deps: {
|
|
705
|
-
scaffolder: alpha.scaffolderActionsExtensionPoint,
|
|
706
|
-
config: backendPluginApi.coreServices.rootConfig,
|
|
707
|
-
reader: backendPluginApi.coreServices.urlReader
|
|
708
|
-
},
|
|
709
|
-
async init({ scaffolder, config, reader }) {
|
|
710
|
-
const integrations = integration.ScmIntegrations.fromConfig(config);
|
|
711
|
-
scaffolder.addActions(createFetchRailsAction({ integrations, reader }));
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
});
|
|
716
|
-
|
|
717
|
-
exports.createFetchRailsAction = createFetchRailsAction;
|
|
718
|
-
exports.default = railsModule;
|
|
10
|
+
exports.createFetchRailsAction = index.createFetchRailsAction;
|
|
11
|
+
exports.default = module$1.railsModule;
|
|
719
12
|
//# sourceMappingURL=index.cjs.js.map
|