universa_tools 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f02a1207b195576773efc0c3cb78f8b1dc368c164e38b49024f1fe545d714d2
4
- data.tar.gz: 21fdb60b9ff17182cef5c88fae6a1b60b549fcc5b6d805f68e6f658c02874ff1
3
+ metadata.gz: d846d55be3199f2f3e71bc8ba9c69a94ecde94d4a108f9861dea0e8c99c23c69
4
+ data.tar.gz: 32d94e1c9a4c1d1838e792e7768ccf66208110292a230dde3f703361b14532d4
5
5
  SHA512:
6
- metadata.gz: b57160bfded93d70be7221b9ea6fc9bc2723a77532da5e1410e23a402393855d461c0e8eeb6700bbfe921364d92a2451ac9929c484fb883e8992ce29a081e88d
7
- data.tar.gz: 7b775b905678873dbd1c8555dab5df456789b440aee4e2b4971256386b5cf9635adc8b166c150b50be1c8215ce51a0b2b01a6242f75be8529efe670a5419788b
6
+ metadata.gz: 620cc50e666e52911d95f50bce9bf885e4236a502e36360b1c55e1eab297d51ca0b4afb339073b48c0222801afbe12c49f16462bcfe28610eb86c25277998d67
7
+ data.tar.gz: 56d7392c339d53eeb1a36655f98896e0c5fd87b9f8a90c919abfda0160a5bb772253c1c1c8fb3b6059b29a4d30af1f2cb79280232a06d69a81964fdbe8d8714f
data/.idea/workspace.xml CHANGED
@@ -1,9 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
- <list default="true" id="b5de240c-a3f4-4e4f-a942-24748bb7a400" name="Default Changelist" comment="">
4
+ <list default="true" id="b5de240c-a3f4-4e4f-a942-24748bb7a400" name="Default Changelist" comment="corrected UNS.reduce tables, after voting for цяb subst">
5
5
  <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
6
- <change beforePath="$PROJECT_DIR$/lib/universa_tools/uniring.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/universa_tools/uniring.rb" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/lib/universa_tools/commons.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/universa_tools/commons.rb" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/lib/universa_tools/u_wallet.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/universa_tools/u_wallet.rb" afterDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/lib/universa_tools/uns.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/universa_tools/uns.rb" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/lib/universa_tools/version.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/universa_tools/version.rb" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/spec/u_wallet_spec.rb" beforeDir="false" afterPath="$PROJECT_DIR$/spec/u_wallet_spec.rb" afterDir="false" />
11
+ <change beforePath="$PROJECT_DIR$/spec/uns_spec.rb" beforeDir="false" afterPath="$PROJECT_DIR$/spec/uns_spec.rb" afterDir="false" />
7
12
  <change beforePath="$PROJECT_DIR$/universa_tools.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/universa_tools.gemspec" afterDir="false" />
8
13
  </list>
9
14
  <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -15,8 +20,8 @@
15
20
  <component name="FileTemplateManagerImpl">
16
21
  <option name="RECENT_TEMPLATES">
17
22
  <list>
18
- <option value="Ruby File" />
19
23
  <option value="Ruby Class" />
24
+ <option value="Ruby File" />
20
25
  </list>
21
26
  </option>
22
27
  </component>
@@ -27,8 +32,8 @@
27
32
  <component name="PropertiesComponent">
28
33
  <property name="RakeTaksPopup.undocumentedIncluded" value="false" />
29
34
  <property name="WebServerToolWindowFactoryState" value="false" />
30
- <property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="JavaScript 1.8" />
31
- <property name="last_opened_file_path" value="$PROJECT_DIR$/lib/universa_tools" />
35
+ <property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="ruby&#10;JavaScript 1.8" />
36
+ <property name="last_opened_file_path" value="$PROJECT_DIR$/spec" />
32
37
  <property name="node.js.detected.package.eslint" value="true" />
33
38
  <property name="node.js.detected.package.tslint" value="true" />
34
39
  <property name="node.js.path.for.package.eslint" value="project" />
@@ -43,8 +48,8 @@
43
48
  </component>
44
49
  <component name="RecentsManager">
45
50
  <key name="CopyFile.RECENT_KEYS">
46
- <recent name="$PROJECT_DIR$/lib/universa_tools" />
47
51
  <recent name="$PROJECT_DIR$/spec" />
52
+ <recent name="$PROJECT_DIR$/lib/universa_tools" />
48
53
  <recent name="$PROJECT_DIR$/exe" />
49
54
  </key>
50
55
  </component>
@@ -61,40 +66,26 @@
61
66
  </option>
62
67
  </component>
63
68
  <component name="RunManager" selected="RSpec.All specs in spec: universa_tools">
64
- <configuration name="All specs in spec: universa_tools" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
69
+ <configuration name="IRB console: universa_tools" type="IrbRunConfigurationType" factoryName="IRB console" temporary="true">
65
70
  <module name="universa_tools" />
66
- <predefined_log_file enabled="true" id="RUBY_RSPEC" />
67
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
68
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
69
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
70
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
71
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
72
- <envs>
73
- <env name="JRUBY_OPTS" value="-X+O" />
74
- </envs>
75
- <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
71
+ <IRB_RUN_CONFIG NAME="RUBY_ARGS" VALUE="" />
72
+ <IRB_RUN_CONFIG NAME="WORK DIR" VALUE="$MODULE_DIR$" />
73
+ <IRB_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
74
+ <IRB_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
75
+ <IRB_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
76
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
76
77
  <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
77
78
  <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
78
79
  <COVERAGE_PATTERN ENABLED="true">
79
80
  <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
80
81
  </COVERAGE_PATTERN>
81
82
  </EXTENSION>
82
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/spec" />
83
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
84
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
85
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
86
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
87
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="ALL_IN_FOLDER" />
88
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
89
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
90
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
91
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
92
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
93
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
94
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
83
+ <IRB_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="$APPLICATION_HOME_DIR$/rb/testing/runner/irb.rb" />
84
+ <IRB_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="--prompt simple" />
85
+ <IRB_RUN_CONFIG NAME="IS_RAILS_CONSOLE" VALUE="false" />
95
86
  <method v="2" />
96
87
  </configuration>
97
- <configuration name="KeyRing creates new ring" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
88
+ <configuration name="All specs in spec: universa_tools" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
98
89
  <module name="universa_tools" />
