rbcli 0.1.10 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/Gemfile.lock +12 -12
  5. data/LICENSE.txt +674 -21
  6. data/README.md +80 -443
  7. data/bin/console +19 -0
  8. data/bin/setup +20 -0
  9. data/docs/404.html +639 -0
  10. data/docs/advanced/automatic_updates/index.html +791 -0
  11. data/docs/advanced/command_types/index.html +946 -0
  12. data/docs/advanced/distributed_state_locking/index.html +777 -0
  13. data/docs/advanced/hooks/index.html +836 -0
  14. data/docs/advanced/state_storage/index.html +957 -0
  15. data/docs/advanced/user_config_files/index.html +818 -0
  16. data/docs/assets/fonts/font-awesome.css +4 -0
  17. data/docs/assets/fonts/material-icons.css +13 -0
  18. data/docs/assets/fonts/specimen/FontAwesome.ttf +0 -0
  19. data/docs/assets/fonts/specimen/FontAwesome.woff +0 -0
  20. data/docs/assets/fonts/specimen/FontAwesome.woff2 +0 -0
  21. data/docs/assets/fonts/specimen/MaterialIcons-Regular.ttf +0 -0
  22. data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff +0 -0
  23. data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff2 +0 -0
  24. data/docs/assets/images/favicon.png +0 -0
  25. data/docs/assets/images/icons/bitbucket.1b09e088.svg +20 -0
  26. data/docs/assets/images/icons/github.f0b8504a.svg +18 -0
  27. data/docs/assets/images/icons/gitlab.6dd19c00.svg +38 -0
  28. data/docs/assets/javascripts/application.a59e2a89.js +1 -0
  29. data/docs/assets/javascripts/lunr/lunr.da.js +1 -0
  30. data/docs/assets/javascripts/lunr/lunr.de.js +1 -0
  31. data/docs/assets/javascripts/lunr/lunr.du.js +1 -0
  32. data/docs/assets/javascripts/lunr/lunr.es.js +1 -0
  33. data/docs/assets/javascripts/lunr/lunr.fi.js +1 -0
  34. data/docs/assets/javascripts/lunr/lunr.fr.js +1 -0
  35. data/docs/assets/javascripts/lunr/lunr.hu.js +1 -0
  36. data/docs/assets/javascripts/lunr/lunr.it.js +1 -0
  37. data/docs/assets/javascripts/lunr/lunr.jp.js +1 -0
  38. data/docs/assets/javascripts/lunr/lunr.multi.js +1 -0
  39. data/docs/assets/javascripts/lunr/lunr.no.js +1 -0
  40. data/docs/assets/javascripts/lunr/lunr.pt.js +1 -0
  41. data/docs/assets/javascripts/lunr/lunr.ro.js +1 -0
  42. data/docs/assets/javascripts/lunr/lunr.ru.js +1 -0
  43. data/docs/assets/javascripts/lunr/lunr.stemmer.support.js +1 -0
  44. data/docs/assets/javascripts/lunr/lunr.sv.js +1 -0
  45. data/docs/assets/javascripts/lunr/lunr.tr.js +1 -0
  46. data/docs/assets/javascripts/lunr/tinyseg.js +1 -0
  47. data/docs/assets/javascripts/modernizr.1aa3b519.js +1 -0
  48. data/docs/assets/stylesheets/application-palette.6079476c.css +2 -0
  49. data/docs/assets/stylesheets/application.ba0fd1a6.css +2 -0
  50. data/docs/development/code_of_conduct/index.html +883 -0
  51. data/docs/development/contributing/index.html +744 -0
  52. data/docs/development/license/index.html +715 -0
  53. data/docs/imported/changelog/index.html +853 -0
  54. data/docs/imported/quick_reference/index.html +1057 -0
  55. data/docs/index.html +732 -0
  56. data/docs/search/search_index.json +569 -0
  57. data/docs/sitemap.xml +93 -0
  58. data/docs/tutorial/10-getting_started/index.html +806 -0
  59. data/docs/tutorial/20-project_layout/index.html +972 -0
  60. data/docs/tutorial/30-your_first_command/index.html +906 -0
  61. data/docs/tutorial/40-options_parameters_and_arguments/index.html +1049 -0
  62. data/docs/tutorial/50-publishing/index.html +838 -0
  63. data/docs/whoami/index.html +709 -0
  64. data/docs-src/docs/advanced/automatic_updates.md +42 -0
  65. data/docs-src/docs/advanced/command_types.md +144 -0
  66. data/docs-src/docs/advanced/distributed_state_locking.md +33 -0
  67. data/docs-src/docs/advanced/hooks.md +65 -0
  68. data/docs-src/docs/advanced/logging.md +35 -0
  69. data/docs-src/docs/advanced/state_storage.md +117 -0
  70. data/docs-src/docs/advanced/user_config_files.md +47 -0
  71. data/docs-src/docs/development/code_of_conduct.md +74 -0
  72. data/docs-src/docs/development/contributing.md +49 -0
  73. data/docs-src/docs/development/license.md +10 -0
  74. data/docs-src/docs/imported/changelog.md +31 -0
  75. data/docs-src/docs/imported/quick_reference.md +150 -0
  76. data/docs-src/docs/index.md +38 -0
  77. data/docs-src/docs/tutorial/10-getting_started.md +41 -0
  78. data/docs-src/docs/tutorial/20-project_layout.md +115 -0
  79. data/docs-src/docs/tutorial/30-your_first_command.md +126 -0
  80. data/docs-src/docs/tutorial/40-options_parameters_and_arguments.md +251 -0
  81. data/docs-src/docs/tutorial/50-publishing.md +47 -0
  82. data/docs-src/docs/whoami.md +28 -0
  83. data/docs-src/makesite.sh +14 -0
  84. data/docs-src/mkdocs.yml +76 -0
  85. data/docs-src/runsite.sh +3 -0
  86. data/exe/rbcli +76 -5
  87. data/lib/rbcli/autoupdate/autoupdate.rb +24 -4
  88. data/lib/rbcli/autoupdate/gem_updater.rb +23 -2
  89. data/lib/rbcli/autoupdate/github_updater.rb +22 -1
  90. data/lib/rbcli/configuration/config.rb +22 -1
  91. data/lib/rbcli/configuration/configurate.rb +24 -2
  92. data/lib/rbcli/engine/command.rb +26 -6
  93. data/lib/rbcli/engine/load_project.rb +29 -3
  94. data/lib/rbcli/engine/parser.rb +25 -4
  95. data/lib/rbcli/logging/logging.rb +21 -0
  96. data/lib/rbcli/scriptwrapping/scriptwrapper.rb +30 -11
  97. data/lib/rbcli/stateful_systems/configuratestorage.rb +20 -0
  98. data/lib/rbcli/stateful_systems/state_storage.rb +20 -0
  99. data/lib/rbcli/stateful_systems/storagetypes/localstate.rb +20 -0
  100. data/lib/rbcli/stateful_systems/storagetypes/remote_state_connectors/dynamodb.rb +20 -0
  101. data/lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb +20 -0
  102. data/lib/rbcli/util/hash_deep_symbolize.rb +43 -22
  103. data/lib/rbcli/util/string_colorize.rb +20 -0
  104. data/lib/rbcli/version.rb +21 -1
  105. data/lib/rbcli-tool/generators.rb +20 -0
  106. data/lib/rbcli-tool/mdless_fix.rb +20 -0
  107. data/lib/rbcli-tool/project.rb +27 -2
  108. data/lib/rbcli-tool/util.rb +20 -0
  109. data/lib/rbcli-tool.rb +20 -0
  110. data/lib/rbcli.rb +20 -0
  111. data/lib-sh/lib-rbcli.sh +19 -0
  112. data/rbcli.gemspec +22 -3
  113. data/skeletons/project/CODE_OF_CONDUCT.md +1 -1
  114. data/skeletons/project/README.md +17 -2
  115. data/skeletons/project/application/commands/command.erb +10 -8
  116. data/skeletons/project/application/commands/script.erb +3 -1
  117. data/skeletons/project/application/commands/scripts/script.sh +2 -2
  118. data/skeletons/project/application/options.rb +12 -3
  119. data/skeletons/project/config/autoupdate.rb +5 -2
  120. data/skeletons/project/config/storage.rb +7 -6
  121. data/skeletons/project/config/userspace.rb +6 -1
  122. data/skeletons/project/exe/executable +1 -1
  123. data/skeletons/project/lib/.keep +0 -0
  124. data/skeletons/project/untitled.gemspec +4 -4
  125. data/skeletons/project/{default_user_configs → userconf}/user_defaults.yml +0 -0
  126. metadata +85 -9
  127. data/examples/defaults.yml +0 -4
  128. data/examples/myscript.sh +0 -23
  129. data/examples/mytool +0 -95
