This repository was archived by the owner on Nov 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathHelp.rb
More file actions
484 lines (374 loc) · 15.2 KB
/
Help.rb
File metadata and controls
484 lines (374 loc) · 15.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
class Help
def self.usage
<<-DOC.strip_heredoc
Usage:
ml [ENVIRONMENT] COMMAND [ARGS]
General commands (no environment):
init Creates configuration files for you to customize
initcpf Creates cpf configuration files for you to customize
jar Creates a Roxy jar
new Creates a new project directory structure
upgrade Upgrades the Roxy files
Scaffolding commands (no environment):
create Creates a controller, model, test or layout
index Adds an index to the configuration
extend Creates a REST API service extension
transform Creates a REST API transformation
Bootstrapping commands (with environment):
bootstrap Configures your application on the given environment
capture Captures the source code of an existing App Builder application
clean Removes all files from the cpf, modules, or content databases on the given environment
credentials Configures user and password for the given environment
info Returns settings for the given environment
restart Restarts the given environment
wipe Removes your application from the given environment
Deployment/Data commands (with environment):
corb Runs Corb against the given environment
deploy Loads modules, data, cpf configuration into the given environment
load Loads a file or folder into the given environment
mlcp Runs MLCP against the given environment
recordloader Runs RecordLoader against the given environment
test Runs xquery unit tests against the given environment
xqsync Runs XQSync against the given environment
All commands can be run with -h or --help for more information.
DOC
end
def self.create
case ARGV.shift
when 'controller'
<<-DOC.strip_heredoc
Usage: ml create controller[/function] [format] [options]
General options:
-v, [--verbose] # Verbose output
controller/function is the name of the controller and function.
The function is optional. If a function is omitted then main is assumed.
Format can be (none | html | xml | json). If no format is provided then
html is assumed. When "none" is provided no view is created.
ex: ml create search/facet
This will create a controller named search.xqy containing
a function named search().
Html is assumed for the format thus a file named
views/search/facet.html.xqy will be created.
DOC
when 'model'
<<-DOC.strip_heredoc
Usage: ml create model model_name [file_name] [options]
General options:
-v, [--verbose] # Verbose output
model_name is the name of the model you wish to create.
file_name: You may optionally specify a file name. By default
the file will have the same name as the model.
ex: ml create model search
This will create a model named search in /app/models/search.xqy.
The namespace will be "http://marklogic.com/roxy/models/search".
ex: ml create model search search-lib.xqy
This will create a model named search.xqy in /app/models/search-lib.xqy.
The namespace will be "http://marklogic.com/roxy/models/search".
DOC
when 'test'
<<-DOC.strip_heredoc
Usage: ml create test suite_name[/test] [options]
General options:
-v, [--verbose] # Verbose output
suite_name is the name of the suite you wish to create.
test: You may optionally specify the name of a test. If you omit test
then only the suite folder will be created
ex: ml create test users
This will create a test suite named users in /test/suites/users/.
ex: ml create model users/login
This will create a test named login in /test/suites/users/login.xqy.
DOC
when 'layout'
<<-DOC.strip_heredoc
Usage: ml create layout layout_name [format] [options]
General options:
-v, [--verbose] # Verbose output
layout_name is the name of the layout you wish to create.
format can be (html | xml | json). If no format is provided then
html is assumed.
ex: ml create layout mobile
This will create a layout named mobile in /app/views/layouts/mobile.html.xqy.
ex: ml create layout mobile json
This will create a layout named mobile in /app/views/layouts/mobile.json.xqy.
DOC
else
<<-DOC.strip_heredoc
Usage: ml create controller[/function] [format] [options] or
ml create model model_name [file_name] [options] or
ml create test suite_name [test] [options] or
ml create layout layout_name [format] [options]
General options:
-v, [--verbose] # Verbose output
For more details on each type use:
ml create controller -h|--help
ml create model -h|--help
ml create test -h|--help
ml create layout -h|--help
DOC
end
end
def self.credentials
<<-DOC.strip_heredoc
Usage: ml {env} credentials
Prompts the user for admin credentials and writes them into the appropriate properties file
DOC
end
def self.info
<<-DOC.strip_heredoc
Usage: ml {env} info [options]
General options:
-v, [--verbose] # Verbose output
Displays the properties for the given environment
DOC
end
def self.init
<<-DOC.strip_heredoc
Usage: ml init [application-name] [options]
Optional Parameters:
application-name # The name of your application
Required option:
--server-version=version-number # Version of target MarkLogic Server
# Must be 4, 5, 6, or 7
General options:
--force # Force reset all configuration files
--force-properties # Force reset the properties file. (build.properties)
--force-config # Force reset the configuration file (ml-config.xml)
-v, [--verbose] # Verbose output
Initializes your application by creating the necessary config files.
DOC
end
def self.initcpf
<<-DOC.strip_heredoc
Usage: ml initcpf [options]
General options:
-v, [--verbose] # Verbose output
--force # Force reset the config file
Initializes the necessary config files for cpf
DOC
end
def self.restart
<<-DOC.strip_heredoc
Usage: ml {env} restart [group] [options]
General options:
-v, [--verbose] # Verbose output
Restart the MarkLogic process in the given environment on each host in the
specified group. If no group is specified, restart the MarkLogic process
on each host in the group to which the target host belongs.
DOC
end
def self.bootstrap
<<-DOC.strip_heredoc
Usage: ml {env} bootstrap [options]
General options:
-v, [--verbose] # Verbose output
Bootstraps your application to the MarkLogic server in the given
environment.
DOC
end
def self.wipe
<<-DOC.strip_heredoc
Usage: ml {env} wipe [options]
General options:
-v, [--verbose] # Verbose output
Removes all traces of your application on the MarkLogic serverin the given
environment.
DOC
end
def self.deploy
<<-DOC.strip_heredoc
Usage: ml {env} deploy WHAT [options]
General options:
-v, [--verbose] # Verbose output
--batch=(yes|no) # enable or disable batch commit. By default
batch is disabled for the local environment
and enabled for all others.
Please choose a WHAT below.
modules # deploys code to your modules db in the given environment
content # deploys content to your content db in the given environment
schemas # deploys schemas to your schemas db in the given environment
cpf # deploys your cpf config to the server in the given environment
rest # deploys your rest extensions to the server in the given environment
DOC
end
def self.load
<<-DOC.strip_heredoc
Usage: ml {env} load {/path/to/file-to-load} [options]
General options:
-v, [--verbose] # Verbose output
--db=your-db-name # The name of the database to load into
defaults to your content database
--remove-prefix=/prefix/to/remove # The file path prefix to remove
DOC
end
def self.clean
<<-DOC.strip_heredoc
Usage: ml {env} clean WHAT [options]
General options:
-v, [--verbose] # Verbose output
Please choose a WHAT below.
modules # removes all data from the modules db in the given environment
content # removes all data from the content db in the given environment
schemas # removes all data from the schemas db in the given environment
cpf # removes your cpf config from the server in the given environment
DOC
end
def self.test
<<-DOC.strip_heredoc
Usage: ml {env} test [options]
General options:
-v, [--verbose] # Verbose output
--skip-test-teardown # Skip teardown after each test
--skip-suite-teardown # Skip teardown after each suite
Runs your xquery unit tests on the given environment
DOC
end
def self.recordloader
<<-DOC.strip_heredoc
Usage: ml {env} recordloader configfile [options]
configfile must be a relative or absolute path to a Java properties file.
See http://marklogic.github.com/recordloader/
General options:
-v, [--verbose] # Verbose output
Runs recordloader with the given properties file. Properties files employ
variable substitution.
You may use variables like:
INPUT_PATH=${ml.data.dir}/
DOC
end
def self.xqsync
<<-DOC.strip_heredoc
Usage: ml {env} xqsync configfile [options]
configfile must be a relative or absolute path to a Java properties file.
See http://marklogic.github.com/xqsync/
General options:
-v, [--verbose] # Verbose output
Runs xqsync with the given properties file. Properties files employ variable
substitution.
You may use variables like:
INPUT_PACKAGE=${ml.data.dir}/
DOC
end
def self.corb
<<-DOC.strip_heredoc
Usage: ml {env} corb [options]
See: http://marklogic.github.com/corb/index.html
Required options:
--modules=/path/to/modules.xqy # the xquery module to process the data
(Only one of the following is required)
--collection=collection-name # the name of a collection to process
--uris=/path/to/uris-module.xqy # path to a uris module
Corb Options:
--threads=1 # the thread count to use
--root=/ # the root of the modules database
--install=false # whether or not to install (default: false)
General options:
-v, [--verbose] # Verbose output
DOC
end
def self.mlcp
<<-DOC.strip_heredoc
Usage: ml {env} mlcp [options]
Runs MLCP with given command-line options agains selected environment.
MLCP supports options files natively using the -option_file parameter.
The path must a relative or absolute path to a MLCP options file.
See http://docs.marklogic.com/guide/ingestion/content-pump#chapter
General options:
-v, [--verbose] # Verbose output
-h, [--help] # Shows this help
Roxy applies variable substitution within option files. You may use variables like:
-input_file_path
${ml.data.dir}/
DOC
end
def self.plugin
<<-DOC.strip_heredoc
Usage: ml {env} plugin [command] [package] [version] [options]
command:
(install|remove|list|refresh)
package:
Name of a depx package
version:
Package Version
General options:
-v, [--verbose] # Verbose output
DOC
end
def self.index
<<-DOC.strip_heredoc
Usage: ml index
ml will ask questions to help you build an index
DOC
end
def self.extend
<<-DOC.strip_heredoc
Usage: ml extend [prefix:]extension
Create a REST API service extension with the provided name. If a prefix
is provided, it will be used in the extension module.
Example:
$ ml extend ml:tag
will create a tag.xqy library module in your rest-ext directory, using
the "ml" prefix for the functions.
DOC
end
def self.transform
<<-DOC.strip_heredoc
Usage: ml transform [prefix:]name [type]
Create a REST API transformation with the provided name. By default,
the transform will be XSLT.
prefix:
The prefix will be used as the namespace prefix.
name:
This name will be used for the file in which the transform is stored
and the name used when deploying to MarkLogic.
type:
(xslt|xqy)
Example:
$ ml transform ex:sample
will create a sample.xsl file in your rest-transform directory,
using the "ex" namespace prefix.
Example:
$ ml transform sample
will create a sample.xsl file in your rest-transform directory.
Example:
$ ml transform sample xqy
will create a sample.xqy library module in your rest-transform directory,
using a built-in value as the prefix for the functions.
DOC
end
def self.upgrade
<<-DOC.strip_heredoc
Usage: ml upgrade --branch=[dev|master]
Upgrades Roxy files in the current project, using files from the
specified branch on GitHub. Any project will have its deploy directory
upgraded. Projects of app-type "mvc" or "hybrid" will also have their
src/roxy/ directory upgraded.
branch: (required)
The name of the Roxy GitHub branch to use for the upgrade.
DOC
end
def self.capture
<<-DOC.strip_heredoc
Usage: ml {env} capture --modules-db=[name of modules database]
Captures the source and REST API configuration for an existing
Application Builder-based application.
modules-db: (required)
The modules database of the App Builder application.
DOC
end
def self.jar
<<-DOC.strip_heredoc
Usage: ml jar
General options:
-v, [--verbose] # Verbose output
Prerequisites:
- You must be running JRuby http://jruby.org/
- You must have the warbler gem installed
> gem install warbler
DOC
end
def self.doHelp(logger, command, error_message = nil)
logger.info "" if error_message
logger.error "#{error_message}" if error_message
logger.info Help.send(command)
end
end