99
90
  <predefined_log_file enabled="true" id="RUBY_RSPEC" />
100
91
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
@@ -112,12 +103,12 @@
112
103
  <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
113
104
  </COVERAGE_PATTERN>
114
105
  </EXTENSION>
115
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
116
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/keying_spec.rb" />
106
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/spec" />
107
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
117
108
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
118
109
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
119
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="KeyRing creates new ring" />
120
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
110
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
111
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="ALL_IN_FOLDER" />
121
112
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
122
113
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
123
114
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
@@ -127,7 +118,7 @@
127
118
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
128
119
  <method v="2" />
129
120
  </configuration>
130
- <configuration name="KeyRing" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
121
+ <configuration name="UNS reduces" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
131
122
  <module name="universa_tools" />
132
123
  <predefined_log_file enabled="true" id="RUBY_RSPEC" />
133
124
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
@@ -146,10 +137,10 @@
146
137
  </COVERAGE_PATTERN>
147
138
  </EXTENSION>
148
139
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
149
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/keying_spec.rb" />
140
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/uns_spec.rb" />
150
141
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
151
142
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
152
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="KeyRing" />
143
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="UNS reduces" />
153
144
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
154
145
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
155
146
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
@@ -160,7 +151,7 @@
160
151
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
161
152
  <method v="2" />
162
153
  </configuration>
163
- <configuration name="uniring utility" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
154
+ <configuration name="u_wallet constructs" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
164
155
  <module name="universa_tools" />
165
156
  <predefined_log_file enabled="true" id="RUBY_RSPEC" />
166
157
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
@@ -179,10 +170,10 @@
179
170
  </COVERAGE_PATTERN>
180
171
  </EXTENSION>
181
172
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
182
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/uniring_spec.rb" />
173
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/u_wallet_spec.rb" />
183
174
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
184
175
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
185
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="uniring utility" />
176
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="u_wallet constructs" />
186
177
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
187
178
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
188
179
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
@@ -193,7 +184,7 @@
193
184
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
194
185
  <method v="2" />
195
186
  </configuration>
196
- <configuration name="uniring_spec" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
187
+ <configuration name="u_wallet pays uns" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true" nameIsGenerated="true">
197
188
  <module name="universa_tools" />
198
189
  <predefined_log_file enabled="true" id="RUBY_RSPEC" />
199
190
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
@@ -212,10 +203,10 @@
212
203
  </COVERAGE_PATTERN>
213
204
  </EXTENSION>
214
205
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
215
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/uniring_spec.rb" />
206
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/u_wallet_spec.rb" />
216
207
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
217
208
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
218
- <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
209
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="u_wallet pays uns" />
219
210
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
220
211
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
221
212
  <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
@@ -229,10 +220,10 @@
229
220
  <recent_temporary>
230
221
  <list>
231
222
  <item itemvalue="RSpec.All specs in spec: universa_tools" />
232
- <item itemvalue="RSpec.KeyRing creates new ring" />
233
- <item itemvalue="RSpec.uniring_spec" />
234
- <item itemvalue="RSpec.uniring utility" />
235
- <item itemvalue="RSpec.KeyRing" />
223
+ <item itemvalue="RSpec.u_wallet pays uns" />
224
+ <item itemvalue="RSpec.u_wallet constructs" />
225
+ <item itemvalue="IRB console.IRB console: universa_tools" />
226
+ <item itemvalue="RSpec.UNS reduces" />
236
227
  </list>
237
228
  </recent_temporary>
238
229
  </component>
@@ -252,7 +243,13 @@
252
243
  <workItem from="1566484011256" duration="10407000" />
253
244
  <workItem from="1566652054854" duration="6251000" />
254
245
  <workItem from="1566918610808" duration="6926000" />
255
- <workItem from="1567097255700" duration="37645000" />
246
+ <workItem from="1567097255700" duration="41011000" />
247
+ <workItem from="1567447512704" duration="12625000" />
248
+ <workItem from="1567724347584" duration="10000" />
249
+ <workItem from="1567801865613" duration="9803000" />
250
+ <workItem from="1568079682395" duration="4917000" />
251
+ <workItem from="1568278985272" duration="260000" />
252
+ <workItem from="1570002431639" duration="333000" />
256
253
  </task>
257
254
  <task id="LOCAL-00001" summary="initial">
258
255
  <created>1566484458753</created>
@@ -324,7 +321,42 @@
324
321
  <option name="project" value="LOCAL" />
325
322
  <updated>1567374720298</updated>
326
323
  </task>
327
- <option name="localTasksCounter" value="11" />
324
+ <task id="LOCAL-00011" summary="gesmpec requirement for ruby 2.6+">
325
+ <created>1567412117627</created>
326
+ <option name="number" value="00011" />
327
+ <option name="presentableId" value="LOCAL-00011" />
328
+ <option name="project" value="LOCAL" />
329
+ <updated>1567412117627</updated>
330
+ </task>
331
+ <task id="LOCAL-00012" summary="extended readme, added online docs to it.">
332
+ <created>1567416531068</created>
333
+ <option name="number" value="00012" />
334
+ <option name="presentableId" value="LOCAL-00012" />
335
+ <option name="project" value="LOCAL" />
336
+ <updated>1567416531068</updated>
337
+ </task>
338
+ <task id="LOCAL-00013" summary="initial reduce implementation">
339
+ <created>1567808617362</created>
340
+ <option name="number" value="00013" />
341
+ <option name="presentableId" value="LOCAL-00013" />
342
+ <option name="project" value="LOCAL" />
343
+ <updated>1567808617362</updated>
344
+ </task>
345
+ <task id="LOCAL-00014" summary="initial reduce implementation, improved">
346
+ <created>1567809088126</created>
347
+ <option name="number" value="00014" />
348
+ <option name="presentableId" value="LOCAL-00014" />
349
+ <option name="project" value="LOCAL" />
350
+ <updated>1567809088126</updated>
351
+ </task>
352
+ <task id="LOCAL-00015" summary="corrected UNS.reduce tables, after voting for цяb subst">
353
+ <created>1568079790194</created>
354
+ <option name="number" value="00015" />
355
+ <option name="presentableId" value="LOCAL-00015" />
356
+ <option name="project" value="LOCAL" />
357
+ <updated>1568079790194</updated>
358
+ </task>
359
+ <option name="localTasksCounter" value="16" />
328
360
  <servers />