@@ -0,0 +1,972 @@
1
+
2
+
3
+
4
+
5
+ <!DOCTYPE html>
6
+ <html lang="en" class="no-js">
7
+ <head>
8
+
9
+ <meta charset="utf-8">
10
+ <meta name="viewport" content="width=device-width,initial-scale=1">
11
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
12
+
13
+ <meta name="description" content="Description">
14
+
15
+
16
+
17
+ <meta name="author" content="Andrew Khoury">
18
+
19
+
20
+ <meta name="lang:clipboard.copy" content="Copy to clipboard">
21
+
22
+ <meta name="lang:clipboard.copied" content="Copied to clipboard">
23
+
24
+ <meta name="lang:search.language" content="en">
25
+
26
+ <meta name="lang:search.pipeline.stopwords" content="True">
27
+
28
+ <meta name="lang:search.pipeline.trimmer" content="True">
29
+
30
+ <meta name="lang:search.result.none" content="No matching documents">
31
+
32
+ <meta name="lang:search.result.one" content="1 matching document">
33
+
34
+ <meta name="lang:search.result.other" content="# matching documents">
35
+
36
+ <meta name="lang:search.tokenizer" content="[\s\-]+">
37
+
38
+ <link rel="shortcut icon" href="../../assets/images/favicon.png">
39
+ <meta name="generator" content="mkdocs-0.17.5, mkdocs-material-2.9.2">
40
+
41
+
42
+
43
+ <title>The Project Layout - RBCli Documentation</title>
44
+
45
+
46
+
47
+ <link rel="stylesheet" href="../../assets/stylesheets/application.ba0fd1a6.css">
48
+
49
+
50
+
51
+
52
+ <script src="../../assets/javascripts/modernizr.1aa3b519.js"></script>
53
+
54
+
55
+ <link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
56
+
57
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
58
+ <style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
59
+
60
+
61
+ <link rel="stylesheet" href="../../assets/fonts/material-icons.css">
62
+
63
+
64
+ </head>
65
+
66
+ <body dir="ltr">
67
+
68
+ <svg class="md-svg">
69
+ <defs>
70
+
71
+
72
+ <svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
73
+ viewBox="0 0 416 448" id="__github">
74
+ <path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
75
+ 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
76
+ 18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
77
+ 19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
78
+ 18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
79
+ 304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
80
+ 2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
81
+ 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
82
+ 37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
83
+ 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
84
+ 1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
85
+ 0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
86
+ 30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
87
+ 46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
88
+ 99.5z" />
89
+ </svg>
90
+
91
+ </defs>
92
+ </svg>
93
+ <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
94
+ <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
95
+ <label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
96
+
97
+ <a href="#the-project-layout" tabindex="1" class="md-skip">
98
+ Skip to content
99
+ </a>
100
+
101
+
102
+ <header class="md-header" data-md-component="header">
103
+ <nav class="md-header-nav md-grid">
104
+ <div class="md-flex">
105
+ <div class="md-flex__cell md-flex__cell--shrink">
106
+ <a href="../.." title="RBCli Documentation" class="md-header-nav__button md-logo">
107
+
108
+ <i class="md-icon">devices</i>
109
+
110
+ </a>
111
+ </div>
112
+ <div class="md-flex__cell md-flex__cell--shrink">
113
+ <label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
114
+ </div>
115
+ <div class="md-flex__cell md-flex__cell--stretch">
116
+ <div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
117
+
118
+
119
+ <span class="md-header-nav__topic">
120
+ RBCli Documentation
121
+ </span>
122
+ <span class="md-header-nav__topic">
123
+ The Project Layout
124
+ </span>
125
+
126
+
127
+ </div>
128
+ </div>
129
+ <div class="md-flex__cell md-flex__cell--shrink">
130
+
131
+
132
+ <label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
133
+
134
+ <div class="md-search" data-md-component="search" role="dialog">
135
+ <label class="md-search__overlay" for="__search"></label>
136
+ <div class="md-search__inner" role="search">
137
+ <form class="md-search__form" name="search">
138
+ <input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
139
+ <label class="md-icon md-search__icon" for="__search"></label>
140
+ <button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
141
+ &#xE5CD;
142
+ </button>
143
+ </form>
144
+ <div class="md-search__output">
145
+ <div class="md-search__scrollwrap" data-md-scrollfix>
146
+ <div class="md-search-result" data-md-component="result">
147
+ <div class="md-search-result__meta">
148
+ Type to start searching
149
+ </div>
150
+ <ol class="md-search-result__list"></ol>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </div>
156
+
157
+
158
+ </div>
159
+
160
+ <div class="md-flex__cell md-flex__cell--shrink">
161
+ <div class="md-header-nav__source">
162
+
163
+
164
+
165
+
166
+
167
+
168
+ <a href="https://github.com/akhoury6/rbcli/" title="Go to repository" class="md-source" data-md-source="github">
169
+
170
+ <div class="md-source__icon">
171
+ <svg viewBox="0 0 24 24" width="24" height="24">
172
+ <use xlink:href="#__github" width="24" height="24"></use>
173
+ </svg>
174
+ </div>
175
+
176
+ <div class="md-source__repository">
177
+ GitHub
178
+ </div>
179
+ </a>
180
+
181
+ </div>
182
+ </div>
183
+
184
+ </div>
185
+ </nav>
186
+ </header>
187
+
188
+ <div class="md-container">
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+ <nav class="md-tabs md-tabs--active" data-md-component="tabs">
198
+ <div class="md-tabs__inner md-grid">
199
+ <ul class="md-tabs__list">
200
+
201
+
202
+ <li class="md-tabs__item">
203
+
204
+ <a href="../.." title="Home" class="md-tabs__link">
205
+ Home
206
+ </a>
207
+
208
+ </li>
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+ <li class="md-tabs__item">
217
+
218
+ <a href="../10-getting_started/" title="Tutorial" class="md-tabs__link md-tabs__link--active">
219
+ Tutorial
220
+ </a>
221
+
222
+ </li>
223
+
224
+
225
+
226
+
227
+
228
+
229
+ <li class="md-tabs__item">
230
+
231
+ <a href="../../advanced/command_types/" title="Advanced Features" class="md-tabs__link">
232
+ Advanced Features
233
+ </a>
234
+
235
+ </li>
236
+
237
+
238
+
239
+
240
+
241
+
242
+ <li class="md-tabs__item">
243
+
244
+ <a href="../../development/contributing/" title="Development" class="md-tabs__link">
245
+ Development
246
+ </a>
247
+
248
+ </li>
249
+
250
+
251
+
252
+
253
+
254
+ </ul>
255
+ </div>
256
+ </nav>
257
+
258
+ <main class="md-main">
259
+ <div class="md-main__inner md-grid" data-md-component="container">
260
+
261
+
262
+ <div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
263
+ <div class="md-sidebar__scrollwrap">
264
+ <div class="md-sidebar__inner">
265
+ <nav class="md-nav md-nav--primary" data-md-level="0">
266
+ <label class="md-nav__title md-nav__title--site" for="__drawer">
267
+ <span class="md-nav__button md-logo">
268
+
269
+ <i class="md-icon">devices</i>
270
+
271
+ </span>
272
+ RBCli Documentation
273
+ </label>
274
+
275
+ <div class="md-nav__source">
276
+
277
+
278
+
279
+
280
+
281
+
282
+ <a href="https://github.com/akhoury6/rbcli/" title="Go to repository" class="md-source" data-md-source="github">
283
+
284
+ <div class="md-source__icon">
285
+ <svg viewBox="0 0 24 24" width="24" height="24">
286
+ <use xlink:href="#__github" width="24" height="24"></use>
287
+ </svg>
288
+ </div>
289
+
290
+ <div class="md-source__repository">
291
+ GitHub
292
+ </div>
293
+ </a>
294
+
295
+ </div>
296
+
297
+ <ul class="md-nav__list" data-md-scrollfix>
298
+
299
+
300
+
301
+
302
+
303
+
304
+ <li class="md-nav__item">
305
+ <a href="../.." title="Home" class="md-nav__link">
306
+ Home
307
+ </a>
308
+ </li>
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <li class="md-nav__item">
317
+ <a href="../../imported/quick_reference/" title="Quick Reference" class="md-nav__link">
318
+ Quick Reference
319
+ </a>
320
+ </li>
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+ <li class="md-nav__item md-nav__item--active md-nav__item--nested">
331
+
332
+ <input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3" checked>
333
+
334
+ <label class="md-nav__link" for="nav-3">
335
+ Tutorial
336
+ </label>
337
+ <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
338
+ <label class="md-nav__title" for="nav-3">
339
+ Tutorial
340
+ </label>
341
+ <ul class="md-nav__list" data-md-scrollfix>
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+ <li class="md-nav__item">
350
+ <a href="../10-getting_started/" title="Getting Started" class="md-nav__link">
351
+ Getting Started
352
+ </a>
353
+ </li>
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+ <li class="md-nav__item md-nav__item--active">
364
+
365
+ <input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
366
+
367
+
368
+
369
+
370
+ <label class="md-nav__link md-nav__link--active" for="__toc">
371
+ The Project Layout
372
+ </label>
373
+
374
+ <a href="./" title="The Project Layout" class="md-nav__link md-nav__link--active">
375
+ The Project Layout
376
+ </a>
377
+
378
+
379
+ <nav class="md-nav md-nav--secondary">
380
+
381
+
382
+
383
+
384
+
385
+ <label class="md-nav__title" for="__toc">Table of contents</label>
386
+ <ul class="md-nav__list" data-md-scrollfix>
387
+
388
+ <li class="md-nav__item">
389
+ <a href="#project-initialization-types" title="Project Initialization Types" class="md-nav__link">
390
+ Project Initialization Types
391
+ </a>
392
+
393
+ <nav class="md-nav">
394
+ <ul class="md-nav__list">
395
+
396
+ <li class="md-nav__item">
397
+ <a href="#project-mode" title="Project Mode" class="md-nav__link">
398
+ Project Mode
399
+ </a>
400
+
401
+ </li>
402
+
403
+ <li class="md-nav__item">
404
+ <a href="#mini-micro-modes" title="Mini &amp; Micro Modes" class="md-nav__link">
405
+ Mini &amp; Micro Modes
406
+ </a>
407
+
408
+ </li>
409
+
410
+ </ul>
411
+ </nav>
412
+
413
+ </li>
414
+
415
+ <li class="md-nav__item">
416
+ <a href="#project-mode-structure" title="Project Mode Structure" class="md-nav__link">
417
+ Project Mode Structure
418
+ </a>
419
+
420
+ </li>
421
+
422
+ <li class="md-nav__item">
423
+ <a href="#git-rubygems-and-rspec" title="Git, RubyGems, and rspec" class="md-nav__link">
424
+ Git, RubyGems, and rspec
425
+ </a>
426
+
427
+ </li>
428
+
429
+ <li class="md-nav__item">
430
+ <a href="#rbcli-folders" title="RBCli Folders" class="md-nav__link">
431
+ RBCli Folders
432
+ </a>
433
+
434
+ </li>
435
+
436
+ <li class="md-nav__item">
437
+ <a href="#next-steps" title="Next Steps" class="md-nav__link">
438
+ Next Steps
439
+ </a>
440
+
441
+ </li>
442
+
443
+
444
+
445
+
446
+
447
+ </ul>
448
+
449
+ </nav>
450
+
451
+ </li>
452
+
453
+
454
+
455
+
456
+
457
+
458
+
459
+ <li class="md-nav__item">
460
+ <a href="../30-your_first_command/" title="Your First Command" class="md-nav__link">
461
+ Your First Command
462
+ </a>
463
+ </li>
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+ <li class="md-nav__item">
472
+ <a href="../40-options_parameters_and_arguments/" title="Options, Parameters, and Arguments" class="md-nav__link">
473
+ Options, Parameters, and Arguments
474
+ </a>
475
+ </li>
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+ <li class="md-nav__item">
484
+ <a href="../50-publishing/" title="Publishing and Distribution" class="md-nav__link">
485
+ Publishing and Distribution
486
+ </a>
487
+ </li>
488
+
489
+
490
+ </ul>
491
+ </nav>
492
+ </li>
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+ <li class="md-nav__item md-nav__item--nested">
501
+
502
+ <input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4">
503
+
504
+ <label class="md-nav__link" for="nav-4">
505
+ Advanced Features
506
+ </label>
507
+ <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
508
+ <label class="md-nav__title" for="nav-4">
509
+ Advanced Features
510
+ </label>
511
+ <ul class="md-nav__list" data-md-scrollfix>
512
+
513
+
514
+
515
+
516
+
517
+
518
+
519
+ <li class="md-nav__item">
520
+ <a href="../../advanced/command_types/" title="Command Types" class="md-nav__link">
521
+ Command Types
522
+ </a>
523
+ </li>
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+ <li class="md-nav__item">
532
+ <a href="../../advanced/user_config_files/" title="User Config Files" class="md-nav__link">
533
+ User Config Files
534
+ </a>
535
+ </li>
536
+
537
+
538
+
539
+
540
+
541
+
542
+
543
+ <li class="md-nav__item">
544
+ <a href="../../advanced/hooks/" title="Hooks" class="md-nav__link">
545
+ Hooks
546
+ </a>
547
+ </li>
548
+
549
+
550
+
551
+
552
+
553
+
554
+
555
+ <li class="md-nav__item">
556
+ <a href="../../advanced/automatic_updates/" title="Automatic Updates" class="md-nav__link">
557
+ Automatic Updates
558
+ </a>
559
+ </li>
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+ <li class="md-nav__item">
568
+ <a href="../../advanced/state_storage/" title="State Storage" class="md-nav__link">
569
+ State Storage
570
+ </a>
571
+ </li>
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+ <li class="md-nav__item">
580
+ <a href="../../advanced/distributed_state_locking/" title="Distributed State Locking" class="md-nav__link">
581
+ Distributed State Locking
582
+ </a>
583
+ </li>
584
+
585
+
586
+ </ul>
587
+ </nav>
588
+ </li>
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+ <li class="md-nav__item md-nav__item--nested">
597
+
598
+ <input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
599
+
600
+ <label class="md-nav__link" for="nav-5">
601
+ Development
602
+ </label>
603
+ <nav class="md-nav" data-md-component="collapsible" data-md-level="1">
604
+ <label class="md-nav__title" for="nav-5">
605
+ Development
606
+ </label>
607
+ <ul class="md-nav__list" data-md-scrollfix>
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+ <li class="md-nav__item">
616
+ <a href="../../development/contributing/" title="Contribution Guide" class="md-nav__link">
617
+ Contribution Guide
618
+ </a>
619
+ </li>
620
+
621
+
622
+
623
+
624
+
625
+
626
+
627
+ <li class="md-nav__item">
628
+ <a href="../../development/license/" title="License Info" class="md-nav__link">
629
+ License Info
630
+ </a>
631
+ </li>
632
+
633
+
634
+
635
+
636
+
637
+
638
+
639
+ <li class="md-nav__item">
640
+ <a href="../../development/code_of_conduct/" title="Code of Conduct" class="md-nav__link">
641
+ Code of Conduct
642
+ </a>
643
+ </li>
644
+
645
+
646
+
647
+
648
+
649
+
650
+
651
+ <li class="md-nav__item">
652
+ <a href="../../imported/changelog/" title="Changelog" class="md-nav__link">
653
+ Changelog
654
+ </a>
655
+ </li>
656
+
657
+
658
+ </ul>
659
+ </nav>
660
+ </li>
661
+
662
+
663
+
664
+
665
+
666
+
667
+
668
+ <li class="md-nav__item">
669
+ <a href="../../whoami/" title="$ whoami" class="md-nav__link">
670
+ $ whoami
671
+ </a>
672
+ </li>
673
+
674
+
675
+ </ul>
676
+ </nav>
677
+ </div>
678
+ </div>
679
+ </div>
680
+
681
+
682
+ <div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
683
+ <div class="md-sidebar__scrollwrap">
684
+ <div class="md-sidebar__inner">
685
+
686
+ <nav class="md-nav md-nav--secondary">
687
+
688
+
689
+
690
+
691
+
692
+ <label class="md-nav__title" for="__toc">Table of contents</label>
693
+ <ul class="md-nav__list" data-md-scrollfix>
694
+
695
+ <li class="md-nav__item">
696
+ <a href="#project-initialization-types" title="Project Initialization Types" class="md-nav__link">
697
+ Project Initialization Types
698
+ </a>
699
+
700
+ <nav class="md-nav">
701
+ <ul class="md-nav__list">
702
+
703
+ <li class="md-nav__item">
704
+ <a href="#project-mode" title="Project Mode" class="md-nav__link">
705
+ Project Mode
706
+ </a>
707
+
708
+ </li>
709
+
710
+ <li class="md-nav__item">
711
+ <a href="#mini-micro-modes" title="Mini &amp; Micro Modes" class="md-nav__link">
712
+ Mini &amp; Micro Modes
713
+ </a>
714
+
715
+ </li>
716
+
717
+ </ul>
718
+ </nav>
719
+
720
+ </li>
721
+
722
+ <li class="md-nav__item">
723
+ <a href="#project-mode-structure" title="Project Mode Structure" class="md-nav__link">
724
+ Project Mode Structure
725
+ </a>
726
+
727
+ </li>
728
+
729
+ <li class="md-nav__item">
730
+ <a href="#git-rubygems-and-rspec" title="Git, RubyGems, and rspec" class="md-nav__link">
731
+ Git, RubyGems, and rspec
732
+ </a>
733
+
734
+ </li>
735
+
736
+ <li class="md-nav__item">
737
+ <a href="#rbcli-folders" title="RBCli Folders" class="md-nav__link">
738
+ RBCli Folders
739
+ </a>
740
+
741
+ </li>
742
+
743
+ <li class="md-nav__item">
744
+ <a href="#next-steps" title="Next Steps" class="md-nav__link">
745
+ Next Steps
746
+ </a>
747
+
748
+ </li>
749
+
750
+
751
+
752
+
753
+
754
+ </ul>
755
+
756
+ </nav>
757
+ </div>
758
+ </div>
759
+ </div>
760
+
761
+
762
+ <div class="md-content">
763
+ <article class="md-content__inner md-typeset">
764
+
765
+
766
+
767
+ <h1 id="the-project-layout">The Project Layout</h1>
768
+ <p>Now we will learn about what an RBCli project looks like and how to start using it.</p>
769
+ <h2 id="project-initialization-types">Project Initialization Types</h2>
770
+ <p>RBCli can initialize a tool in three different modes:</p>
771
+ <ul>
772
+ <li>Project Mode (default)</li>
773
+ <li>Mini Mode</li>
774
+ <li>Micro Mode</li>
775
+ </ul>
776
+ <h3 id="project-mode">Project Mode</h3>
777
+ <p>If you've been following along with the tutorial, you've already seen Project Mode. An RBCli Project consists of several folders, each of which has a specific function. The RBCli framework handles loading and parsing the code automatically. To generate a standard, full-featured RBCli project, run:</p>
778
+ <pre><code class="bash">rbcli init -n mytool
779
+ </code></pre>
780
+
781
+ <p>where <code>mytool</code> can be replaced with any other command name you'd like. (We will continue using <code>mytool</code> in this tutorial though!)</p>
782
+ <p>Inside the newly created <code>mytool</code> folder you will see a bunch of files and folders related to your project. We will go over the structure later.</p>
783
+ <h3 id="mini-micro-modes">Mini &amp; Micro Modes</h3>
784
+ <p>If you need to write a CLI tool but project mode feels a bit overkill for you -- if you think a single-file script is all that is needed -- that's where the Mini and Micro modes come in. Instead of generating a full directory tree, you get only a single file that contains most of the functionality of RBCli. To use it, run:</p>
785
+ <pre><code class="bash">rbcli init -n mytool -t mini
786
+ # or
787
+ rbcli init -n mytool -t micro
788
+ </code></pre>
789
+
790
+ <p>The only difference between the two is that <code>mini</code> will show you all available options and some documentation to help you, while <code>micro</code> is for advanced users who just want the samllest file possible.</p>
791
+ <p>As far as documentation goes, every piece of code present in those files is identical to Project mode so it should be pretty easy to navigate.</p>
792
+ <h2 id="project-mode-structure">Project Mode Structure</h2>
793
+ <p>An RBCli project has the following structure:</p>
794
+ <pre><code class="text">&lt;name&gt;/
795
+ |--- application/
796
+ | |--- commands/
797
+ | | |--- scripts/
798
+ | |--- options.rb
799
+ |--- config/
800
+ |--- exe/
801
+ | |--- &lt;name&gt;
802
+ |--- hooks/
803
+ |--- lib/
804
+ |--- spec/
805
+ |--- userconf/
806
+ |--- .gitignore
807
+ |--- .rbcli
808
+ |--- .rspec
809
+ |--- CODE_OF_CONDUCT.md
810
+ |--- Gemfile
811
+ |--- README.md
812
+ |--- Rakefile
813
+ |--- &lt;name&gt;.gemspec
814
+ </code></pre>
815
+
816
+ <h2 id="git-rubygems-and-rspec">Git, RubyGems, and rspec</h2>
817
+ <p>A few files aren't part of RBCli itself, but are provided for your convenience. If you're experienced in Ruby and Git you can skip over this.</p>
818
+ <ul>
819
+ <li><code>.gitignore</code><ul>
820
+ <li>Specifies which files to ignore in git. If you don't use git you can delete this file</li>
821
+ </ul>
822
+ </li>
823
+ <li><code>.rspec</code><ul>
824
+ <li>Configures Rspec for testing your code</li>
825
+ </ul>
826
+ </li>
827
+ <li><code>Gemfile</code><ul>
828
+ <li>Allows declaring dependencies for when your users install your application</li>
829
+ </ul>
830
+ </li>
831
+ <li><code>Gemspec</code><ul>
832
+ <li>Same as above, but also lets you fill in more information so that you can publish your application as a gem</li>
833
+ </ul>
834
+ </li>
835
+ <li><code>README.md</code><ul>
836
+ <li>A skeleton README file that will appear as a front page documentation to your code in most source control systems (i.e. Github, Bitbucket)</li>
837
+ </ul>
838
+ </li>
839
+ <li><code>CODE_OF_CONDUCT.md</code><ul>
840
+ <li>Taken directly from the <a href="http://contributor-covenant.org">contributor covenant</a> for your convenience</li>
841
+ </ul>
842
+ </li>
843
+ <li><code>Rakefile</code><ul>
844
+ <li>So you can run rspec tests as a rake task</li>
845
+ </ul>
846
+ </li>
847
+ </ul>
848
+ <p>There is a lot of controvesy online regarding using the <code>gemfile</code> vs the <code>gemspec</code>. If you are new to Ruby in general then I suggest declaring your dependencies in the gemspec and leaving the <code>gemfile</code> as-is. This keeps things simple and allows publishing and distributing your tool as a gem.</p>
849
+ <p>Additionally, note that a git repo is not created automatically. Using git is out of scope of this tutorial, but you can find tutorials <a href="https://www.tutorialspoint.com/git/">here</a>.</p>
850
+ <h2 id="rbcli-folders">RBCli Folders</h2>
851
+ <ul>
852
+ <li><code>application/</code><ul>
853
+ <li>This is where the core of your application will live. You will define CLI options, commands, scripts, and hooks within this folder.</li>
854
+ </ul>
855
+ </li>
856
+ <li><code>config/</code><ul>
857
+ <li>This folder contains the configuration for RBCli's features; such as storage, logging, and automatic updates.</li>
858
+ </ul>
859
+ </li>
860
+ <li><code>exe/</code><ul>
861
+ <li>This folder contains the executable for your tool. You should not edit it; doing so may lead to unexpected behavior.</li>
862
+ </ul>
863
+ </li>
864
+ <li><code>hooks/</code><ul>
865
+ <li>RBCli has several hooks that can be used to run code at different times, such as the 'default' code that is run when no command is selected. This is where they are placed.</li>
866
+ </ul>
867
+ </li>
868
+ <li><code>lib/</code><ul>
869
+ <li>This folder is for you to write any additional code as you see fit, for importing into your commands, scripts, and hooks. It is automatically added to the $LOAD_PATH for you, so you can just use require statements like <code>require 'abc.rb'</code> without worrying about where they are located on the filesystem.</li>
870
+ </ul>
871
+ </li>
872
+ <li><code>userconf/</code><ul>
873
+ <li>This folder is for you to place the layout and defaults of any userspace config file. Acceptable formats are yaml and json, though we recommend YAML since it is by far easier to read and supports comments.</li>
874
+ </ul>
875
+ </li>
876
+ <li><code>spec/</code><ul>
877
+ <li>This folder is for your rspec tests.</li>
878
+ </ul>
879
+ </li>
880
+ <li><code>.rbcli</code><ul>
881
+ <li>This file is for internal use by RBCli. It should not be modified or deleted.</li>
882
+ </ul>
883
+ </li>
884
+ </ul>
885
+ <h2 id="next-steps">Next Steps</h2>
886
+ <p>For the purposes of getting started right now, you don't actually need to edit any of the defaults already present.</p>
887
+ <p>We just finished going through what an RBCli project looks like. Now let's create our first application with it!</p>
888
+
889
+
890
+
891
+
892
+
893
+
894
+
895
+
896
+
897
+ </article>
898
+ </div>
899
+ </div>
900
+ </main>
901
+
902
+
903
+ <footer class="md-footer">
904
+
905
+ <div class="md-footer-nav">
906
+ <nav class="md-footer-nav__inner md-grid">
907
+
908
+ <a href="../10-getting_started/" title="Getting Started" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
909
+ <div class="md-flex__cell md-flex__cell--shrink">
910
+ <i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
911
+ </div>
912
+ <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
913
+ <span class="md-flex__ellipsis">
914
+ <span class="md-footer-nav__direction">
915
+ Previous
916
+ </span>
917
+ Getting Started
918
+ </span>
919
+ </div>
920
+ </a>
921
+
922
+
923
+ <a href="../30-your_first_command/" title="Your First Command" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
924
+ <div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
925
+ <span class="md-flex__ellipsis">
926
+ <span class="md-footer-nav__direction">
927
+ Next
928
+ </span>
929
+ Your First Command
930
+ </span>
931
+ </div>
932
+ <div class="md-flex__cell md-flex__cell--shrink">
933
+ <i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
934
+ </div>
935
+ </a>
936
+
937
+ </nav>
938
+ </div>
939
+
940
+ <div class="md-footer-meta md-typeset">
941
+ <div class="md-footer-meta__inner md-grid">
942
+ <div class="md-footer-copyright">
943
+
944
+ <div class="md-footer-copyright__highlight">
945
+ Copyright © 2018 Andrew Khoury
946
+ </div>
947
+
948
+ powered by
949
+ <a href="https://www.mkdocs.org">MkDocs</a>
950
+ and
951
+ <a href="https://squidfunk.github.io/mkdocs-material/">
952
+ Material for MkDocs</a>
953
+ </div>
954
+
955
+
956
+
957
+ </div>
958
+ </div>
959
+ </footer>
960
+
961
+ </div>
962
+
963
+ <script src="../../assets/javascripts/application.a59e2a89.js"></script>
964
+
965
+ <script>app.initialize({version:"0.17.5",url:{base:"../.."}})</script>
966
+
967
+
968
+
969
+
970
+
971
+ </body>
972
+ </html>