f_dot 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +159 -0
- data/LICENSE.txt +21 -0
- data/README.md +18 -0
- data/Rakefile +5 -0
- data/bin/f_dot +17 -0
- data/checksums/f_dot-0.0.1.gem.sha512 +1 -0
- data/craft_setup.sh +9 -0
- data/deserialization_testing.rb +43 -0
- data/f_dot.gemspec +43 -0
- data/lib/f_dot/.DS_Store +0 -0
- data/lib/f_dot/based.rb +85 -0
- data/lib/f_dot/history.rb +157 -0
- data/lib/f_dot/instruction.rb +122 -0
- data/lib/f_dot/interface.rb +180 -0
- data/lib/f_dot/processor.rb +265 -0
- data/lib/f_dot/program.rb +471 -0
- data/lib/f_dot/variable.rb +149 -0
- data/lib/f_dot/version.rb +8 -0
- data/lib/f_dot.rb +35 -0
- data/oss_om_plugin.rb +56 -0
- data/tasks/console.rake +8 -0
- data/tasks/make.rake +4 -0
- metadata +188 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 50a11556b6e3a50ac7c129f5f0c0299c6022a349a5d148cef74ca3944bf8eb19
|
|
4
|
+
data.tar.gz: 0f14b0259d9010c5c8ed82084f9210481050a19de45b5394e2439e05e677f6bb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ceb1c8f7352d052a60ea6807f36b52e0e7f9f8e4b4172d6f2b884c9f675c20715956fe0d3e479daf2cecb2cf9be57ca6ecbc8fe119746f9721fa85ea0cf51372
|
|
7
|
+
data.tar.gz: f610d5077646ad8b53aac044968bb47b815967535055655566b0b35637b848c80316a64310b3b3d8c850b60824e986d1293968a718858bfd430b12ea1794ec74
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.7
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
f_dot (0.0.1)
|
|
5
|
+
tty-font (~> 0.5, >= 0.5.0)
|
|
6
|
+
tty-prompt (~> 0.23, >= 0.23.1)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
diff-lcs (1.6.2)
|
|
12
|
+
erb (6.0.7)
|
|
13
|
+
ffi (1.17.4)
|
|
14
|
+
ffi (1.17.4-aarch64-linux-gnu)
|
|
15
|
+
ffi (1.17.4-aarch64-linux-musl)
|
|
16
|
+
ffi (1.17.4-arm-linux-gnu)
|
|
17
|
+
ffi (1.17.4-arm-linux-musl)
|
|
18
|
+
ffi (1.17.4-arm64-darwin)
|
|
19
|
+
ffi (1.17.4-x86_64-darwin)
|
|
20
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
21
|
+
ffi (1.17.4-x86_64-linux-musl)
|
|
22
|
+
io-console (0.9.5)
|
|
23
|
+
irb (1.19.0)
|
|
24
|
+
pp (>= 0.6.0)
|
|
25
|
+
prism (>= 1.3.0)
|
|
26
|
+
rdoc (>= 4.0.0)
|
|
27
|
+
reline (>= 0.4.2)
|
|
28
|
+
listen (3.10.1)
|
|
29
|
+
logger
|
|
30
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
31
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
|
32
|
+
logger (1.7.0)
|
|
33
|
+
pastel (0.8.0)
|
|
34
|
+
tty-color (~> 0.5)
|
|
35
|
+
pp (0.6.4)
|
|
36
|
+
prettyprint
|
|
37
|
+
prettyprint (0.2.1)
|
|
38
|
+
prism (2.1.0)
|
|
39
|
+
prism (2.1.0-aarch64-linux-gnu)
|
|
40
|
+
prism (2.1.0-aarch64-linux-musl)
|
|
41
|
+
prism (2.1.0-arm-linux-gnu)
|
|
42
|
+
prism (2.1.0-arm-linux-musl)
|
|
43
|
+
prism (2.1.0-arm64-darwin)
|
|
44
|
+
prism (2.1.0-x86_64-darwin)
|
|
45
|
+
prism (2.1.0-x86_64-linux-gnu)
|
|
46
|
+
prism (2.1.0-x86_64-linux-musl)
|
|
47
|
+
rake (13.4.2)
|
|
48
|
+
rb-fsevent (0.11.2)
|
|
49
|
+
rb-inotify (0.11.1)
|
|
50
|
+
ffi (~> 1.0)
|
|
51
|
+
rbs (4.2.0)
|
|
52
|
+
logger
|
|
53
|
+
prism (>= 1.6.0)
|
|
54
|
+
tsort
|
|
55
|
+
rdoc (8.1.0)
|
|
56
|
+
erb
|
|
57
|
+
prism (>= 1.6.0)
|
|
58
|
+
rbs (>= 4.0.0)
|
|
59
|
+
tsort
|
|
60
|
+
reline (0.7.0)
|
|
61
|
+
io-console (~> 0.5)
|
|
62
|
+
rspec (3.13.2)
|
|
63
|
+
rspec-core (~> 3.13.0)
|
|
64
|
+
rspec-expectations (~> 3.13.0)
|
|
65
|
+
rspec-mocks (~> 3.13.0)
|
|
66
|
+
rspec-core (3.13.7)
|
|
67
|
+
rspec-support (~> 3.13.0)
|
|
68
|
+
rspec-expectations (3.13.6)
|
|
69
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
70
|
+
rspec-support (~> 3.13.0)
|
|
71
|
+
rspec-mocks (3.13.9)
|
|
72
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
73
|
+
rspec-support (~> 3.13.0)
|
|
74
|
+
rspec-support (3.13.8)
|
|
75
|
+
tsort (0.2.0)
|
|
76
|
+
tty-color (0.6.0)
|
|
77
|
+
tty-cursor (0.7.1)
|
|
78
|
+
tty-font (0.5.0)
|
|
79
|
+
tty-prompt (0.23.1)
|
|
80
|
+
pastel (~> 0.8)
|
|
81
|
+
tty-reader (~> 0.8)
|
|
82
|
+
tty-reader (0.9.0)
|
|
83
|
+
tty-cursor (~> 0.7)
|
|
84
|
+
tty-screen (~> 0.8)
|
|
85
|
+
wisper (~> 2.0)
|
|
86
|
+
tty-screen (0.8.2)
|
|
87
|
+
wisper (2.0.1)
|
|
88
|
+
|
|
89
|
+
PLATFORMS
|
|
90
|
+
aarch64-linux-gnu
|
|
91
|
+
aarch64-linux-musl
|
|
92
|
+
arm-linux-gnu
|
|
93
|
+
arm-linux-musl
|
|
94
|
+
arm64-darwin
|
|
95
|
+
ruby
|
|
96
|
+
x86_64-darwin
|
|
97
|
+
x86_64-linux-gnu
|
|
98
|
+
x86_64-linux-musl
|
|
99
|
+
|
|
100
|
+
DEPENDENCIES
|
|
101
|
+
bundler (~> 4.0, >= 4.0.22)
|
|
102
|
+
f_dot!
|
|
103
|
+
irb
|
|
104
|
+
listen (~> 3.10, >= 3.10.1)
|
|
105
|
+
rake (~> 13.4, >= 13.4.2, >= 0)
|
|
106
|
+
rspec (~> 3.13, >= 3.13.2)
|
|
107
|
+
|
|
108
|
+
CHECKSUMS
|
|
109
|
+
bundler (4.0.22) sha256=d8d5ec84c8555e0af71db63ed7aee4d1a8fb839ec46d84212d61979242a5d75a
|
|
110
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
111
|
+
erb (6.0.7) sha256=c5ca6dc25b0ef974a44dc8f59fe847577122483b1968a38dec305c60bf91ee92
|
|
112
|
+
f_dot (0.0.1)
|
|
113
|
+
ffi (1.17.4) sha256=bcd1642e06f0d16fc9e09ac6d49c3a7298b9789bcb58127302f934e437d60acf
|
|
114
|
+
ffi (1.17.4-aarch64-linux-gnu) sha256=b208f06f91ffd8f5e1193da3cae3d2ccfc27fc36fba577baf698d26d91c080df
|
|
115
|
+
ffi (1.17.4-aarch64-linux-musl) sha256=9286b7a615f2676245283aef0a0a3b475ae3aae2bb5448baace630bb77b91f39
|
|
116
|
+
ffi (1.17.4-arm-linux-gnu) sha256=d6dbddf7cb77bf955411af5f187a65b8cd378cb003c15c05697f5feee1cb1564
|
|
117
|
+
ffi (1.17.4-arm-linux-musl) sha256=9d4838ded0465bef6e2426935f6bcc93134b6616785a84ffd2a3d82bc3cf6f95
|
|
118
|
+
ffi (1.17.4-arm64-darwin) sha256=19071aaf1419251b0a46852abf960e77330a3b334d13a4ab51d58b31a937001b
|
|
119
|
+
ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
|
|
120
|
+
ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
|
|
121
|
+
ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
|
|
122
|
+
io-console (0.9.5) sha256=83dd9bbf4c4680416629245b39cd4212eb5f4d9a4ea91804870c1f6b846414d5
|
|
123
|
+
irb (1.19.0) sha256=55ee56acbdd6c9fe06a2e6909f46a24e5c41f45f16906bab04e8049cf46f1d27
|
|
124
|
+
listen (3.10.1) sha256=4c3f32855657f348747da4dd2372ff3790d90a6b1d3e4f21a3706adb2d04783c
|
|
125
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
126
|
+
pastel (0.8.0) sha256=481da9fb7d2f6e6b1a08faf11fa10363172dc40fd47848f096ae21209f805a75
|
|
127
|
+
pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570
|
|
128
|
+
prettyprint (0.2.1) sha256=d555d57ea6d7cf001d4774b693546a6bd88bec1e778ddffb5c60b68ceec4b7d4
|
|
129
|
+
prism (2.1.0) sha256=1c0a7c6dea0e93183390fb123f007564dbe663198e2f86ad87204151147601f3
|
|
130
|
+
prism (2.1.0-aarch64-linux-gnu) sha256=808dddc72def68e1a0463689414c97e0ba211938eddbab05387a4844aa2b3ec2
|
|
131
|
+
prism (2.1.0-aarch64-linux-musl) sha256=dd1a0732620c1e575dabb07a297a62911fabd72f8e20ce850b522a866f877930
|
|
132
|
+
prism (2.1.0-arm-linux-gnu) sha256=96b2426b9dbab05448c4add735619929042be3cd7e871ff186468121b62bcfa8
|
|
133
|
+
prism (2.1.0-arm-linux-musl) sha256=00ef918e42a3dc98f11a461bf473586a3424b0f78bee8a4e43b5a65a5f5e2cd0
|
|
134
|
+
prism (2.1.0-arm64-darwin) sha256=2d0c2e3e011cfd89c041940907d3ff3def379d7b0f2ba158d1d42238e8ad8afc
|
|
135
|
+
prism (2.1.0-x86_64-darwin) sha256=6c645d8e6afc742956c7518220ce5106367727c4d9980ac9ab386d55004ddab4
|
|
136
|
+
prism (2.1.0-x86_64-linux-gnu) sha256=b2b647afce09551e650b8bb3e2fc91d7d73d392a09534ca307ec0d619c33bfd4
|
|
137
|
+
prism (2.1.0-x86_64-linux-musl) sha256=249f45981726923e259b927902246219fa25ad10a76f43849c9aee1a3d3ec5b8
|
|
138
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
139
|
+
rb-fsevent (0.11.2) sha256=43900b972e7301d6570f64b850a5aa67833ee7d87b458ee92805d56b7318aefe
|
|
140
|
+
rb-inotify (0.11.1) sha256=a0a700441239b0ff18eb65e3866236cd78613d6b9f78fea1f9ac47a85e47be6e
|
|
141
|
+
rbs (4.2.0) sha256=51f7b886dcc05bc09e10b901daa6a81829f6adc03101d6ca9ea4aac6103e0674
|
|
142
|
+
rdoc (8.1.0) sha256=befc37880a5cfd36dcb176c748b5fd5ee39dd3536a75e81824e4972ce230f60a
|
|
143
|
+
reline (0.7.0) sha256=5b012d8e55dbf9d450f12bde2cf7d15ff546ae80b3f8f3b30e570d431815583d
|
|
144
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
145
|
+
rspec-core (3.13.7) sha256=c64ff16d9788119805cbc6a3f4b6d87cc22417c2d25976a3330de136896b5469
|
|
146
|
+
rspec-expectations (3.13.6) sha256=bf538ca6d367ff5b0d85a87fdb5c0c6038f2cd1308a0eeba07476caa02d22f35
|
|
147
|
+
rspec-mocks (3.13.9) sha256=ea5c7ff3054a6098ca6039aacef80aec69d5a8a3ef80be8fc88337359b672a30
|
|
148
|
+
rspec-support (3.13.8) sha256=e4160030309b7e3e9d9863dfe720a35dfcc577162f5402cd68fc8c5258a0ffd6
|
|
149
|
+
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
150
|
+
tty-color (0.6.0) sha256=6f9c37ca3a4e2367fb2e6d09722762647d6f455c111f05b59f35730eeb24332a
|
|
151
|
+
tty-cursor (0.7.1) sha256=79534185e6a777888d88628b14b6a1fdf5154a603f285f80b1753e1908e0bf48
|
|
152
|
+
tty-font (0.5.0) sha256=495ee588701be4abaf03da8b14382794003cb2d836127b02c78cda18aaf451e2
|
|
153
|
+
tty-prompt (0.23.1) sha256=fcdbce905238993f27eecfdf67597a636bc839d92192f6a0eef22b8166449ec8
|
|
154
|
+
tty-reader (0.9.0) sha256=c62972c985c0b1566f0e56743b6a7882f979d3dc32ff491ed490a076f899c2b1
|
|
155
|
+
tty-screen (0.8.2) sha256=c090652115beae764336c28802d633f204fb84da93c6a968aa5d8e319e819b50
|
|
156
|
+
wisper (2.0.1) sha256=ce17bc5c3a166f241a2e6613848b025c8146fce2defba505920c1d1f3f88fae6
|
|
157
|
+
|
|
158
|
+
BUNDLED WITH
|
|
159
|
+
4.0.22
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Scot Reichman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# [f_dot(rubygems)](https://rubygems.org/gems/f_dot)
|
|
2
|
+
# [f_dot(github)](https://github.com/f-oss-om-foundation/f_dot)
|
|
3
|
+
|
|
4
|
+
##### __current version:__
|
|
5
|
+
[](https://badge.fury.io/rb/f_dot)
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{"tldr": "f_dot is checksum tool only a computer could love."}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
# f.oss_om_foundation
|
|
13
|
+
|
|
14
|
+
module FDot::Based
|
|
15
|
+
class Program
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
```
|
data/Rakefile
ADDED
data/bin/f_dot
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e4610c2e043c566683368156e30167e3bd26bc4eccbe7f6c5170cedf7b2f4a9d73b28875950cd8932142297e112b5c067f65260fd5c2f819765ee0b438f6a6e1
|
data/craft_setup.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# craft_setup.sh
|
|
2
|
+
# helper for loading plugins.
|
|
3
|
+
# by i2097i
|
|
4
|
+
|
|
5
|
+
rake
|
|
6
|
+
gem install ../aro/pkg/aro-0.2.8.gem
|
|
7
|
+
mkdir ../craft/plugins
|
|
8
|
+
cp ../f_dot/oss_om_plugin.rb ../craft/plugins/f_dot_plugin.rb
|
|
9
|
+
cp ../aromancer/oss_om_plugin.rb ../craft/plugins/aromancer_plugin.rb
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# deserialization_testing.rb
|
|
5
|
+
#
|
|
6
|
+
# f_dot deserialization_testing.
|
|
7
|
+
#
|
|
8
|
+
# right now this is a simple example of utilizing the
|
|
9
|
+
# FDot::Based::Processor.instance.write_state_callback
|
|
10
|
+
#
|
|
11
|
+
# within an oss_om plugin.
|
|
12
|
+
#
|
|
13
|
+
# by i2097i
|
|
14
|
+
|
|
15
|
+
require "f_dot"
|
|
16
|
+
|
|
17
|
+
load_from_file_name = "f_dot_local_storage.json"
|
|
18
|
+
|
|
19
|
+
serialized_data = {}
|
|
20
|
+
|
|
21
|
+
# load from existing data
|
|
22
|
+
if File.exist?(load_from_file_name)
|
|
23
|
+
serialized_data = JSON.parse File.read(load_from_file_name)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
FDot::Based::Processor.instance.write_state_callback = Proc.new{|incoming_data|
|
|
27
|
+
puts "received #{incoming_data.to_s.length} ascii on callback stream"
|
|
28
|
+
serialized_data = incoming_data.dup
|
|
29
|
+
File.open(load_from_file_name, "w+") do |file|
|
|
30
|
+
file.write(serialized_data.to_json)
|
|
31
|
+
end
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if File.exist?(load_from_file_name)
|
|
35
|
+
FDot::Based::Processor.initialize_with_data(serialized_data)
|
|
36
|
+
else
|
|
37
|
+
# create the file
|
|
38
|
+
File.open(load_from_file_name, "w+") do |file|
|
|
39
|
+
file.write(serialized_data.to_json)
|
|
40
|
+
end
|
|
41
|
+
FDot::Based::Processor.instance.run
|
|
42
|
+
end
|
|
43
|
+
|
data/f_dot.gemspec
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
f_dot.gemspec
|
|
6
|
+
|
|
7
|
+
f_dot gem specification.
|
|
8
|
+
|
|
9
|
+
by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
GEM_DESCRIPTION = "f_dot is checksum tool only a computer could love."
|
|
14
|
+
|
|
15
|
+
require_relative "lib/f_dot/version"
|
|
16
|
+
|
|
17
|
+
Gem::Specification.new do |spec|
|
|
18
|
+
spec.name = "f_dot"
|
|
19
|
+
spec.version = FDot::VERSION
|
|
20
|
+
spec.authors = ["i2097i"]
|
|
21
|
+
spec.email = ["i2097i@hotmail.com"]
|
|
22
|
+
|
|
23
|
+
spec.description = GEM_DESCRIPTION + "\n#{FDot::VERSION} release notes: #{FDot::RELEASE_NOTES}"
|
|
24
|
+
spec.summary = GEM_DESCRIPTION
|
|
25
|
+
spec.homepage = "https://github.com/f-oss-om-foundation/f_dot"
|
|
26
|
+
spec.license = "MIT"
|
|
27
|
+
spec.files = `git ls-files`.split("\n").reject{|p| p.match?(/^(spec|.release|.*.gem$)/)}
|
|
28
|
+
spec.bindir = "bin"
|
|
29
|
+
spec.executables = ["f_dot"]
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
spec.required_ruby_version = ">= 3.1"
|
|
32
|
+
|
|
33
|
+
# development gems
|
|
34
|
+
spec.add_development_dependency "bundler", "~> 4.0", ">= 4.0.22"
|
|
35
|
+
spec.add_development_dependency "listen", "~> 3.10", ">= 3.10.1"
|
|
36
|
+
spec.add_development_dependency "rake", "~> 13.4", ">= 13.4.2"
|
|
37
|
+
spec.add_development_dependency "rspec", "~> 3.13", ">= 3.13.2"
|
|
38
|
+
|
|
39
|
+
# runtime gems
|
|
40
|
+
spec.add_runtime_dependency "tty-prompt", "~> 0.23", ">= 0.23.1"
|
|
41
|
+
spec.add_runtime_dependency "tty-font", "~> 0.5", ">= 0.5.0"
|
|
42
|
+
|
|
43
|
+
end
|
data/lib/f_dot/.DS_Store
ADDED
|
Binary file
|
data/lib/f_dot/based.rb
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
based.rb
|
|
6
|
+
|
|
7
|
+
f_dot based.
|
|
8
|
+
|
|
9
|
+
created by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FDot
|
|
14
|
+
module Based
|
|
15
|
+
PROMPT = TTY::Prompt.new
|
|
16
|
+
FOLDER_NAME = ".f_dot"
|
|
17
|
+
|
|
18
|
+
TYPES = [
|
|
19
|
+
:dot_nulls,
|
|
20
|
+
:dot_bools,
|
|
21
|
+
:dot_ints,
|
|
22
|
+
:dot_floats,
|
|
23
|
+
:dot_strings,
|
|
24
|
+
:dot_arrays,
|
|
25
|
+
:dot_objects
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
NUMBERS = [
|
|
29
|
+
:zero,
|
|
30
|
+
:one,
|
|
31
|
+
:two,
|
|
32
|
+
:three,
|
|
33
|
+
:four,
|
|
34
|
+
:five,
|
|
35
|
+
:six,
|
|
36
|
+
:seven,
|
|
37
|
+
:eight,
|
|
38
|
+
:nine,
|
|
39
|
+
:ten
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
def self.print_large_title!
|
|
43
|
+
puts TTY::Font.new(:standard).write(
|
|
44
|
+
:f_dot.to_s,
|
|
45
|
+
letter_spacing: 1
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def self.generate_uuid
|
|
51
|
+
SecureRandom.send(:uuid_v7)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def self.f_dot_space_path
|
|
55
|
+
path = File.join(ENV["HOME"], FDot::Based::FOLDER_NAME)
|
|
56
|
+
unless Dir.exist?(path)
|
|
57
|
+
FileUtils.mkdir_p(path)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
return path
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.less(message)
|
|
64
|
+
IO.popen("less -X", "w") { |f| f.puts(message) }
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def self.tty_prompt_select(
|
|
68
|
+
display_text = "select something: ",
|
|
69
|
+
options = []
|
|
70
|
+
)
|
|
71
|
+
if options.nil? || options.empty?
|
|
72
|
+
puts "there is nothing here"
|
|
73
|
+
return
|
|
74
|
+
end
|
|
75
|
+
FDot::Based::PROMPT.select(
|
|
76
|
+
display_text,
|
|
77
|
+
options,
|
|
78
|
+
show_help: :always,
|
|
79
|
+
cycle: true,
|
|
80
|
+
per_page: 11
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
=begin
|
|
4
|
+
|
|
5
|
+
history.rb
|
|
6
|
+
|
|
7
|
+
f_dot history.
|
|
8
|
+
|
|
9
|
+
created by i2097i
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
module FDot
|
|
14
|
+
module Based
|
|
15
|
+
class History
|
|
16
|
+
attr_accessor :timestamp
|
|
17
|
+
attr_accessor :from_domain
|
|
18
|
+
attr_accessor :to_domain
|
|
19
|
+
attr_accessor :variable_uuid
|
|
20
|
+
attr_accessor :instruction_uuid
|
|
21
|
+
|
|
22
|
+
def self.create_instruction_history!(instruction, to_domain)
|
|
23
|
+
new_history = self.new(instruction, to_domain)
|
|
24
|
+
|
|
25
|
+
# update the instruction's domain
|
|
26
|
+
instruction.domain = new_history.to_domain
|
|
27
|
+
|
|
28
|
+
# return new_history
|
|
29
|
+
new_history
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.create_variable_history!(variable, to_domain)
|
|
33
|
+
if variable.domain == to_domain &&
|
|
34
|
+
variable.uuid != FDot.state[:based_uuid]
|
|
35
|
+
|
|
36
|
+
puts variable.to_s
|
|
37
|
+
puts "variable.domain == to_domain #{variable.domain == to_domain}"
|
|
38
|
+
puts "FDot.state[:based_uuid]: #{FDot.state[:based_uuid]}"
|
|
39
|
+
|
|
40
|
+
raise "invalid variable! only the based_variable can move that way."
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
new_history = self.new(variable, to_domain)
|
|
44
|
+
|
|
45
|
+
# update the variable's domain
|
|
46
|
+
variable.domain = new_history.to_domain
|
|
47
|
+
|
|
48
|
+
# return new_history
|
|
49
|
+
new_history
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def initialize(historical, to_domain)
|
|
53
|
+
self.timestamp = Time.now.to_i
|
|
54
|
+
self.to_domain = to_domain
|
|
55
|
+
self.from_domain = historical.domain
|
|
56
|
+
if historical.kind_of?(FDot::Based::Instruction)
|
|
57
|
+
self.instruction_uuid = historical.uuid
|
|
58
|
+
elsif historical.kind_of?(FDot::Based::Variable)
|
|
59
|
+
self.variable_uuid = historical.uuid
|
|
60
|
+
else
|
|
61
|
+
raise "invalid historical!"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def get_instruction
|
|
66
|
+
return nil if self.instruction_uuid.nil?
|
|
67
|
+
FDot.state[:program].instructions[self.instruction_uuid]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def get_variable
|
|
71
|
+
return nil if self.variable_uuid.nil?
|
|
72
|
+
FDot.state[:program].variables[self.variable_uuid]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def show_interface!
|
|
76
|
+
interface_open = true
|
|
77
|
+
@historical_instance = nil
|
|
78
|
+
puts "opening history #(#{self.timestamp})"
|
|
79
|
+
puts self.to_s
|
|
80
|
+
while interface_open
|
|
81
|
+
historical_attribute = FDot::Based.tty_prompt_select(
|
|
82
|
+
"viewing historical_instance #{historical_instance.to_s}",
|
|
83
|
+
[{name: :back, value: :back}] + historical_instance.history_menu_options
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return if historical_attribute == :back
|
|
87
|
+
|
|
88
|
+
puts historical_instance.send(historical_attribute)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def historical_instance
|
|
93
|
+
@historical_instance ||= self.get_variable || self.get_instruction
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def to_s
|
|
97
|
+
instance_object = get_variable || get_instruction
|
|
98
|
+
[
|
|
99
|
+
"[#{self.timestamp}]: '#{instance_object&.to_s}' moved",
|
|
100
|
+
"from <#{FDot::Based::Variable.domain_key_for(self.from_domain)}>",
|
|
101
|
+
"to <#{instance_object&.domain_key}>",
|
|
102
|
+
].join(" ")
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def compute_serialized_state!
|
|
106
|
+
serialized_state = {
|
|
107
|
+
name: self.to_s
|
|
108
|
+
}
|
|
109
|
+
FDot::Based::History.serialization_keys.each{|k|
|
|
110
|
+
serialized_state[k] = self.send(k)
|
|
111
|
+
}
|
|
112
|
+
serialized_state
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def self.deserialize_into!(program, serialized_history)
|
|
116
|
+
raise "invalid serialized_history! #{serialized_history}" unless serialization_keys.all?{|k|
|
|
117
|
+
serialized_history.keys.include?(k.to_s)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
raise "missing instruction or variable uuid! #{serialized_history}" if [
|
|
121
|
+
:instruction_uuid, :variable_uuid
|
|
122
|
+
].all?{|k| serialized_history[k.to_s].nil?}
|
|
123
|
+
|
|
124
|
+
history_instance = nil
|
|
125
|
+
unless serialized_history["variable_uuid"].nil?
|
|
126
|
+
history_variable = program.variables[
|
|
127
|
+
serialized_history["variable_uuid"]
|
|
128
|
+
]
|
|
129
|
+
history_instance = self.new(history_variable, serialized_history["to_domain"])
|
|
130
|
+
else
|
|
131
|
+
history_instruction = program.instructions[
|
|
132
|
+
serialized_history["instruction_uuid"]
|
|
133
|
+
]
|
|
134
|
+
history_instance = self.new(history_instruction, serialized_history["to_domain"])
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
program.history[history_instance.historical_instance.uuid] ||= []
|
|
138
|
+
program.history[history_instance.historical_instance.uuid] << history_instance
|
|
139
|
+
|
|
140
|
+
history_instance
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
private
|
|
144
|
+
|
|
145
|
+
def self.serialization_keys
|
|
146
|
+
[
|
|
147
|
+
:timestamp,
|
|
148
|
+
:from_domain,
|
|
149
|
+
:to_domain,
|
|
150
|
+
:variable_uuid,
|
|
151
|
+
:instruction_uuid,
|
|
152
|
+
]
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|