329
361
  </component>
330
362
  <component name="TypeScriptGeneratedFilesManager">
@@ -354,14 +386,19 @@
354
386
  <MESSAGE value="more specs" />
355
387
  <MESSAGE value="first working version. KeyRing class and uniring CLI interface to it." />
356
388
  <MESSAGE value="missing docs" />
357
- <option name="LAST_COMMIT_MESSAGE" value="missing docs" />
389
+ <MESSAGE value="gesmpec requirement for ruby 2.6+" />
390
+ <MESSAGE value="extended readme, added online docs to it." />
391
+ <MESSAGE value="initial reduce implementation" />
392
+ <MESSAGE value="initial reduce implementation, improved" />
393
+ <MESSAGE value="corrected UNS.reduce tables, after voting for цяb subst" />
394
+ <option name="LAST_COMMIT_MESSAGE" value="corrected UNS.reduce tables, after voting for цяb subst" />
358
395
  </component>
359
396
  <component name="XDebuggerManager">
360
397
  <breakpoint-manager>
361
398
  <breakpoints>
362
399
  <line-breakpoint enabled="true" type="ruby-line">
363
400
  <url>file://$PROJECT_DIR$/lib/universa_tools/keyring.rb</url>
364
- <line>46</line>
401
+ <line>48</line>
365
402
  <properties a="-1">
366
403
  <option name="block-ordinal" value="-1" />
367
404
  </properties>
@@ -372,23 +409,31 @@
372
409
  </component>
373
410
  <component name="com.intellij.coverage.CoverageDataManagerImpl">
374
411
  <SUITE FILE_PATH="coverage/universa_tools@uniring_utility_shows_help.rcov" NAME="uniring utility shows help Coverage Results" MODIFIED="1567296251788" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
375
- <SUITE FILE_PATH="coverage/universa_tools@uniring.rcov" NAME="uniring Coverage Results" MODIFIED="1566914082799" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib/universa_tools" MODULE_NAME="universa_tools" />
412
+ <SUITE FILE_PATH="coverage/universa_tools@UNS.rcov" NAME="UNS Coverage Results" MODIFIED="1567849178662" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
376
413
  <SUITE FILE_PATH="coverage/universa_tools@uniring_spec.rcov" NAME="uniring_spec Coverage Results" MODIFIED="1567371103192" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
377
- <SUITE FILE_PATH="coverage/universa_tools@uniring_utility_add_keys.rcov" NAME="uniring utility add keys Coverage Results" MODIFIED="1567367228624" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
378
- <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_creates_new_ring.rcov" NAME="UniversaTools creates new ring Coverage Results" MODIFIED="1567256636642" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
379
414
  <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_makes_pbkdf2_KR.rcov" NAME="UniversaTools makes pbkdf2 KR Coverage Results" MODIFIED="1567166457196" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
380
415
  <SUITE FILE_PATH="coverage/universa_tools@uniring_utility_creates_emp___.rcov" NAME="uniring utility creates emp... Coverage Results" MODIFIED="1567296357954" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
381
416
  <SUITE FILE_PATH="coverage/universa_tools@uniring_utility.rcov" NAME="uniring utility Coverage Results" MODIFIED="1567369219760" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
382
417
  <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_suports_readonly.rcov" NAME="UniversaTools suports readonly Coverage Results" MODIFIED="1567256639449" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
383
418
  <SUITE FILE_PATH="coverage/universa_tools@uniring_utility_creates_emp_____1_.rcov" NAME="uniring utility creates emp... (1) Coverage Results" MODIFIED="1567342698032" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
419
+ <SUITE FILE_PATH="coverage/universa_tools@u_wallet_pays_uns.rcov" NAME="u_wallet pays uns Coverage Results" MODIFIED="1568189575664" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
420
+ <SUITE FILE_PATH="coverage/universa_tools@All_specs_in_spec__universa_tools.rcov" NAME="All specs in spec: universa_tools Coverage Results" MODIFIED="1570002738331" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
421
+ <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_can_create_UN___.rcov" NAME="UniversaTools can create UN... Coverage Results" MODIFIED="1567848976512" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
422
+ <SUITE FILE_PATH="coverage/universa_tools@keying_spec.rcov" NAME="keying_spec Coverage Results" MODIFIED="1567466681075" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
423
+ <SUITE FILE_PATH="coverage/universa_tools@fix.rcov" NAME="fix Coverage Results" MODIFIED="1566936576002" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$USER_HOME$/Nextcloud/xchange support cases/0001-2019-01-Dimmao" MODULE_NAME="universa_tools" />
424
+ <SUITE FILE_PATH="coverage/universa_tools@IRB_console__universa_tools.rcov" NAME="IRB console: universa_tools Coverage Results" MODIFIED="1568080543716" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
425
+ <SUITE FILE_PATH="coverage/universa_tools@uniring.rcov" NAME="uniring Coverage Results" MODIFIED="1566914082799" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib/universa_tools" MODULE_NAME="universa_tools" />
426
+ <SUITE FILE_PATH="coverage/universa_tools@uniring_utility_add_keys.rcov" NAME="uniring utility add keys Coverage Results" MODIFIED="1567367228624" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
427
+ <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_creates_new_ring.rcov" NAME="UniversaTools creates new ring Coverage Results" MODIFIED="1567256636642" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
428
+ <SUITE FILE_PATH="coverage/universa_tools@UniversaTools.rcov" NAME="UniversaTools Coverage Results" MODIFIED="1567849174960" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
384
429
  <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_serialized_in___.rcov" NAME="UniversaTools serialized in... Coverage Results" MODIFIED="1567166819227" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
385
430
  <SUITE FILE_PATH="coverage/universa_tools@UniversaTools_can_be_re_sav___.rcov" NAME="UniversaTools can be re-sav... Coverage Results" MODIFIED="1567189309931" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
431
+ <SUITE FILE_PATH="coverage/universa_tools@UNS_reduces.rcov" NAME="UNS reduces Coverage Results" MODIFIED="1568079757574" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
432
+ <SUITE FILE_PATH="coverage/universa_tools@u_wallet_constructs.rcov" NAME="u_wallet constructs Coverage Results" MODIFIED="1568081011308" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
386
433
  <SUITE FILE_PATH="coverage/universa_tools@ecrypted_record_spec.rcov" NAME="ecrypted_record_spec Coverage Results" MODIFIED="1567176607842" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
