@verdnatura/myt 2.0.2 → 2.0.3

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.
Files changed (4) hide show
  1. package/README.md +18 -13
  2. package/myt-run.js +32 -10
  3. package/myt.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -62,7 +62,13 @@ Local server management commands:
62
62
  * **run**: Build and start local database server container.
63
63
  * **start**: Start local database server container.
64
64
 
65
- Each command can have its own specific commandline options.
65
+ Each command can have its own specific commandline options, you can see them by
66
+ running the command along with the _--help_ parameter, only the most commonly
67
+ used ones are documented here.
68
+
69
+ ```text
70
+ $ myt <command> [<args>] [-h|--help]
71
+ ```
66
72
 
67
73
  ### Usage as library
68
74
 
@@ -225,16 +231,15 @@ should be named like this: `filename.foo.sql`.
225
231
  Initializes an empty workspace.
226
232
 
227
233
  ```text
228
- $ myt init
234
+ $ myt init [<args>]
229
235
  ```
230
236
 
231
-
232
237
  ### pull
233
238
 
234
239
  Incorporates database routine changes into workspace.
235
240
 
236
241
  ```text
237
- $ myt pull [remote] [-f|--force] [-c|--checkout] [-u|--update] [-s|--sums]
242
+ $ myt pull [<args>] [-f|--force] [<remote>]
238
243
  ```
239
244
 
240
245
  When *--checkout* option is provided, it does the following before export:
@@ -247,7 +252,7 @@ When *--checkout* option is provided, it does the following before export:
247
252
  Applies versions and routine changes into database.
248
253
 
249
254
  ```text
250
- $ myt push [<remote>] [-f|--force] [-c|--commit] [-s|--sums] [-t|--triggers]
255
+ $ myt push [<args>] [-f|--force] [-c|--commit] [<remote>]
251
256
  ```
252
257
 
253
258
  Commit is saved into database only if *--commit* option is provided, it
@@ -261,7 +266,7 @@ Creates a new version folder, when name is not specified it generates a random
261
266
  name mixing a color with a plant name.
262
267
 
263
268
  ```text
264
- $ myt version [<name>]
269
+ $ myt version [<args>] [<name>]
265
270
  ```
266
271
 
267
272
  ### create
@@ -269,7 +274,7 @@ $ myt version [<name>]
269
274
  Creates a new routine file with a default template.
270
275
 
271
276
  ```text
272
- $ myt create [-t <type>] <schema>.<name>
277
+ $ myt create [<args>] [-t <type>] <schema>.<name>
273
278
  ```
274
279
 
275
280
  ### clean
@@ -288,7 +293,7 @@ Exports database structure and fixtures from remote into hidden files located
288
293
  in *dump* folder. If no remote is specified *production* is used.
289
294
 
290
295
  ```text
291
- $ myt dump [<remote>] [-l|--lock] [-t|--triggers]
296
+ $ myt dump [<args>] [-l|--lock] [<remote>]
292
297
  ```
293
298
 
294
299
  ### fixtures
@@ -297,7 +302,7 @@ Exports local database fixtures into *dump/fixtures.sql* files. If no remote is
297
302
  specified *local* is used.
298
303
 
299
304
  ```text
300
- $ myt fixtures [<remote>]
305
+ $ myt fixtures [<args>] [<remote>]
301
306
  ```
302
307
 
303
308
  ### build
@@ -306,7 +311,7 @@ Builds local database server image. It only rebuilds the image when sources
306
311
  have been modified.
307
312
 
308
313
  ```text
309
- $ myt build [-n|--name] [-t|--tag] [-f|--force] [-m|--realm <string>]
314
+ $ myt build [<args>] [-n|--name] [-t|--tag] [-f|--force] [<realm>]
310
315
  ```
311
316
 
312
317
  ### apply
@@ -315,7 +320,7 @@ Applies structure, fixtures and changes to database. Primarily used by the
315
320
  build command to rebuild the local database.
316
321
 
