rbcli 0.1.10 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +12 -12
- data/LICENSE.txt +674 -21
- data/README.md +80 -443
- data/bin/console +19 -0
- data/bin/setup +20 -0
- data/docs/404.html +639 -0
- data/docs/advanced/automatic_updates/index.html +791 -0
- data/docs/advanced/command_types/index.html +946 -0
- data/docs/advanced/distributed_state_locking/index.html +777 -0
- data/docs/advanced/hooks/index.html +836 -0
- data/docs/advanced/state_storage/index.html +957 -0
- data/docs/advanced/user_config_files/index.html +818 -0
- data/docs/assets/fonts/font-awesome.css +4 -0
- data/docs/assets/fonts/material-icons.css +13 -0
- data/docs/assets/fonts/specimen/FontAwesome.ttf +0 -0
- data/docs/assets/fonts/specimen/FontAwesome.woff +0 -0
- data/docs/assets/fonts/specimen/FontAwesome.woff2 +0 -0
- data/docs/assets/fonts/specimen/MaterialIcons-Regular.ttf +0 -0
- data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff +0 -0
- data/docs/assets/fonts/specimen/MaterialIcons-Regular.woff2 +0 -0
- data/docs/assets/images/favicon.png +0 -0
- data/docs/assets/images/icons/bitbucket.1b09e088.svg +20 -0
- data/docs/assets/images/icons/github.f0b8504a.svg +18 -0
- data/docs/assets/images/icons/gitlab.6dd19c00.svg +38 -0
- data/docs/assets/javascripts/application.a59e2a89.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.da.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.de.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.du.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.es.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.fi.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.fr.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.hu.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.it.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.jp.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.multi.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.no.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.pt.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.ro.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.ru.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.stemmer.support.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.sv.js +1 -0
- data/docs/assets/javascripts/lunr/lunr.tr.js +1 -0
- data/docs/assets/javascripts/lunr/tinyseg.js +1 -0
- data/docs/assets/javascripts/modernizr.1aa3b519.js +1 -0
- data/docs/assets/stylesheets/application-palette.6079476c.css +2 -0
- data/docs/assets/stylesheets/application.ba0fd1a6.css +2 -0
- data/docs/development/code_of_conduct/index.html +883 -0
- data/docs/development/contributing/index.html +744 -0
- data/docs/development/license/index.html +715 -0
- data/docs/imported/changelog/index.html +853 -0
- data/docs/imported/quick_reference/index.html +1057 -0
- data/docs/index.html +732 -0
- data/docs/search/search_index.json +569 -0
- data/docs/sitemap.xml +93 -0
- data/docs/tutorial/10-getting_started/index.html +806 -0
- data/docs/tutorial/20-project_layout/index.html +972 -0
- data/docs/tutorial/30-your_first_command/index.html +906 -0
- data/docs/tutorial/40-options_parameters_and_arguments/index.html +1049 -0
- data/docs/tutorial/50-publishing/index.html +838 -0
- data/docs/whoami/index.html +709 -0
- data/docs-src/docs/advanced/automatic_updates.md +42 -0
- data/docs-src/docs/advanced/command_types.md +144 -0
- data/docs-src/docs/advanced/distributed_state_locking.md +33 -0
- data/docs-src/docs/advanced/hooks.md +65 -0
- data/docs-src/docs/advanced/logging.md +35 -0
- data/docs-src/docs/advanced/state_storage.md +117 -0
- data/docs-src/docs/advanced/user_config_files.md +47 -0
- data/docs-src/docs/development/code_of_conduct.md +74 -0
- data/docs-src/docs/development/contributing.md +49 -0
- data/docs-src/docs/development/license.md +10 -0
- data/docs-src/docs/imported/changelog.md +31 -0
- data/docs-src/docs/imported/quick_reference.md +150 -0
- data/docs-src/docs/index.md +38 -0
- data/docs-src/docs/tutorial/10-getting_started.md +41 -0
- data/docs-src/docs/tutorial/20-project_layout.md +115 -0
- data/docs-src/docs/tutorial/30-your_first_command.md +126 -0
- data/docs-src/docs/tutorial/40-options_parameters_and_arguments.md +251 -0
- data/docs-src/docs/tutorial/50-publishing.md +47 -0
- data/docs-src/docs/whoami.md +28 -0
- data/docs-src/makesite.sh +14 -0
- data/docs-src/mkdocs.yml +76 -0
- data/docs-src/runsite.sh +3 -0
- data/exe/rbcli +76 -5
- data/lib/rbcli/autoupdate/autoupdate.rb +24 -4
- data/lib/rbcli/autoupdate/gem_updater.rb +23 -2
- data/lib/rbcli/autoupdate/github_updater.rb +22 -1
- data/lib/rbcli/configuration/config.rb +22 -1
- data/lib/rbcli/configuration/configurate.rb +24 -2
- data/lib/rbcli/engine/command.rb +26 -6
- data/lib/rbcli/engine/load_project.rb +29 -3
- data/lib/rbcli/engine/parser.rb +25 -4
- data/lib/rbcli/logging/logging.rb +21 -0
- data/lib/rbcli/scriptwrapping/scriptwrapper.rb +30 -11
- data/lib/rbcli/stateful_systems/configuratestorage.rb +20 -0
- data/lib/rbcli/stateful_systems/state_storage.rb +20 -0
- data/lib/rbcli/stateful_systems/storagetypes/localstate.rb +20 -0
- data/lib/rbcli/stateful_systems/storagetypes/remote_state_connectors/dynamodb.rb +20 -0
- data/lib/rbcli/stateful_systems/storagetypes/remotestate_dynamodb.rb +20 -0
- data/lib/rbcli/util/hash_deep_symbolize.rb +43 -22
- data/lib/rbcli/util/string_colorize.rb +20 -0
- data/lib/rbcli/version.rb +21 -1
- data/lib/rbcli-tool/generators.rb +20 -0
- data/lib/rbcli-tool/mdless_fix.rb +20 -0
- data/lib/rbcli-tool/project.rb +27 -2
- data/lib/rbcli-tool/util.rb +20 -0
- data/lib/rbcli-tool.rb +20 -0
- data/lib/rbcli.rb +20 -0
- data/lib-sh/lib-rbcli.sh +19 -0
- data/rbcli.gemspec +22 -3
- data/skeletons/project/CODE_OF_CONDUCT.md +1 -1
- data/skeletons/project/README.md +17 -2
- data/skeletons/project/application/commands/command.erb +10 -8
- data/skeletons/project/application/commands/script.erb +3 -1
- data/skeletons/project/application/commands/scripts/script.sh +2 -2
- data/skeletons/project/application/options.rb +12 -3
- data/skeletons/project/config/autoupdate.rb +5 -2
- data/skeletons/project/config/storage.rb +7 -6
- data/skeletons/project/config/userspace.rb +6 -1
- data/skeletons/project/exe/executable +1 -1
- data/skeletons/project/lib/.keep +0 -0
- data/skeletons/project/untitled.gemspec +4 -4
- data/skeletons/project/{default_user_configs → userconf}/user_defaults.yml +0 -0
- metadata +85 -9
- data/examples/defaults.yml +0 -4
- data/examples/myscript.sh +0 -23
- data/examples/mytool +0 -95
@@ -0,0 +1,957 @@
|
|
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>State Storage - 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="#state-storage" 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
|
+
State Storage
|
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
|
+