387
434
  <SUITE FILE_PATH="coverage/universa_tools@uctool.rcov" NAME="uctool Coverage Results" MODIFIED="1566939090919" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/exe" MODULE_NAME="universa_tools" />
388
435
  <SUITE FILE_PATH="coverage/universa_tools@KeyRing.rcov" NAME="KeyRing Coverage Results" MODIFIED="1567368477544" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
389
- <SUITE FILE_PATH="coverage/universa_tools@All_specs_in_spec__universa_tools.rcov" NAME="All specs in spec: universa_tools Coverage Results" MODIFIED="1567373914182" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
390
- <SUITE FILE_PATH="coverage/universa_tools@KeyRing_creates_new_ring.rcov" NAME="KeyRing creates new ring Coverage Results" MODIFIED="1567372423951" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
391
- <SUITE FILE_PATH="coverage/universa_tools@fix.rcov" NAME="fix Coverage Results" MODIFIED="1566936576002" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$USER_HOME$/Nextcloud/xchange support cases/0001-2019-01-Dimmao" MODULE_NAME="universa_tools" />
392
- <SUITE FILE_PATH="coverage/universa_tools@IRB_console__universa_tools.rcov" NAME="IRB console: universa_tools Coverage Results" MODIFIED="1567163029632" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
436
+ <SUITE FILE_PATH="coverage/universa_tools@KeyRing_creates_new_ring.rcov" NAME="KeyRing creates new ring Coverage Results" MODIFIED="1567465475995" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="universa_tools" />
437
+ <SUITE FILE_PATH="coverage/universa_tools@UnsService.rcov" NAME="UnsService Coverage Results" MODIFIED="1567802448797" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/lib/universa_tools" MODULE_NAME="universa_tools" />
393
438
  </component>
394
439
  </project>
data/README.md CHANGED
@@ -1,7 +1,15 @@
1
1
  # UniversaTools
2
2
 
3
- This is work in progress at early stage. Please come back soon.
3
+ The set of command-line tools and utility classes to simplify using Universa blockchain
4
+ in ruby projects. Alfa stagem see usage section below for features by state.
4
5
 
6
+ ## Why not universa gem?
7
+
8
+ This workw was split from universa gem because of its lightweight nature allowing
9
+ easy, painless upgrades, unlike huge universa gem that causes few megs of universa core
10
+ libraries to be reinstalled on each release. Therefore, we limit releases
11
+ of [universa gem] to the universa core and adapters updates, and put most of work in porgres
12
+ in this lightweight gem.
5
13
 
6
14
  ## Installation
7
15
 
@@ -21,8 +29,16 @@ Or install it yourself as:
21
29
 
22
30
  ## Usage
23
31
 
24
- Yet not usable
32
+ Please see [online docs], the following are ready to beta test:
33
+
34
+ - [KeyRing](https://kb.universablockchain.com/system/static/gem_universa_tools/UniversaTools/KeyRing.html)
35
+
36
+ ### Command line tools:
25
37
 
38
+ When the gem is installed, get tools help with the terminal:
39
+
40
+ uctool -h
41
+ uniring -h
26
42
 
27
43
  ## Development
28
44
 
@@ -32,7 +48,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
48
 
33
49
  ## Contributing
34
50
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/universa_tools. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/universa_tools. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct below.
36
52
 
37
53
  ## License
38
54
 
@@ -40,4 +56,9 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
56
 
41
57
  ## Code of Conduct
42
58
 
43
- Everyone interacting in the UniversaTools project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/universa_tools/blob/master/CODE_OF_CONDUCT.md).
59
+ We have simplified it and on focus the development not social networking.
60
+
61
+ Everyone interacting in the UniversaTools project’s codebase, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/universa_tools/blob/master/CODE_OF_CONDUCT.md).
62
+
63
+ [universa gem]:https://github.com/sergeych/universa
64
+ [online docs]:https://kb.universablockchain.com/system/static/gem_universa_tools
@@ -1,135 +1,168 @@
1
1
  require 'ansi/code'
2
2
 
3
3
  module UniversaTools
4
+ module Commons
5
+
6
+ using Universa
7
+
8
+ def human_to_i value, factor = 1000
9
+ head, tail = value[0...-1], value[-1]
10
+ case tail
11
+ when 'k', 'K'
12
+ head.to_i * 1000
13
+ when 'M', 'm'
14
+ head.to_i * factor * factor
15
+ when 'G', 'g'
16
+ head.to_i * factor * factor * factor
17
+ else
18
+ value.to_t
19
+ end
20
+ end
4
21
 
5
- using Universa
6
-
7
- def human_to_i value, factor = 1000
8
- head, tail = value[0...-1], value[-1]
9
- case tail
10
- when 'k', 'K'
11
- head.to_i * 1000
12
- when 'M', 'm'
13
- head.to_i * factor * factor
14
- when 'G', 'g'
15
- head.to_i * factor * factor * factor
22
+ def seconds_to_hms seconds
23
+ mm, ss = seconds.divmod(60)
24
+ hh, mm = mm.divmod(60)
25
+ "%d:%02d:%02d" % [hh, mm, ss]
26
+ end
27
+
28
+ def run_options_parser(opt_parser, tasks_before_commands: false, check_empty: true, &command_parser)
29
+ commands = opt_parser.order!
30
+ if check_empty && @tasks.empty?
31
+ puts opt_parser.banner
32
+ puts "\nnothing to do. Use -h for help\n"
16
33
  else
17
- value.to_t
34
+ @tasks.each { |t| t.call } if tasks_before_commands
35
+ command_parser&.call(commands)
36
+ @tasks.each { |t| t.call } unless tasks_before_commands
37
+ end
38
+ rescue MessageException, OptionParser::ParseError => e
39
+ STDERR.puts ANSI.red { ANSI.bold { "\nError: #{e}\n" } }
40
+ exit(1000)
41
+ rescue Interrupt
42
+ exit(1010)
43
+ rescue
44
+ STDERR.puts ANSI.red { "\n#{$!.backtrace.reverse.join("\n")}\n" }
45
+ STDERR.puts ANSI.red { ANSI.bold { "Error: #$! (#{$!.class.name})" } }
46
+ exit(2000)
18
47
  end
19
- end
20
48
 