317
322
  ```text
318
- $ myt apply [-s|--structure] [-c|--changes] [-m|--realm <string>] [-l|--load <string>]
323
+ $ myt apply [<args>] [<realm>]
319
324
  ```
320
325
 
321
326
  ### run
@@ -324,7 +329,7 @@ Builds and starts local database server container. It only rebuilds the image
324
329
  when dump have been modified.
325
330
 
326
331
  ```text
327
- $ myt run [<realm>|-m|--realm <string>] [-c|--ci] [-r|--random] [-p|--persist] [-k|--keep] [-n|--network <string>] [-i|--ip]
332
+ $ myt run [<args>] [-c|--ci] [-r|--random] [<realm>]
328
333
  ```
329
334
 
330
335
  ### start
@@ -335,7 +340,7 @@ mind that when you do not rebuild the docker you may be using an outdated
335
340
  version of it.
336
341
 
337
342
  ```text
338
- $ myt start
343
+ $ myt start [<args>]
339
344
  ```
340
345
 
341
346
  ## Why
package/myt-run.js CHANGED
@@ -13,36 +13,46 @@ class Run extends Command {
13
13
  static usage = {
14
14
  description: 'Build and start local database server container',
15
15
  params: {
16
- ci: 'Workaround for continuous integration system',
17
16
  network: 'Docker network to attach container to',
18
17
  random: 'Whether to use a random container name and port',
19
18
  persist: 'Whether to not use tmpfs mount for MySQL data',
20
19
  keep: 'Keep container on failure',
21
20
  realm: 'Name of fixture realm to use',
22
- ip: 'Bind to container IP instead of localhost'
21
+ ip: 'Bind to container IP instead of localhost',
22
+ build: 'Whether to skip image build',
23
+ name: 'Built image name',
24
+ tag: 'Built image tag',
25
+ force: 'Whether to force build'
23
26
  },
24
27
  operand: 'realm'
25
28
  };
26
29
 
27
30
  static args = {
28
31
  alias: {
29
- network: 'n',
32
+ network: 'e',
30
33
  random: 'r',
31
34
  persist: 'p',
32
35
  keep: 'k',
33
- realm: 'm',
34
- ip: 'i'
36
+ ip: 'i',
37
+ build: 'b',
38
+ name: 'n',
39
+ tag: 't',
40
+ force: 'f',
41
+ realm: 'm'
35
42
  },
36
43
  string: [
37
44
  'network',
45
+ 'name',
46
+ 'tag',
38
47
  'realm'
39
48
  ],
40
49
  boolean: [
41
- 'ci',
42
50
  'random',
43
51
  'persist',
44
52
  'keep',
45
- 'ip'
53
+ 'ip',
54
+ 'build',
55
+ 'force'
46
56
  ]
47
57
  };
48
58
 
@@ -55,9 +65,21 @@ class Run extends Command {
55
65
  };
56
66
 
57
67
  async _run(myt, ctx, cfg, opts) {
58
- const tag = await myt.run(Build, {
59
- realm: opts.realm
60
- });
68
+ let tag;
69
+
70
+ if (!opts.build) {
71
+ tag = await myt.run(Build, {
72
+ name: opts.name,
73
+ tag: opts.tag,
74
+ force: opts.force,
75
+ realm: opts.realm
76
+ });
77
+ } else {
78
+ if (!opts.name)
79
+ throw new Error('Build ommitted but no image passed');
80
+ tag = opts.name;
81
+ if (opts.tag) tag += `:${opts.tag}`;
82
+ }
61
83
 
62
84
  this.emit('runningContainer');
63
85
 
package/myt.js CHANGED
@@ -125,7 +125,7 @@ class Myt {
125
125
  }
126
126
 
127
127
  if (opts.help) {
128
- this.showHelp(Command.opts, Command.usage, commandName);
128
+ this.showHelp(Command.args, Command.usage, commandName);
129
129
  process.exit(0);
130
130
  }
131
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdnatura/myt",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "author": "Verdnatura Levante SL",
5
5
  "description": "MySQL version control",
6
6
  "license": "GPL-3.0",