|
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="../../tutorial/10-getting_started/" title="Tutorial" class="md-tabs__link">
|
219
|
+
Tutorial
|
220
|
+
</a>
|
221
|
+
|
222
|
+
</li>
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
<li class="md-tabs__item">
|
230
|
+
|
231
|
+
<a href="../command_types/" title="Advanced Features" class="md-tabs__link md-tabs__link--active">
|
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
|
+
<li class="md-nav__item md-nav__item--nested">
|
329
|
+
|
330
|
+
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3" type="checkbox" id="nav-3">
|
331
|
+
|
332
|
+
<label class="md-nav__link" for="nav-3">
|
333
|
+
Tutorial
|
334
|
+
</label>
|
335
|
+
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
336
|
+
<label class="md-nav__title" for="nav-3">
|
337
|
+
Tutorial
|
338
|
+
</label>
|
339
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
<li class="md-nav__item">
|
348
|
+
<a href="../../tutorial/10-getting_started/" title="Getting Started" class="md-nav__link">
|
349
|
+
Getting Started
|
350
|
+
</a>
|
351
|
+
</li>
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
<li class="md-nav__item">
|
360
|
+
<a href="../../tutorial/20-project_layout/" title="The Project Layout" class="md-nav__link">
|
361
|
+
The Project Layout
|
362
|
+
</a>
|
363
|
+
</li>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
<li class="md-nav__item">
|
372
|
+
<a href="../../tutorial/30-your_first_command/" title="Your First Command" class="md-nav__link">
|
373
|
+
Your First Command
|
374
|
+
</a>
|
375
|
+
</li>
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
<li class="md-nav__item">
|
384
|
+
<a href="../../tutorial/40-options_parameters_and_arguments/" title="Options, Parameters, and Arguments" class="md-nav__link">
|
385
|
+
Options, Parameters, and Arguments
|
386
|
+
</a>
|
387
|
+
</li>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<li class="md-nav__item">
|
396
|
+
<a href="../../tutorial/50-publishing/" title="Publishing and Distribution" class="md-nav__link">
|
397
|
+
Publishing and Distribution
|
398
|
+
</a>
|
399
|
+
</li>
|
400
|
+
|
401
|
+
|
402
|
+
</ul>
|
403
|
+
</nav>
|
404
|
+
</li>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
|
415
|
+
|
416
|
+
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-4" type="checkbox" id="nav-4" checked>
|
417
|
+
|
418
|
+
<label class="md-nav__link" for="nav-4">
|
419
|
+
Advanced Features
|
420
|
+
</label>
|
421
|
+
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
422
|
+
<label class="md-nav__title" for="nav-4">
|
423
|
+
Advanced Features
|
424
|
+
</label>
|
425
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
<li class="md-nav__item">
|
434
|
+
<a href="../command_types/" title="Command Types" class="md-nav__link">
|
435
|
+
Command Types
|
436
|
+
</a>
|
437
|
+
</li>
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
<li class="md-nav__item">
|
446
|
+
<a href="../user_config_files/" title="User Config Files" class="md-nav__link">
|
447
|
+
User Config Files
|
448
|
+
</a>
|
449
|
+
</li>
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
<li class="md-nav__item">
|
458
|
+
<a href="../hooks/" title="Hooks" class="md-nav__link">
|
459
|
+
Hooks
|
460
|
+
</a>
|
461
|
+
</li>
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
<li class="md-nav__item">
|
470
|
+
<a href="../automatic_updates/" title="Automatic Updates" class="md-nav__link">
|
471
|
+
Automatic Updates
|
472
|
+
</a>
|
473
|
+
</li>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
<li class="md-nav__item md-nav__item--active">
|
484
|
+
|
485
|
+
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
<label class="md-nav__link md-nav__link--active" for="__toc">
|
491
|
+
State Storage
|
492
|
+
</label>
|
493
|
+
|
494
|
+
<a href="./" title="State Storage" class="md-nav__link md-nav__link--active">
|
495
|
+
State Storage
|
496
|
+
</a>
|
497
|
+
|
498
|
+
|
499
|
+
<nav class="md-nav md-nav--secondary">
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
|
505
|
+
<label class="md-nav__title" for="__toc">Table of contents</label>
|
506
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
507
|
+
|
508
|
+
<li class="md-nav__item">
|
509
|
+
<a href="#local-state" title="Local State" class="md-nav__link">
|
510
|
+
Local State
|
511
|
+
</a>
|
512
|
+
|
513
|
+
<nav class="md-nav">
|
514
|
+
<ul class="md-nav__list">
|
515
|
+
|
516
|
+
<li class="md-nav__item">
|
517
|
+
<a href="#configuration" title="Configuration" class="md-nav__link">
|
518
|
+
Configuration
|
519
|
+
</a>
|
520
|
+
|
521
|
+
</li>
|
522
|
+
|
523
|
+
<li class="md-nav__item">
|
524
|
+
<a href="#access-and-usage" title="Access and Usage" class="md-nav__link">
|
525
|
+
Access and Usage
|
526
|
+
</a>
|
527
|
+
|
528
|
+
</li>
|
529
|
+
|
530
|
+
</ul>
|
531
|
+
</nav>
|
532
|
+
|
533
|
+
</li>
|
534
|
+
|
535
|
+
<li class="md-nav__item">
|
536
|
+
<a href="#remote-state" title="Remote State" class="md-nav__link">
|
537
|
+
Remote State
|
538
|
+
</a>
|
539
|
+
|
540
|
+
<nav class="md-nav">
|
541
|
+
<ul class="md-nav__list">
|
542
|
+
|
543
|
+
<li class="md-nav__item">
|
544
|
+
<a href="#configuration_1" title="Configuration" class="md-nav__link">
|
545
|
+
Configuration
|
546
|
+
</a>
|
547
|
+
|
548
|
+
</li>
|
549
|
+
|
550
|
+
<li class="md-nav__item">
|
551
|
+
<a href="#access-and-usage_1" title="Access and Usage" class="md-nav__link">
|
552
|
+
Access and Usage
|
553
|
+
</a>
|
554
|
+
|
555
|
+
</li>
|
556
|
+
|
557
|
+
</ul>
|
558
|
+
</nav>
|
559
|
+
|
560
|
+
</li>
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
</ul>
|
567
|
+
|
568
|
+
</nav>
|
569
|
+
|
570
|
+
</li>
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
<li class="md-nav__item">
|
579
|
+
<a href="../distributed_state_locking/" title="Distributed State Locking" class="md-nav__link">
|
580
|
+
Distributed State Locking
|
581
|
+
</a>
|
582
|
+
</li>
|
583
|
+
|
584
|
+
|
585
|
+
</ul>
|
586
|
+
</nav>
|
587
|
+
</li>
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
|
594
|
+
|
595
|
+
<li class="md-nav__item md-nav__item--nested">
|
596
|
+
|
597
|
+
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-5" type="checkbox" id="nav-5">
|
598
|
+
|
599
|
+
<label class="md-nav__link" for="nav-5">
|
600
|
+
Development
|
601
|
+
</label>
|
602
|
+
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
603
|
+
<label class="md-nav__title" for="nav-5">
|
604
|
+
Development
|
605
|
+
</label>
|
606
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
<li class="md-nav__item">
|
615
|
+
<a href="../../development/contributing/" title="Contribution Guide" class="md-nav__link">
|
616
|
+
Contribution Guide
|
617
|
+
</a>
|
618
|
+
</li>
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
<li class="md-nav__item">
|
627
|
+
<a href="../../development/license/" title="License Info" class="md-nav__link">
|
628
|
+
License Info
|
629
|
+
</a>
|
630
|
+
</li>
|
631
|
+
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
|
636
|
+
|
637
|
+
|
638
|
+
<li class="md-nav__item">
|
639
|
+
<a href="../../development/code_of_conduct/" title="Code of Conduct" class="md-nav__link">
|
640
|
+
Code of Conduct
|
641
|
+
</a>
|
642
|
+
</li>
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
<li class="md-nav__item">
|
651
|
+
<a href="../../imported/changelog/" title="Changelog" class="md-nav__link">
|
652
|
+
Changelog
|
653
|
+
</a>
|
654
|
+
</li>
|
655
|
+
|
656
|
+
|
657
|
+
</ul>
|
658
|
+
</nav>
|
659
|
+
</li>
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
<li class="md-nav__item">
|
668
|
+
<a href="../../whoami/" title="$ whoami" class="md-nav__link">
|
669
|
+
$ whoami
|
670
|
+
</a>
|
671
|
+
</li>
|
672
|
+
|
673
|
+
|
674
|
+
</ul>
|
675
|
+
</nav>
|
676
|
+
</div>
|
677
|
+
</div>
|
678
|
+
</div>
|
679
|
+
|
680
|
+
|
681
|
+
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
|
682
|
+
<div class="md-sidebar__scrollwrap">
|
683
|
+
<div class="md-sidebar__inner">
|
684
|
+
|
685
|
+
<nav class="md-nav md-nav--secondary">
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
<label class="md-nav__title" for="__toc">Table of contents</label>
|
692
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
693
|
+
|
694
|
+
<li class="md-nav__item">
|
695
|
+
<a href="#local-state" title="Local State" class="md-nav__link">
|
696
|
+
Local State
|
697
|
+
</a>
|
698
|
+
|
699
|
+
<nav class="md-nav">
|
700
|
+
<ul class="md-nav__list">
|
701
|
+
|
702
|
+
<li class="md-nav__item">
|
703
|
+
<a href="#configuration" title="Configuration" class="md-nav__link">
|
704
|
+
Configuration
|
705
|
+
</a>
|
706
|
+
|
707
|
+
</li>
|
708
|
+
|
709
|
+
<li class="md-nav__item">
|
710
|
+
<a href="#access-and-usage" title="Access and Usage" class="md-nav__link">
|
711
|
+
Access and Usage
|
712
|
+
</a>
|
713
|
+
|
714
|
+
</li>
|
715
|
+
|
716
|
+
</ul>
|
717
|
+
</nav>
|
718
|
+
|
719
|
+
</li>
|
720
|
+
|
721
|
+
<li class="md-nav__item">
|
722
|
+
<a href="#remote-state" title="Remote State" class="md-nav__link">
|
723
|
+
Remote State
|
724
|
+
</a>
|
725
|
+
|
726
|
+
<nav class="md-nav">
|
727
|
+
<ul class="md-nav__list">
|
728
|
+
|
729
|
+
<li class="md-nav__item">
|
730
|
+
<a href="#configuration_1" title="Configuration" class="md-nav__link">
|
731
|
+
Configuration
|
732
|
+
</a>
|
733
|
+
|
734
|
+
</li>
|
735
|
+
|
736
|
+
<li class="md-nav__item">
|
737
|
+
<a href="#access-and-usage_1" title="Access and Usage" class="md-nav__link">
|
738
|
+
Access and Usage
|
739
|
+
</a>
|
740
|
+
|
741
|
+
</li>
|
742
|
+
|
743
|
+
</ul>
|
744
|
+
</nav>
|
745
|
+
|
746
|
+
</li>
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
|
752
|
+
</ul>
|
753
|
+
|
754
|
+
</nav>
|
755
|
+
</div>
|
756
|
+
</div>
|
757
|
+
</div>
|
758
|
+
|
759
|
+
|
760
|
+
<div class="md-content">
|
761
|
+
<article class="md-content__inner md-typeset">
|
762
|
+
|
763
|
+
|
764
|
+
|
765
|
+
<h1 id="state-storage">State Storage</h1>
|
766
|
+
<p>RBCli supports both local and remote state storage. This is done by synchronizing a Hash with either the local disk or a remote database.</p>
|
767
|
+
<h2 id="local-state">Local State</h2>
|
768
|
+
<p>RBCli's local state storage gives you access to a hash that is automatically persisted to disk when changes are made.</p>
|
769
|
+
<h3 id="configuration">Configuration</h3>
|
770
|
+
<p>You can configure it in <code>config/storage.rb</code>.</p>
|
771
|
+
<pre><code class="ruby">local_state '/var/mytool/localstate', force_creation: true, halt_on_error: true
|
772
|
+
</code></pre>
|
773
|
+
|
774
|
+
<p>There are three parameters to configure it with:</p>
|
775
|
+
<ul>
|
776
|
+
<li>The <code>path</code> as a string (self-explanatory)</li>
|
777
|
+
<li><code>force_creation</code><ul>
|
778
|
+
<li>This will attempt to create the path and file if it does not exist (equivalent to an <code>mkdir -p</code> and <code>touch</code> in linux)</li>
|
779
|
+
</ul>
|
780
|
+
</li>
|
781
|
+
<li><code>halt_on_error</code><ul>
|
782
|
+
<li>RBCli's default behavior is to raise an exception if the file can not be created, read, or updated at any point in time</li>
|
783
|
+
<li>If this is set to <code>false</code>, RBCli will silence any errors pertaining to file access and will fall back to whatever data is available. Note that if this is enabled, changes made to the state may not be persisted to disk.<ul>
|
784
|
+
<li>If creation fails and file does not exist, you start with an empty hash</li>
|
785
|
+
<li>If file exists but can't be read, you will have an empty hash</li>
|
786
|
+
<li>If file can be read but not written, the hash will be populated with the data. Writes will be stored in memory while the application is running, but will not be persisted to disk.</li>
|
787
|
+
</ul>
|
788
|
+
</li>
|
789
|
+
</ul>
|
790
|
+
</li>
|
791
|
+
</ul>
|
792
|
+
<h3 id="access-and-usage">Access and Usage</h3>
|
793
|
+
<p>Once configured you can access it with a standard hash syntax in your Standard Commands:</p>
|
794
|
+
<pre><code class="ruby">Rbcli.local_state[:yourkeyhere]
|
795
|
+
</code></pre>
|
796
|
+
|
797
|
+
<p>The methods available for use at the top level are as follows:</p>
|
798
|
+
<p>Hash native methods:</p>
|
799
|
+
<ul>
|
800
|
+
<li><code>[]</code> (Regular hash syntax. Keys are accessed via either symbols or strings indifferently.)</li>
|
801
|
+
<li><code>[]=</code> (Assignment operator)</li>
|
802
|
+
<li><code>delete</code></li>
|
803
|
+
<li><code>each</code></li>
|
804
|
+
<li><code>key?</code></li>
|
805
|
+
</ul>
|
806
|
+
<p>Additional methods:</p>
|
807
|
+
<ul>
|
808
|
+
<li><code>commit</code><ul>
|
809
|
+
<li>Every assignment to the top level of the hash will result in a write to disk (for example: <code>Rbcli.local_state[:yourkey] = 'foo'</code>). However, if you are manipulating nested hashes, these saves will not be triggered. You can trigger them manually by calling <code>commit</code>.</li>
|
810
|
+
</ul>
|
811
|
+
</li>
|
812
|
+
<li><code>clear</code><ul>
|
813
|
+
<li>Resets the data back to an empty hash.</li>
|
814
|
+
</ul>
|
815
|
+
</li>
|
816
|
+
<li><code>refresh</code><ul>
|
817
|
+
<li>Loads the most current version of the data from the disk</li>
|
818
|
+
</ul>
|
819
|
+
</li>
|
820
|
+
<li><code>disconnect</code><ul>
|
821
|
+
<li>Removes the data from memory and sets <code>Rbcli.local_state = nil</code>. Data will be read from disk again on next access.</li>
|
822
|
+
</ul>
|
823
|
+
</li>
|
824
|
+
</ul>
|
825
|
+
<p>Every assignment will result in a write to disk, so if an operation will require a large number of assignments/writes it should be performed to a different hash before beign assigned to this one.</p>
|
826
|
+
<h2 id="remote-state">Remote State</h2>
|
827
|
+
<p>RBCli's remote state storage gives you access to a hash that is automatically persisted to a remote storage location when changes are made. It has optional locking built-in, meaning that multiple users may share remote state without any data consistency issues.</p>
|
828
|
+
<p>Currently, this feature requires AWS DynamoDB, though other backend systems will be added in the future.</p>
|
829
|
+
<h3 id="configuration_1">Configuration</h3>
|
830
|
+
<p>Before DynamoDB can be used, AWS API credentials have to be created and made available. RBCli will attempt to find credentials from the following locations in order:</p>
|
831
|
+
<ol>
|
832
|
+
<li>User's config file</li>
|
833
|
+
<li>Environment variables <code>AWS_ACCESS_KEY_ID</code> and <code>AWS_SECRET_ACCESS_KEY</code></li>
|
834
|
+
<li>User's AWSCLI configuration at <code>~/.aws/credentials</code></li>
|
835
|
+
</ol>
|
836
|
+
<p>For more information about generating and storing AWS credentials, see <a href="https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html">Configuring the AWS SDK for Ruby</a>. Please make sure that your users are aware that they will need to provide their own credentials to use this feature.</p>
|
837
|
+
<p>You can configure it in <code>config/storage.rb</code>.</p>
|
838
|
+
<pre><code class="ruby">remote_state_dynamodb table_name: 'mytable', region: 'us-east-1', force_creation: true, halt_on_error: true, locking: false
|
839
|
+
</code></pre>
|
840
|
+
|
841
|
+
<p>These are the parameters:</p>
|
842
|
+
<ul>
|
843
|
+
<li><code>table_name</code><ul>
|
844
|
+
<li>The name of the DynamoDB table to use.</li>
|
845
|
+
</ul>
|
846
|
+
</li>
|
847
|
+
<li><code>region</code><ul>
|
848
|
+
<li>The AWS region that the database is located</li>
|
849
|
+
</ul>
|
850
|
+
</li>
|
851
|
+
<li><code>force_creation</code><ul>
|
852
|
+
<li>Creates the DynamoDB table if it does not already exist</li>
|
853
|
+
</ul>
|
854
|
+
</li>
|
855
|
+
<li><code>halt_on_error</code><ul>
|
856
|
+
<li>Similar to the way <a href="#local-state">Local State</a> works, setting this to <code>false</code> will silence any errors in connecting to the DynamoDB table. Instead, your application will simply have access to an empty hash that does not get persisted anywhere.</li>
|
857
|
+
<li>This is good for use cases that involve using this storage as a cache, where a connection error might mean the feature doesn't work but its not important enough to interrupt the user.</li>
|
858
|
+
</ul>
|
859
|
+
</li>
|
860
|
+
<li><code>locking</code><ul>
|
861
|
+
<li>Setting this to <code>true</code> enables locking, meaning only one instance of your application can access the shared data at any given time. For more information see <a href="../distributed_state_locking/">Distributed State Locking</a>.</li>
|
862
|
+
</ul>
|
863
|
+
</li>
|
864
|
+
</ul>
|
865
|
+
<h3 id="access-and-usage_1">Access and Usage</h3>
|
866
|
+
<p>Once configured you can access it with a standard hash syntax:</p>
|
867
|
+
<pre><code class="ruby">Rbcli.remote_state[:yourkeyhere]
|
868
|
+
</code></pre>
|
869
|
+
|
870
|
+
<p>This works the same way that <a href="#local-state">Local State</a> does, with the same performance caveats (try not to write too frequently).</p>
|
871
|
+
<p>Note that all state in Rbcli is <strong>lazy-loaded</strong>, so no connections will be made until your code attempts to access the data even if the feature is enabled.</p>
|
872
|
+
<p>For more information on the available commands, see the documentation on <a href="#local-state">Local State</a></p>
|
873
|
+
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
|
879
|
+
|
880
|
+
|
881
|
+
|
882
|
+
</article>
|
883
|
+
</div>
|
884
|
+
</div>
|
885
|
+
</main>
|
886
|
+
|
887
|
+
|
888
|
+
<footer class="md-footer">
|
889
|
+
|
890
|
+
<div class="md-footer-nav">
|
891
|
+
<nav class="md-footer-nav__inner md-grid">
|
892
|
+
|
893
|
+
<a href="../automatic_updates/" title="Automatic Updates" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
|
894
|
+
<div class="md-flex__cell md-flex__cell--shrink">
|
895
|
+
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
|
896
|
+
</div>
|
897
|
+
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
898
|
+
<span class="md-flex__ellipsis">
|
899
|
+
<span class="md-footer-nav__direction">
|
900
|
+
Previous
|
901
|
+
</span>
|
902
|
+
Automatic Updates
|
903
|
+
</span>
|
904
|
+
</div>
|
905
|
+
</a>
|
906
|
+
|
907
|
+
|
908
|
+
<a href="../distributed_state_locking/" title="Distributed State Locking" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
909
|
+
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
910
|
+
<span class="md-flex__ellipsis">
|
911
|
+
<span class="md-footer-nav__direction">
|
912
|
+
Next
|
913
|
+
</span>
|
914
|
+
Distributed State Locking
|
915
|
+
</span>
|
916
|
+
</div>
|
917
|
+
<div class="md-flex__cell md-flex__cell--shrink">
|
918
|
+
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
919
|
+
</div>
|
920
|
+
</a>
|
921
|
+
|
922
|
+
</nav>
|
923
|
+
</div>
|
924
|
+
|
925
|
+
<div class="md-footer-meta md-typeset">
|
926
|
+
<div class="md-footer-meta__inner md-grid">
|
927
|
+
<div class="md-footer-copyright">
|
928
|
+
|
929
|
+
<div class="md-footer-copyright__highlight">
|
930
|
+
Copyright © 2018 Andrew Khoury
|
931
|
+
</div>
|
932
|
+
|
933
|
+
powered by
|
934
|
+
<a href="https://www.mkdocs.org">MkDocs</a>
|
935
|
+
and
|
936
|
+
<a href="https://squidfunk.github.io/mkdocs-material/">
|
937
|
+
Material for MkDocs</a>
|
938
|
+
</div>
|
939
|
+
|
940
|
+
|
941
|
+
|
942
|
+
</div>
|
943
|
+
</div>
|
944
|
+
</footer>
|
945
|
+
|
946
|
+
</div>
|
947
|
+
|
948
|
+
<script src="../../assets/javascripts/application.a59e2a89.js"></script>
|
949
|
+
|
950
|
+
<script>app.initialize({version:"0.17.5",url:{base:"../.."}})</script>
|
951
|
+
|
952
|
+
|
953
|
+
|
954
|
+
|
955
|
+
|
956
|
+
</body>
|
957
|
+
</html>
|