21
- def seconds_to_hms seconds
22
- mm, ss = seconds.divmod(60)
23
- hh, mm = mm.divmod(60)
24
- "%d:%02d:%02d" % [hh, mm, ss]
25
- end
49
+ def todo!(text)
50
+ raise NotImplementedError, text
51
+ end
26
52
 
27
- def run_options_parser(opt_parser, tasks_before_commands: false, check_empty: true, &command_parser)
28
- commands = opt_parser.order!
29
- if check_empty && @tasks.empty?
30
- puts opt_parser.banner
31
- puts "\nnothing to do. Use -h for help\n"
32
- else
33
- @tasks.each { |t| t.call } if tasks_before_commands
34
- command_parser&.call(commands)
35
- @tasks.each { |t| t.call } unless tasks_before_commands
53
+ def error_style(message = nil)
54
+ message ||= yield
55
+ ANSI.bold { ANSI.red { message } }
36
56
  end
37
- rescue MessageException, OptionParser::ParseError => e
38
- STDERR.puts ANSI.red { ANSI.bold { "\nError: #{e}\n" } }
39
- exit(1000)
40
- rescue Interrupt
41
- exit(1010)
42
- rescue
43
- STDERR.puts ANSI.red { "\n#{$!.backtrace.reverse.join("\n")}\n" }
44
- STDERR.puts ANSI.red { ANSI.bold { "Error: #$! (#{$!.class.name})" } }
45
- exit(2000)
46
- end
47
57
 
48
- def todo!(text)
49
- raise NotImplementedError, text
50
- end
58
+ def success_style(message = nil)
59
+ message ||= yield
60
+ ANSI.bold { ANSI.green { message } }
61
+ end
51
62
 
52
- def error_style(message = nil)
53
- message ||= yield
54
- ANSI.bold { ANSI.red { message } }
55
- end
63
+ def warning_style(message = nil)
64
+ message ||= yield
65
+ ANSI.bold { ANSI.yellow { message } }
66
+ end
56
67
 
57
- def success_style(message = nil)
58
- message ||= yield
59
- ANSI.bold { ANSI.green { message } }
60
- end
68
+ alnums = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
69
+ ALNUMS = (alnums + alnums.downcase + '_' + '0123456789').chars.to_ary
70
+ NUMBERS = "0123456789".chars.to_ary
61
71
 
62
- def warning_style(message = nil)
63
- message ||= yield
64
- ANSI.bold { ANSI.yellow { message } }
65
- end
72
+ module CliCommands
73
+ class Command
66
74
 
67
- alnums = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
68
- ALNUMS = (alnums + alnums.downcase + '_' + '0123456789').chars.to_ary
69
- NUMBERS = "0123456789".chars.to_ary
75
+ attr :name, :description, :second_name, :dispatcher
70
76
 
71
- module CliCommands
72
- class Command
77
+ def initialize(name, second_name, description, dispatcher)
78
+ @name, @second_name, @description, @dispatcher = name, second_name, description, dispatcher
79
+ end
73
80
 
74
- attr :name, :description, :second_name, :dispatcher
81
+ end
75
82
 
76
- def initialize(name, second_name, description, dispatcher)
77
- @name, @second_name, @description, @dispatcher = name, second_name, description, dispatcher
83
+ def cmd(name1, name2, description = nil, &block)
84
+ if !description
85
+ description = name2
86
+ name2 = nil
87
+ end
88
+ command = Command.new(name1, name2, description, block)
89
+ @commands[name1] = command
90
+ @commands[name2] = command if name2
78
91
  end
79
92
 
80
- end
93
+ def cmd_list
94
+ puts "Listing contents of #@keyring_path:"
95
+ keyring
96
+ end
81
97
 
82
- def cmd(name1, name2, description=nil, &block)
83
- if !description
84
- description = name2
85
- name2 = nil
98
+ def init_commands
99
+ cmd("help", "help on supported commands. To get extended help on some command, use 'help <command>'.") { |args|
100
+ STDOUT.puts @option_parser.banner
101
+ puts ""
102
+ if args.empty?
103
+ puts "#{ANSI.bold { "Available commands:" }}\n\n"
104
+ cc = @commands.values.uniq
105
+ first_column_size = cc.map { |x| x.name.size }.max + 2
106
+ cc.each { |cmd|
107
+ description_lines =
108
+ first_spacer = ANSI.bold { ANSI.yellow { "%#{-first_column_size}s" % cmd.name } }
109
+ next_spacer = ' ' * first_column_size
110
+ cmd.description.word_wrap(@term_width - first_column_size).lines.each_with_index { |s, n|
111
+ STDOUT << (n == 0 ? first_spacer : next_spacer)
112
+ STDOUT.puts s
113
+ }
114
+
115
+ }
116
+ else
117
+ puts "-- not yet ready"
118
+ end
119
+ }
120
+
121
+ cmd("list", "l", "show contents of the keyring")
86
122
  end
87
- command = Command.new(name1, name2, description, block)
88
- @commands[name1] = command
89
- @commands[name2] = command if name2
90
123
  end
91
124
 
92
- def cmd_list
93
- puts "Listing contents of #@keyring_path:"
94
- keyring
125
+ def create_temp_file_name root_path, extension
126
+ loop do
127
+ name = "#{root_path}/#{17.random_alnums}.#{extension}"
128
+ return name if !File.exists?(name)
129
+ end
95
130
  end
96
131
 
97
- def init_commands
98
- cmd("help", "help on supported commands. To get extended help on some command, use 'help <command>'.") { |args|
99
- STDOUT.puts @option_parser.banner
100
- puts ""
101
- if args.empty?
102
- puts "#{ANSI.bold { "Available commands:" }}\n\n"
103
- cc = @commands.values.uniq
104
- first_column_size = cc.map { |x| x.name.size }.max + 2
105
- cc.each { |cmd|
106
- description_lines =
107
- first_spacer = ANSI.bold { ANSI.yellow { "%#{-first_column_size}s" % cmd.name } }
108
- next_spacer = ' ' * first_column_size
109
- cmd.description.word_wrap(@term_width - first_column_size).lines.each_with_index { |s, n|
110
- STDOUT << (n == 0 ? first_spacer : next_spacer)
111
- STDOUT.puts s
112
- }
132
+ # Load contratc from the path
133
+ # @param [String] path to load contract from
134
+ # @return [Universa::Contract]
135
+ def load_contract(path)
136
+ open(path, 'rb') { |f| Universa::Contract.from_packed(f.read) }
137
+ end
113
138
 
114
- }
115
- else
116
- puts "-- not yet ready"
117
- end
118
- }
139
+ # Load private key from file
140
+ #
141
+ # @param [String] path to load key from
142
+ # @param [String] password optional password
143
+ # @return [Universa::PrivateKey]
144
+ def load_private_key(path, password: nil)
145
+ file_name = File.expand_path path
146
+ if !File.exists?(file_name)
147
+ file_name += ".private.unikey"
148
+ raise NotFoundException.new(path) unless File.exists?(file_name)
149
+ end
150
+ open(file_name, 'rb') { |f| Universa::PrivateKey.from_packed(f.read, password: password) }
151
+ end
119
152
 
120
- cmd("list", "l", "show contents of the keyring")
153
+ def error(message)
154
+ raise UniversaTools::MessageException, message
121
155
  end
122
156
  end
123
-
124
157
  end
125
158
 
126
159
  class Integer
127
160
  def random_alnums
128
- to_i.times.map { UniversaTools::ALNUMS.sample }.join('')
161
+ to_i.times.map { UniversaTools::Commons::ALNUMS.sample }.join('')
129
162
  end
130
163
 
131
164
  def random_digits
132
- to_i.times.map { UniversaTools::NUMBERS.sample }.join('')
165
+ to_i.times.map { UniversaTools::Commons::NUMBERS.sample }.join('')
133
166
  end
134
167
 
135
168
  def random_bytes
@@ -137,4 +170,22 @@ class Integer
137
170
  end
138
171
  end
139
172
 
173
+ class Numeric
174
+ def seconds
175
+ self
176
+ end
177
+
178
+ def minutes
179
+ self*60
180
+ end
181
+
182
+ def hours
183
+ self*3600
184
+ end
185
+
186
+ def days
187
+ self*86400
188
+ end
189
+ end
190
+
140
191
 
@@ -19,10 +19,12 @@ module UniversaTools
19
19
  end
20
20
  end
21
21
 
22
- end
22
+ class InsufficientFundsException < CodeException
23
+ def initialize
24
+ super(:insufficient_funds)
25
+ end
26
+ end
23
27
 
24
- def error(message)
25
- raise UniversaTools::MessageException, message
26
28
  end
27
29
 
28
30
 
@@ -17,6 +17,8 @@ module UniversaTools
17
17
  # itself in the unsafe containers (dropbox, github, google disk, etc.)
18
18
  class KeyRing
19
19
 
20
+ include Commons
21
+
20
22
  attr :keys
21
23
 
22
24
  # The record class that hold key, tag and associated information inside the ring
@@ -79,7 +81,7 @@ module UniversaTools
79
81
  if @key_addresses[key.short_address] || @key_addresses[key.long_address]
80
82
  raise ArgumentError, "key is already in the ring"
81
83
  end
82
- kr = KeyRecord.new(tag, key, key_data, create_temp_file_name('data'))
84
+ kr = KeyRecord.new(tag, key, key_data, create_temp_file_name(@root_path, 'data'))
83
85
  kr.save(@main_key)
84
86
  @keys << kr
85
87
  @key_tags[tag] = kr
@@ -101,8 +103,9 @@ module UniversaTools
101
103
  }
102
104
  end
103
105
 
104
- # Find a key by tag or address
105
- # @param [String | KeyAddress] tag_or_address to look for
106
+ # Find a key by tag or address.
107
+ # @param [String | KeyAddress] tag_or_address to look for. String could be a tag or string representation of
108
+ # KeyAddress
106
109
  # @return [PrivateKey] or nil
107
110
  def [](tag_or_address)
108
111
  find(tag_or_address)&.key
@@ -139,7 +142,7 @@ module UniversaTools
139
142
  # delete the key off the ring
140
143
  # @raise [NotFoundException] if such a key is not in the ring
141
144
  def delete_key key
142
- record = @keys.find { |r| r.key == key}
145
+ record = @keys.find { |r| r.key == key }
143
146
  record or raise NotFoundException
144
147
  record.tag && @key_tags.delete(record.tag)
145
148
  @key_addresses.delete(record.key.long_address)
@@ -151,14 +154,13 @@ module UniversaTools
151
154
  private
152
155
 
153
156
  def find(tag_or_address)
154
- @key_tags[tag_or_address] || @key_addresses[tag_or_address]
155
- end
156
-
157
- def create_temp_file_name extension
158
- loop do
159
- name = "#{@root_path}/#{17.random_alnums}.#{extension}"
160
- return name if !File.exists?(name)
161
- end
157
+ k = @key_tags[tag_or_address] and return k
158
+ address = tag_or_address.is_a?(Universa::KeyAddress) ? tag_or_address : Universa::KeyAddress.new(tag_or_address)
159
+ @keys.select { |kr| address.isMatchingKey(kr.key.public_key) }.first
160
+ rescue Farcall::RemoteError
161
+ raise $! if $!.message !~ /IllegalArgumentException/
162
+ # it is just a missing tag
163
+ nil
162
164
  end
163
165
 
164
166
  def console_password_input(prompt)
@@ -0,0 +1,137 @@
1
+ require 'ostruct'
2
+ require 'io/console'
3
+ require 'universa_tools/commons'
4
+ require 'universa_tools/errors'
5
+ require 'universa_tools/crypto_record'
6
+ require 'universa_tools/semantic_version'
7
+ require 'fileutils'
8
+
9
+ =begin
10
+
11
+ u_wallet file structure
12
+
13
+ path.unicon # always
14
+ path.unicon~ # sometimes, previous version
15
+
16
+ =end
17
+
18
+ module UniversaTools
19
+
20
+ class Universa::Parcel
21
+ static_method :of
22
+ static_method :unpack
23
+ end
24
+
25
+ # Under construction. FS-based U wallet. This version misses support for multiple-resulting paying parcel
26
+ # operation, so it will be completely reqwritten. Please do not use.
27
+ class UWallet
28
+ include Universa
29
+
30
+ # U left
31
+ attr :balance
32
+
33
+ # TestU left
34
+ attr :test_balance
35
+
36
+ # @param [String] path to the U ucontract
37
+ # @param [PrivateKey] key for the UContract
38
+ # @param [KeyRing] keyring to look for a key in
39
+ # @param [Universa::Client] client to connect to the Universa
40
+ def initialize(path, key: nil, keyring: nil, client: nil)
41
+ key || keyring or raise ArgumentError, "key or keyring must be presented"
42
+ key && keyring and raise ArgumentError, "only one of key or keyring must be presented"
43
+ @client = client || Universa::Client.new
44
+ restore_state path
45
+ check_key(key, keyring)
46
+ @mutex = Mutex.new
47
+ end
48
+
49
+ def busy?
50
+ @mutex.locked?
51
+ end
52
+
53
+ def register contract
54
+ @mutex.synchronize {
55
+ contract.check or raise ArgumentError, "contract is not OK"
56
+ units = contract.getProcessedCostU()
57
+ puts "cost #{units}"
58
+ parcel = Universa::Parcel.of(contract, @u, [@key])
59
+ p parcel
60
+ raise InsufficientFundsException if units > balance
61
+ # @client.2
62
+ }
63
+ end
64
+
65
+ private
66
+
67
+ def restore_state(path)
68
+ @current_name = File.expand_path path
69
+ # current path may not exist if the, say commit or rollback operation were interrupted
70
+ if File.exists?(@current_name)
71
+ @u = load_u(@current_name)
72
+ if @client.get_state(@u).approved?
73
+ delete_backup()
74
+ set_balance()
75
+ return
76
+ end
77
+ end
78
+ # main state is bad or missing - checking prev state
79
+ @u = load_u(backup_name)
80
+ if (@client.get_state(@u)).approved?
81
+ rollback()
82
+ else
83
+ error("No valid U contracts found")
84
+ end
85
+ end
86
+
87
+ # Load and check U contract, check that it is a valid U contract, does not checks it state!
88
+ # @param [String] path to load contract from
89
+ # @return [Contract]
90
+ def load_u(path)
91
+ u = open(path, 'rb') { |f| Contract.from_packed(f.read) }
92
+ d = u.definition
93
+ # {"issuerName"=>"Universa Reserve System", "name"=>"transaction units pack"}
94
+ # J3uaVvHE7JqhvVb1c26RyDhfJw9eP2KR1KRhm2VdmYx7NwHpzdHTyEPjcmKpgkJAtzWLSPUw
95
+ p u.issuer.getSimpleAddress.to_s
96
+ if d['issuerName'] != 'Universa Reserve System' || d['name'] != 'transaction units pack' ||
97
+ u.issuer.getSimpleAddress.to_s != 'J3uaVvHE7JqhvVb1c26RyDhfJw9eP2KR1KRhm2VdmYx7NwHpzdHTyEPjcmKpgkJAtzWLSPUw'
98
+ error("not a U contract")
99
+ end
100
+ u
101
+ end
102
+
103
+ def delete_backup
104
+ File.exists?(backup_name) and FileUtils.rm(backup_name)
105
+ end
106
+
107
+ def backup_name
108
+ @back_name ||= @current_name + "~"
109
+ end
110
+
111
+ def set_balance
112
+ @balance = @u.state.transaction_units
113
+ @test_balance = @u.state.test_transaction_units
114
+ end
115
+
116
+ # last become main
117
+ # main dissapears
118
+ def rollback
119
+ File.exists?(@current_name) and FileUtils.rm(@current_name)
120
+ # if it is interrupted, it will correctly restore on next run
121
+ FileUtils.move backup_name, @current_name
122
+ @u = load_u(@current_name)
123
+ set_balance
124
+ end
125
+
126
+ def check_key(key, keyring)
127
+ address = @u.owner.getSimpleAddress
128
+ @key = if key
129
+ address.isMatchingKey(key.public_key) or raise ArgumentError, "key is wrong"
130
+ key
131
+ else
132
+ keyring[address] or raise ArgumentError, "keyring does not contain required key"
133
+ end
134
+ end
135
+
136
+ end
137
+ end
@@ -12,9 +12,9 @@ include Universa
12
12
  # Show help it nothing to do
13
13
  # ARGV << "-h" if ARGV == []
14
14
 
15
-
16
15
  class Uniring
17
16
 
17
+ include UniversaTools::Commons
18
18
  include UniversaTools
19
19
 
20
20
  attr :option_parser
@@ -214,14 +214,14 @@ Usage:
214
214
  key = Universa::PrivateKey.from_packed(packed, password: password) rescue nil
215
215
  clearstring()
216
216
  key and return key
217
- puts error_style("wrong password")
217
+ puts error_style("wrong password or corrupted key file")
218
218
  end
219
219
  while !key do
220
220
  password = request_password("\rPlease enter password for #{file_name}:")
221
221
  print ANSI.faint("\rdecrypting the key...")
222
222
  key = Universa::PrivateKey.from_packed(packed, password: password) rescue nil
223
223
  clearstring()
224
- key or puts error_style("wrong password")
224
+ key or puts error_style("wrong password or corrupted key file")
225
225
  end
226
226
  key
227
227
  end
@@ -0,0 +1,212 @@
1
+ module UniversaTools
2
+
3
+ # Tools to work with UNS contracts, part or parsec protocols family
4
+ class UNS
5
+
6
+ # reduce string to its glyph archetypes removing any homological similarities and ambiguity
7
+ #
8
+ # @param [String] name to reduce
9
+ # @return [String] reduced name
10
+ # @raise [ArgumentError] if name contains unprocessable characters
11
+ def self.reduce(name)
12
+ # step 1: remove space and punctuation, step 2: NFKD
13
+ name = name.downcase.strip.gsub(/([-_=+()*&^%#@±§~`<,>\/?'";:{}\[\]"']|\s)+/, '_').unicode_normalize(:nfkd)
14
+ # step 3: XLAT1: removing composing characters and ligatures
15
+ name = name.chars.map { |x| xlat1[x] || x }.join('')
16
+ # step 4: reduce to glyph archetype
17
+ name.chars.map { |ch|
18
+ xlat2[ch] or raise ArgumentError, "illegal character: #{ch.ord}:'#{ch}' in #{name.inspect}"
19
+ }.join('')
20
+ end
21
+ private
22
+ def self.xlat1
23
+ @xlat1 ||= read_xlat(DEFAULT_XLAT1, '')
24
+ end
25
+
26
+ def self.xlat2
27
+ @xlat2 ||= begin
28
+ result = read_xlat(DEFAULT_XLAT2, :self)
29
+ read_xlat(DEFAULT_XLAT2_FINALIZER, :self).each { |final_key, final_value|
30
+ # finalizer algorithm: if it overrides result's value, alter it
31
+ # not effective at build time, but more effective when processing strings
32
+ # update all existing values according to final update table
33
+ affected_keys = result.select { |k, v| v == final_key }.keys
34
+ affected_keys.each { |k| result[k] = final_value }
35
+ result[final_key] = final_value
36
+ }
37
+ result
38
+ end
39
+ end
40
+
41
+ def self.decode(char)
42
+ char.strip!
43
+ if char.start_with?('U+')
44
+ code = char[2..].to_i(16)
45
+ [code, code.chr(Encoding::UTF_8)]
46
+ else
47
+ [char.ord, char]
48
+ end
49
+ end
50
+
51
+ def self.read_xlat(xlat, missing = '')
52
+ xlat.lines.reduce({}) { |all, line|
53
+ begin
54
+ line = line.split('#', 2)[0].strip
55
+ if line != ''
56
+ left, right = line.split(/\s+/)
57
+ case left
58
+ when /^(.+):(.+)$/
59
+ # range
60
+ start, stop = decode($1), decode($2)
61
+ (start[0]..stop[0]).each { |code|
62
+ ch = code.chr(Encoding::UTF_8)
63
+ all[ch] = right || (missing == :self ? ch : missing)
64
+ }
65
+ when /^(?!U\+)/
66
+ # sequence characters or single character
67
+ left.chars.each { |ch|
68
+ all[ch] = right || (missing == :self ? ch : missing)
69
+ }
70
+ else
71
+ # single character un U+00000 form
72
+ right ||= (missing == :self ? left : right)
73
+ all[decode(left)[1]] = right
74
+ end
75
+ end
76
+ rescue Exception
77
+ puts "Error in line: #{line.inspect}: #{$!}"
78
+ raise
79
+ end
80
+ all
81
+ }
82
+ end
83
+
84
+ end
85
+ end
86
+
87
+ #
88
+ # Composing characters and ligatures
89
+ DEFAULT_XLAT1 = <<END
90
+ # Combining diacritical marks, see https://en.wikipedia.org/wiki/Combining_Diacritical_Marks
91
+
92
+ U+0300:U+033C
93
+ U+033D x
94
+ U+033E:U+0362
95
+ U+0363 a
96
+ U+0364 e
97
+ U+0365 i
98
+ U+0366 o
99
+ U+0367 u
100
+ U+0368 c
101
+ U+0369 d
102
+ U+036A h
103
+ U+036B m
104
+ U+036C r
105
+ U+036D t
106
+ U+036E v
107
+ U+036F x
108
+
109
+ #
110
+ # replacing ligatures ------------------------
111
+ #
112
+
113
+ ꜳ aa
114
+ æ ae
115
+ ꜵ ao
116
+ ꜷ au
117
+ ꜹ av
118
+ ꜻ av
119
+ ꜽ ay
120
+ U+1F670 et
121
+ ff ff
122
+ ffi ffi
123
+ ffl ffl
124
+ fi phi
125
+ fl fl
126
+ œ oe
127
+ ꝏ oo
128
+ ß ss
129
+ st st
130
+ ſt st
131
+ ꜩ tz
132
+ ᵫ ue
133
+ ꝡ vy
134
+
135
+ END
136
+
137
+ #
138
+ # Glyph archetypes
139
+ #
140
+ DEFAULT_XLAT2 = <<END
141
+
142
+ # Cyrillic letters
143
+
144
+ а a
145
+ б b
146
+
147
+ в b # May be similar in uppercase
148
+
149
+ г 2 # In some fonts. RFC!
150
+ д
151
+ е e
152
+ ж x
153
+ з 3
154
+ и u
155
+ к k
156
+ л n
157
+ м m
158
+ н h
159
+ о o
160
+ п n
161
+ р p
162
+ с c
163
+ т t
164
+ у y
165
+ ф
166
+ х x
167
+ ц u
168
+ ч 4
169
+ ш
170
+ щ ш
171
+ ьъ b
172
+ ы bi
173
+ э 3
174
+ ю io
175
+ я 9
176
+
177
+ # Other national languages for characters that will not be
178
+ # normalized with NFKD to latin set. Do not put here any
179
+ # characters with diacritic modifications removed by NFKD normalization.
180
+
181
+ END
182
+
183
+ DEFAULT_XLAT2_FINALIZER = <<END
184
+ #
185
+ # Final similarity corrections table
186
+ #
187
+ # English correcting similar-looking glyphs. This section MUST be the last
188
+ # AND should altrer XLAT 2 table the following way:
189
+ #
190
+ # foreach ch in final
191
+ # - if xlat2[*] =
192
+
193
+ # first init all with self, for simplicity:
194
+ a:z
195
+ 0:9
196
+
197
+ # Now replace similar glyphs to archetypes:
198
+
199
+ il1|! 1
200
+ o0øº 0
201
+ u v
202
+ w vv
203
+ $s 5
204
+ b 6
205
+
206
+ # Punctuation placeholder:
207
+ _
208
+
209
+ # Cluster delimiter
210
+ .
211
+
212
+ END
@@ -1,3 +1,3 @@
1
1
  module UniversaTools
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
38
  spec.require_paths = ["lib"]
39
39
 
40
- spec.add_dependency 'universa', ">= 3.11.4.4"
40
+ spec.add_dependency 'universa', ">= 3.12.6.1"
41
41
  spec.add_dependency 'ansi'
42
42
  spec.add_dependency 'facets'
43
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universa_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-02 00:00:00.000000000 Z
11
+ date: 2019-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: universa
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.11.4.4
19
+ version: 3.12.6.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.11.4.4
26
+ version: 3.12.6.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ansi
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -125,7 +125,9 @@ files:
125
125
  - lib/universa_tools/errors.rb
126
126
  - lib/universa_tools/keyring.rb
127
127
  - lib/universa_tools/semantic_version.rb
128
+ - lib/universa_tools/u_wallet.rb
128
129
  - lib/universa_tools/uniring.rb
130
+ - lib/universa_tools/uns.rb
129
131
  - lib/universa_tools/version.rb
130
132
  - universa_tools.gemspec
131
133
  homepage: https://github.com/sergeych/universa_tools