abstract-synthesizer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 71350d70592db32fb7878a7d2d4b720743261eaf72beaed5142954a9b3e1c9f6
4
+ data.tar.gz: ae5bff5c7ad253bf74b1917e2f87f05af12fcc9ab6635ff96cea7a26543edd34
5
+ SHA512:
6
+ metadata.gz: 0dcb1c2a983ab96f2266b6774597cbfa4599edc3ecd8ada6d468e47c836bea805a038d5e784977d71a8d4d59a6a597b5ba64308cbe695fe88cf71669f0258da4
7
+ data.tar.gz: a16cd3d684a89a5387d6c97bc352c7f0f2de96306b1a023fa268f1568ac491d606d46462ea6fb5dba253ebebcf34ebbf74b05148bafd9a6cfa20d5d791c99b72
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ # ignore nix build result
2
+ result
3
+
4
+ # ignore bundle --path vendor/bundle
5
+ vendor
6
+
7
+ # ignore bundle cache
8
+ .bundle
9
+
10
+ # ignore built gems
11
+ pkg
12
+
13
+ # remove .envrc
14
+ .envrc
data/.rubocop.yml ADDED
@@ -0,0 +1,54 @@
1
+ AllCops:
2
+ TargetRubyVersion: '3.0'
3
+ NewCops: enable
4
+
5
+ Gemspec/RequiredRubyVersion:
6
+ Enabled: false
7
+
8
+ Style/FrozenStringLiteralComment:
9
+ Enabled: false
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Style/GlobalVars:
15
+ Enabled: false
16
+
17
+ Style/GuardClause:
18
+ Enabled: false
19
+
20
+ Style/StringConcatenation:
21
+ Enabled: false
22
+
23
+ Metrics/MethodLength:
24
+ Enabled: false
25
+
26
+ Metrics/ModuleLength:
27
+ Enabled: false
28
+
29
+ Metrics/AbcSize:
30
+ Enabled: false
31
+
32
+ Metrics/PerceivedComplexity:
33
+ Enabled: false
34
+
35
+ Metrics/ParameterLists:
36
+ Enabled: false
37
+
38
+ Style/MissingRespondToMissing:
39
+ Enabled: false
40
+
41
+ Lint/MissingSuper:
42
+ Enabled: false
43
+
44
+ Metrics/CyclomaticComplexity:
45
+ Enabled: false
46
+
47
+ Metrics/ClassLength:
48
+ Enabled: false
49
+
50
+ Metrics/BlockLength:
51
+ Enabled: false
52
+
53
+ Naming/AccessorMethodName:
54
+ Enabled: false
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ stitches-synthesizer
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.0
data/.solargraph.yml ADDED
@@ -0,0 +1,12 @@
1
+ include:
2
+ - "**/*.rb"
3
+ exclude:
4
+ - spec/**/*
5
+ - test/**/*
6
+ - vendor/**/*
7
+ - ".bundle/**/*"
8
+ require: []
9
+ domains: []
10
+ reporters:
11
+ - rubocop
12
+ max_files: 5000
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source %(https://rubygems.org)
2
+
3
+ group :development do
4
+ %w[
5
+ solargraph
6
+ keycutter
7
+ rubocop
8
+ rspec
9
+ rake
10
+ yard
11
+ ].each do |this_gem|
12
+ gem this_gem
13
+ end
14
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,90 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ ast (2.4.2)
5
+ backport (1.2.0)
6
+ benchmark (0.2.1)
7
+ diff-lcs (1.5.0)
8
+ e2mmap (0.1.0)
9
+ jaro_winkler (1.5.4)
10
+ json (2.6.3)
11
+ keycutter (1.0.2)
12
+ kramdown (2.4.0)
13
+ rexml
14
+ kramdown-parser-gfm (1.1.0)
15
+ kramdown (~> 2.0)
16
+ mini_portile2 (2.8.1)
17
+ nokogiri (1.14.2)
18
+ mini_portile2 (~> 2.8.0)
19
+ racc (~> 1.4)
20
+ parallel (1.22.1)
21
+ parser (3.2.1.0)
22
+ ast (~> 2.4.1)
23
+ racc (1.6.2)
24
+ rainbow (3.1.1)
25
+ rake (13.0.6)
26
+ regexp_parser (2.7.0)
27
+ reverse_markdown (2.1.1)
28
+ nokogiri
29
+ rexml (3.2.5)
30
+ rspec (3.12.0)
31
+ rspec-core (~> 3.12.0)
32
+ rspec-expectations (~> 3.12.0)
33
+ rspec-mocks (~> 3.12.0)
34
+ rspec-core (3.12.1)
35
+ rspec-support (~> 3.12.0)
36
+ rspec-expectations (3.12.2)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.12.0)
39
+ rspec-mocks (3.12.3)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.12.0)
42
+ rspec-support (3.12.0)
43
+ rubocop (1.46.0)
44
+ json (~> 2.3)
45
+ parallel (~> 1.10)
46
+ parser (>= 3.2.0.0)
47
+ rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 1.8, < 3.0)
49
+ rexml (>= 3.2.5, < 4.0)
50
+ rubocop-ast (>= 1.26.0, < 2.0)
51
+ ruby-progressbar (~> 1.7)
52
+ unicode-display_width (>= 2.4.0, < 3.0)
53
+ rubocop-ast (1.26.0)
54
+ parser (>= 3.2.1.0)
55
+ ruby-progressbar (1.11.0)
56
+ solargraph (0.48.0)
57
+ backport (~> 1.2)
58
+ benchmark
59
+ bundler (>= 1.17.2)
60
+ diff-lcs (~> 1.4)
61
+ e2mmap
62
+ jaro_winkler (~> 1.5)
63
+ kramdown (~> 2.3)
64
+ kramdown-parser-gfm (~> 1.1)
65
+ parser (~> 3.0)
66
+ reverse_markdown (>= 1.0.5, < 3)
67
+ rubocop (>= 0.52)
68
+ thor (~> 1.0)
69
+ tilt (~> 2.0)
70
+ yard (~> 0.9, >= 0.9.24)
71
+ thor (1.2.1)
72
+ tilt (2.1.0)
73
+ unicode-display_width (2.4.2)
74
+ webrick (1.7.0)
75
+ yard (0.9.28)
76
+ webrick (~> 1.7.0)
77
+
78
+ PLATFORMS
79
+ ruby
80
+
81
+ DEPENDENCIES
82
+ keycutter
83
+ rake
84
+ rspec
85
+ rubocop
86
+ solargraph
87
+ yard
88
+
89
+ BUNDLED WITH
90
+ 2.1.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Luis
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1 @@
1
+ # abstract-synthesizer
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require %(bundler/gem_tasks)
4
+ require %(rubocop/rake_task)
5
+ require %(rspec/core/rake_task)
6
+ require %(erb)
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+ RuboCop::RakeTask.new(:rubocop) do |t|
10
+ t.options = [%(--display-cop-names)]
11
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path(%(lib), __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require_relative %(./lib/abstract-synthesizer/version)
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = %(abstract-synthesizer)
9
+ spec.version = AbstractSynthesizer::VERSION
10
+ spec.authors = [%(drzlnthslnt@gmail.com)]
11
+ spec.email = [%(drzlnthslnt@gmail.com)]
12
+ spec.description = %(create resource based configuration DSL)
13
+ spec.summary = %(create resource based configuration DSL)
14
+ spec.homepage = %(https://github.com/drzln/#{spec.name})
15
+ spec.license = %(MIT)
16
+ spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
17
+ spec.require_paths = [%(lib)]
18
+ spec.required_ruby_version = %(>= #{`cat .ruby-version`})
19
+
20
+ %i[
21
+ rubocop-rspec
22
+ rubocop-rake
23
+ solargraph
24
+ keycutter
25
+ rubocop
26
+ rspec
27
+ rake
28
+ yard
29
+ ].each do |gem|
30
+ spec.add_development_dependency(gem)
31
+ end
32
+
33
+ spec.metadata[%(rubygems_mfa_required)] = %(true)
34
+ end
data/flake.lock ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "nodes": {
3
+ "flake-utils": {
4
+ "locked": {
5
+ "lastModified": 1676283394,
6
+ "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
7
+ "owner": "numtide",
8
+ "repo": "flake-utils",
9
+ "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
10
+ "type": "github"
11
+ },
12
+ "original": {
13
+ "owner": "numtide",
14
+ "repo": "flake-utils",
15
+ "type": "github"
16
+ }
17
+ },
18
+ "nixpkgs": {
19
+ "locked": {
20
+ "lastModified": 1677188778,
21
+ "narHash": "sha256-JINcCTZcl3PfxYkNOv7dnI5W5wHASkc0tFt4WElhim4=",
22
+ "owner": "NixOS",
23
+ "repo": "nixpkgs",
24
+ "rev": "88c69a2fee315b62d6ba0cd24c5f645ea12d38b4",
25
+ "type": "github"
26
+ },
27
+ "original": {
28
+ "owner": "NixOS",
29
+ "repo": "nixpkgs",
30
+ "type": "github"
31
+ }
32
+ },
33
+ "root": {
34
+ "inputs": {
35
+ "nixpkgs": "nixpkgs",
36
+ "ruby-flake-utils": "ruby-flake-utils"
37
+ }
38
+ },
39
+ "ruby-flake-utils": {
40
+ "inputs": {
41
+ "flake-utils": "flake-utils"
42
+ },
43
+ "locked": {
44
+ "lastModified": 1677188621,
45
+ "narHash": "sha256-OCB2T8Gb7aFrEdr9UOm/aTvowXBaXWLB8X4pNJRLqTY=",
46
+ "owner": "t3rro",
47
+ "repo": "ruby-flake-utils",
48
+ "rev": "2e0a434139b25042a64e2bd0e67207671797be2b",
49
+ "type": "github"
50
+ },
51
+ "original": {
52
+ "owner": "t3rro",
53
+ "repo": "ruby-flake-utils",
54
+ "type": "github"
55
+ }
56
+ }
57
+ },
58
+ "root": "root",
59
+ "version": 7
60
+ }
data/flake.nix ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ description = "stitches-synthesizer";
3
+
4
+ inputs.nixpkgs.url = github:NixOS/nixpkgs;
5
+ inputs.ruby-flake-utils.url = github:t3rro/ruby-flake-utils;
6
+
7
+ outputs = { ruby-flake-utils, nixpkgs, ... }:
8
+ ruby-flake-utils.lib.mkGemSystems {
9
+ inherit nixpkgs;
10
+ name = "abstract-synthesizer";
11
+ lockfile = ./Gemfile.lock;
12
+ gemfile = ./Gemfile;
13
+ gemset = ./gemset.nix;
14
+ strategy = "lib";
15
+ src = ./.;
16
+ };
17
+ }
data/gemset.nix ADDED
@@ -0,0 +1,355 @@
1
+ {
2
+ ast = {
3
+ groups = ["default" "development"];
4
+ platforms = [];
5
+ source = {
6
+ remotes = ["https://rubygems.org"];
7
+ sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
8
+ type = "gem";
9
+ };
10
+ version = "2.4.2";
11
+ };
12
+ backport = {
13
+ groups = ["default" "development"];
14
+ platforms = [];
15
+ source = {
16
+ remotes = ["https://rubygems.org"];
17
+ sha256 = "0xbzzjrgah0f8ifgd449kak2vyf30micpz6x2g82aipfv7ypsb4i";
18
+ type = "gem";
19
+ };
20
+ version = "1.2.0";
21
+ };
22
+ benchmark = {
23
+ groups = ["default" "development"];
24
+ platforms = [];
25
+ source = {
26
+ remotes = ["https://rubygems.org"];
27
+ sha256 = "017jh2lx3z5hqjvnqclc5bfr5q0d3zk0nqjfz73909ybr4h20kmi";
28
+ type = "gem";
29
+ };
30
+ version = "0.2.1";
31
+ };
32
+ diff-lcs = {
33
+ groups = ["default" "development"];
34
+ platforms = [];
35
+ source = {
36
+ remotes = ["https://rubygems.org"];
37
+ sha256 = "0rwvjahnp7cpmracd8x732rjgnilqv2sx7d1gfrysslc3h039fa9";
38
+ type = "gem";
39
+ };
40
+ version = "1.5.0";
41
+ };
42
+ e2mmap = {
43
+ groups = ["default" "development"];
44
+ platforms = [];
45
+ source = {
46
+ remotes = ["https://rubygems.org"];
47
+ sha256 = "0n8gxjb63dck3vrmsdcqqll7xs7f3wk78mw8w0gdk9wp5nx6pvj5";
48
+ type = "gem";
49
+ };
50
+ version = "0.1.0";
51
+ };
52
+ jaro_winkler = {
53
+ groups = ["default" "development"];
54
+ platforms = [];
55
+ source = {
56
+ remotes = ["https://rubygems.org"];
57
+ sha256 = "1y8l6k34svmdyqxya3iahpwbpvmn3fswhwsvrz0nk1wyb8yfihsh";
58
+ type = "gem";
59
+ };
60
+ version = "1.5.4";
61
+ };
62
+ json = {
63
+ groups = ["default" "development"];
64
+ platforms = [];
65
+ source = {
66
+ remotes = ["https://rubygems.org"];
67
+ sha256 = "0nalhin1gda4v8ybk6lq8f407cgfrj6qzn234yra4ipkmlbfmal6";
68
+ type = "gem";
69
+ };
70
+ version = "2.6.3";
71
+ };
72
+ keycutter = {
73
+ groups = ["development"];
74
+ platforms = [];
75
+ source = {
76
+ remotes = ["https://rubygems.org"];
77
+ sha256 = "09v950ip9wn5l17dcd7jdyz43aj2hmy8q3rj31q430mz0q02z98n";
78
+ type = "gem";
79
+ };
80
+ version = "1.0.2";
81
+ };
82
+ kramdown = {
83
+ dependencies = ["rexml"];
84
+ groups = ["default" "development"];
85
+ platforms = [];
86
+ source = {
87
+ remotes = ["https://rubygems.org"];
88
+ sha256 = "1ic14hdcqxn821dvzki99zhmcy130yhv5fqfffkcf87asv5mnbmn";
89
+ type = "gem";
90
+ };
91
+ version = "2.4.0";
92
+ };
93
+ kramdown-parser-gfm = {
94
+ dependencies = ["kramdown"];
95
+ groups = ["default" "development"];
96
+ platforms = [];
97
+ source = {
98
+ remotes = ["https://rubygems.org"];
99
+ sha256 = "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv";
100
+ type = "gem";
101
+ };
102
+ version = "1.1.0";
103
+ };
104
+ mini_portile2 = {
105
+ groups = ["default" "development"];
106
+ platforms = [];
107
+ source = {
108
+ remotes = ["https://rubygems.org"];
109
+ sha256 = "1af4yarhbbx62f7qsmgg5fynrik0s36wjy3difkawy536xg343mp";
110
+ type = "gem";
111
+ };
112
+ version = "2.8.1";
113
+ };
114
+ nokogiri = {
115
+ dependencies = ["mini_portile2" "racc"];
116
+ groups = ["default" "development"];
117
+ platforms = [];
118
+ source = {
119
+ remotes = ["https://rubygems.org"];
120
+ sha256 = "1djq4rp4m967mn6sxmiw75vz24gfp0w602xv22kk1x3cmi5afrf7";
121
+ type = "gem";
122
+ };
123
+ version = "1.14.2";
124
+ };
125
+ parallel = {
126
+ groups = ["default" "development"];
127
+ platforms = [];
128
+ source = {
129
+ remotes = ["https://rubygems.org"];
130
+ sha256 = "07vnk6bb54k4yc06xnwck7php50l09vvlw1ga8wdz0pia461zpzb";
131
+ type = "gem";
132
+ };
133
+ version = "1.22.1";
134
+ };
135
+ parser = {
136
+ dependencies = ["ast"];
137
+ groups = ["default" "development"];
138
+ platforms = [];
139
+ source = {
140
+ remotes = ["https://rubygems.org"];
141
+ sha256 = "0cdjcasyg7w05kk82dqysq29f1qcf8y5sw8iak5flpxjbdil50qv";
142
+ type = "gem";
143
+ };
144
+ version = "3.2.1.0";
145
+ };
146
+ racc = {
147
+ groups = ["default" "development"];
148
+ platforms = [];
149
+ source = {
150
+ remotes = ["https://rubygems.org"];
151
+ sha256 = "09jgz6r0f7v84a7jz9an85q8vvmp743dqcsdm3z9c8rqcqv6pljq";
152
+ type = "gem";
153
+ };
154
+ version = "1.6.2";
155
+ };
156
+ rainbow = {
157
+ groups = ["default" "development"];
158
+ platforms = [];
159
+ source = {
160
+ remotes = ["https://rubygems.org"];
161
+ sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503";
162
+ type = "gem";
163
+ };
164
+ version = "3.1.1";
165
+ };
166
+ rake = {
167
+ groups = ["development"];
168
+ platforms = [];
169
+ source = {
170
+ remotes = ["https://rubygems.org"];
171
+ sha256 = "15whn7p9nrkxangbs9hh75q585yfn66lv0v2mhj6q6dl6x8bzr2w";
172
+ type = "gem";
173
+ };
174
+ version = "13.0.6";
175
+ };
176
+ regexp_parser = {
177
+ groups = ["default" "development"];
178
+ platforms = [];
179
+ source = {
180
+ remotes = ["https://rubygems.org"];
181
+ sha256 = "0d6241adx6drsfzz74nx1ld3394nm6fjpv3ammzr0g659krvgf7q";
182
+ type = "gem";
183
+ };
184
+ version = "2.7.0";
185
+ };
186
+ reverse_markdown = {
187
+ dependencies = ["nokogiri"];
188
+ groups = ["default" "development"];
189
+ platforms = [];
190
+ source = {
191
+ remotes = ["https://rubygems.org"];
192
+ sha256 = "0087vhw5ik50lxvddicns01clkx800fk5v5qnrvi3b42nrk6885j";
193
+ type = "gem";
194
+ };
195
+ version = "2.1.1";
196
+ };
197
+ rexml = {
198
+ groups = ["default" "development"];
199
+ platforms = [];
200
+ source = {
201
+ remotes = ["https://rubygems.org"];
202
+ sha256 = "08ximcyfjy94pm1rhcx04ny1vx2sk0x4y185gzn86yfsbzwkng53";
203
+ type = "gem";
204
+ };
205
+ version = "3.2.5";
206
+ };
207
+ rspec = {
208
+ dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"];
209
+ groups = ["development"];
210
+ platforms = [];
211
+ source = {
212
+ remotes = ["https://rubygems.org"];
213
+ sha256 = "171rc90vcgjl8p1bdrqa92ymrj8a87qf6w20x05xq29mljcigi6c";
214
+ type = "gem";
215
+ };
216
+ version = "3.12.0";
217
+ };
218
+ rspec-core = {
219
+ dependencies = ["rspec-support"];
220
+ groups = ["default" "development"];
221
+ platforms = [];
222
+ source = {
223
+ remotes = ["https://rubygems.org"];
224
+ sha256 = "0da45cvllbv39sdbsl65vp5djb2xf5m10mxc9jm7rsqyyxjw4h1f";
225
+ type = "gem";
226
+ };
227
+ version = "3.12.1";
228
+ };
229
+ rspec-expectations = {
230
+ dependencies = ["diff-lcs" "rspec-support"];
231
+ groups = ["default" "development"];
232
+ platforms = [];
233
+ source = {
234
+ remotes = ["https://rubygems.org"];
235
+ sha256 = "03ba3lfdsj9zl00v1yvwgcx87lbadf87livlfa5kgqssn9qdnll6";
236
+ type = "gem";
237
+ };
238
+ version = "3.12.2";
239
+ };
240
+ rspec-mocks = {
241
+ dependencies = ["diff-lcs" "rspec-support"];
242
+ groups = ["default" "development"];
243
+ platforms = [];
244
+ source = {
245
+ remotes = ["https://rubygems.org"];
246
+ sha256 = "0sq2cc9pm5gq411y7iwfvzbmgv3g91lyf7y7cqn1lr3yf1v122nc";
247
+ type = "gem";
248
+ };
249
+ version = "3.12.3";
250
+ };
251
+ rspec-support = {
252
+ groups = ["default" "development"];
253
+ platforms = [];
254
+ source = {
255
+ remotes = ["https://rubygems.org"];
256
+ sha256 = "12y52zwwb3xr7h91dy9k3ndmyyhr3mjcayk0nnarnrzz8yr48kfx";
257
+ type = "gem";
258
+ };
259
+ version = "3.12.0";
260
+ };
261
+ rubocop = {
262
+ dependencies = ["json" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
263
+ groups = ["development"];
264
+ platforms = [];
265
+ source = {
266
+ remotes = ["https://rubygems.org"];
267
+ sha256 = "162c83q550hvlvdv834mqfkwv5cdsirlymmmmcmw9vlci5nq2imd";
268
+ type = "gem";
269
+ };
270
+ version = "1.46.0";
271
+ };
272
+ rubocop-ast = {
273
+ dependencies = ["parser"];
274
+ groups = ["default" "development"];
275
+ platforms = [];
276
+ source = {
277
+ remotes = ["https://rubygems.org"];
278
+ sha256 = "1zqk8dgjjhm0zll2rxqvvb8fl5vin7mmbc1ndn1a2q4276ri6ydc";
279
+ type = "gem";
280
+ };
281
+ version = "1.26.0";
282
+ };
283
+ ruby-progressbar = {
284
+ groups = ["default" "development"];
285
+ platforms = [];
286
+ source = {
287
+ remotes = ["https://rubygems.org"];
288
+ sha256 = "02nmaw7yx9kl7rbaan5pl8x5nn0y4j5954mzrkzi9i3dhsrps4nc";
289
+ type = "gem";
290
+ };
291
+ version = "1.11.0";
292
+ };
293
+ solargraph = {
294
+ dependencies = ["backport" "benchmark" "diff-lcs" "e2mmap" "jaro_winkler" "kramdown" "kramdown-parser-gfm" "parser" "reverse_markdown" "rubocop" "thor" "tilt" "yard"];
295
+ groups = ["development"];
296
+ platforms = [];
297
+ source = {
298
+ remotes = ["https://rubygems.org"];
299
+ sha256 = "1pdy2f5phffknx98j2f5k72s52ayp456m3jkg08vx396yg59l0gi";
300
+ type = "gem";
301
+ };
302
+ version = "0.48.0";
303
+ };
304
+ thor = {
305
+ groups = ["default" "development"];
306
+ platforms = [];
307
+ source = {
308
+ remotes = ["https://rubygems.org"];
309
+ sha256 = "0inl77jh4ia03jw3iqm5ipr76ghal3hyjrd6r8zqsswwvi9j2xdi";
310
+ type = "gem";
311
+ };
312
+ version = "1.2.1";
313
+ };
314
+ tilt = {
315
+ groups = ["default" "development"];
316
+ platforms = [];
317
+ source = {
318
+ remotes = ["https://rubygems.org"];
319
+ sha256 = "1qmhi6d9przjzhsyk9g5pq2j75c656msh6xzprqd2mxgphf23jxs";
320
+ type = "gem";
321
+ };
322
+ version = "2.1.0";
323
+ };
324
+ unicode-display_width = {
325
+ groups = ["default" "development"];
326
+ platforms = [];
327
+ source = {
328
+ remotes = ["https://rubygems.org"];
329
+ sha256 = "1gi82k102q7bkmfi7ggn9ciypn897ylln1jk9q67kjhr39fj043a";
330
+ type = "gem";
331
+ };
332
+ version = "2.4.2";
333
+ };
334
+ webrick = {
335
+ groups = ["default" "development"];
336
+ platforms = [];
337
+ source = {
338
+ remotes = ["https://rubygems.org"];
339
+ sha256 = "1d4cvgmxhfczxiq5fr534lmizkhigd15bsx5719r5ds7k7ivisc7";
340
+ type = "gem";
341
+ };
342
+ version = "1.7.0";
343
+ };
344
+ yard = {
345
+ dependencies = ["webrick"];
346
+ groups = ["development"];
347
+ platforms = [];
348
+ source = {
349
+ remotes = ["https://rubygems.org"];
350
+ sha256 = "0p1if8g9ww6hlpfkphqv3y1z0rbqnnrvb38c5qhnala0f8qpw6yk";
351
+ type = "gem";
352
+ };
353
+ version = "0.9.28";
354
+ };
355
+ }
@@ -0,0 +1,3 @@
1
+ # Synthesizers need keys to be created however if a synth attempts to process
2
+ # an unrecognized key it should error
3
+ class InvalidSynthesizerKeyError < StandardError; end
@@ -0,0 +1 @@
1
+ class NotEnoughResourceKeys < StandardError; end
@@ -0,0 +1 @@
1
+ class TooManyFieldValuesError < StandardError; end
@@ -0,0 +1,21 @@
1
+ module Bury
2
+ class << self
3
+ def add_bury_to_hash
4
+ Hash.send(:define_method, :bury) do |*args|
5
+ # arg 0 is key arg 1 is val
6
+ if args.count < 2
7
+ raise ArgumentError, %(2 or more arguments required)
8
+ elsif args.count == 2
9
+ self[args[0]] = args[1]
10
+
11
+ # if we have more args bury the arg recursively
12
+ else
13
+ arg = args.shift
14
+ self[arg] = {} unless self[arg]
15
+ self[arg].bury(*args) unless args.empty?
16
+ end
17
+ end
18
+ end
19
+ end
20
+ add_bury_to_hash
21
+ end
@@ -0,0 +1,3 @@
1
+ module AbstractSynthesizer
2
+ VERSION = %(0.0.1)
3
+ end
@@ -0,0 +1,119 @@
1
+ require_relative %(./abstract-synthesizer/errors/invalid_synthesizer_key_error)
2
+ require_relative %(./abstract-synthesizer/errors/too_many_field_values)
3
+ require_relative %(./abstract-synthesizer/errors/not_enough_resource_keys)
4
+ require_relative %(./abstract-synthesizer/primitives/bury)
5
+
6
+ class AbstractSynthesizer
7
+ include Bury
8
+
9
+ attr_reader :translation
10
+
11
+ def initialize(name: nil) # rubocop:disable Lint/UnusedMethodArgument
12
+ @translation = {
13
+ ancestors: [],
14
+ template: {},
15
+ context: nil
16
+ }
17
+ end
18
+
19
+ def synthesis
20
+ translation[:template]
21
+ end
22
+
23
+ def synthesize(content = nil, &block)
24
+ if block_given?
25
+ instance_eval(&block)
26
+ else
27
+ instance_eval(content)
28
+ end
29
+ self
30
+ end
31
+
32
+ private
33
+
34
+ # check if method is part of keys
35
+ # and is otherwise valid to be used
36
+ def valid_method?(method, keys)
37
+ # if context is nil then you are in resource processing space
38
+ if translation[:context].nil?
39
+ # if you are in resource space the method must be in keys
40
+ keys.include?(method)
41
+ else
42
+ # if we have a context we are not checking for resource
43
+ # signature so method should not be checked
44
+ true
45
+ end
46
+ end
47
+
48
+ def validate_method(method, keys)
49
+ err_msg = []
50
+ err_msg << method
51
+ err_msg << %(is invalid for)
52
+ err_msg << self.class
53
+ err_msg << %(and should be one of)
54
+ err_msg << keys.join(%(\n))
55
+ err_msg = err_msg.join(%( ))
56
+
57
+ raise InvalidSynthesizerKeyError, err_msg unless valid_method?(method, keys)
58
+ end
59
+
60
+ def validate_args(args)
61
+ if translation[:ancestors].empty?
62
+ raise NotEnoughResourceKeys unless args.length.eql?(2)
63
+ elsif !args.length.eql?(1)
64
+ raise TooManyFieldValuesError
65
+ end
66
+ end
67
+
68
+ def abstract_method_missing(method, keys, *args)
69
+ keys = keys.map(&:to_sym)
70
+ method = method.to_sym
71
+
72
+ validate_method(method, keys)
73
+ validate_args(args)
74
+
75
+ keys.each do |key|
76
+ if key.eql?(translation[:context])
77
+ translation[:ancestors].append(method)
78
+ yield if block_given?
79
+ if args.length == 1
80
+ translation[:template].bury(*translation[:ancestors], args[0])
81
+ translation[:ancestors].pop
82
+ elsif args.empty?
83
+ translation[:ancestors].pop
84
+ else
85
+ msg = %(field: #{method} requires 1 argument, had #{args.length})
86
+ msg += %( )
87
+ msg += %(which were #{args})
88
+ raise TooManyFieldValuesError, msg
89
+ end
90
+ end
91
+
92
+ next unless [key].include?(method)
93
+
94
+ translation[:ancestors].append(method.to_sym)
95
+ translation[:ancestors].append(*args)
96
+ translation[:context] = method
97
+ yield if block_given?
98
+ translation[:ancestors] = []
99
+ translation[:context] = nil
100
+ end
101
+ end
102
+ end
103
+
104
+ module SynthesizerFactory
105
+ class << self
106
+ def create_synthesizer(name:, keys:)
107
+ synth = AbstractSynthesizer.new(name: name)
108
+ synth.define_singleton_method(:method_missing) do |method_name, *args, &block|
109
+ abstract_method_missing(
110
+ method_name,
111
+ keys,
112
+ *args,
113
+ &block
114
+ )
115
+ end
116
+ synth
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative %(./spec_helper)
4
+ require %(abstract-synthesizer/errors/invalid_synthesizer_key_error)
5
+ require %(abstract-synthesizer/errors/too_many_field_values)
6
+
7
+ describe RandoSynthesizer do
8
+ context %(main) do
9
+ let(:synth) do
10
+ described_class.new
11
+ end
12
+
13
+ it %(should compile small declaration and be hash) do
14
+ synth.synthesize do
15
+ rando :nietztche, :thus_spoke_zarathustra do
16
+ superman(%(came from krypton))
17
+ overman(%(came from austria))
18
+ end
19
+ end
20
+ expect(synth.synthesis).to be_kind_of(Hash)
21
+ end
22
+
23
+ it %(should raise an argument error with more than one arg per field) do
24
+ expect do
25
+ synth.synthesize do
26
+ rando :socrates, :the_republic do
27
+ things(%(may), %(not), %(be), %(what), %(you), %(think))
28
+ end
29
+ end
30
+ end.to raise_error(TooManyFieldValuesError)
31
+ end
32
+
33
+ it %(should have expected keys) do
34
+ synth.synthesize do
35
+ rando :kafka, :metamorphasis do
36
+ change :inevitable
37
+ end
38
+ end
39
+ expect(
40
+ synth.synthesis[:rando][:kafka][:metamorphasis][:change]
41
+ ).to be(:inevitable)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require %(abstract-synthesizer)
4
+
5
+ describe SynthesizerFactory do
6
+ context %(create_synthesizer) do
7
+ it %(should create a resource synthesizer) do
8
+ SynthesizerFactory.create_synthesizer(name: :rando, keys: [:rando]).synthesize do
9
+ rando :nietztche, :thus_spoke_zarathustra do
10
+ superman(%(came from krypton))
11
+ overman(%(came from austria))
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ require %(abstract-synthesizer)
2
+
3
+ class RandoSynthesizer < AbstractSynthesizer
4
+ def method_missing(method_name, *args, &block)
5
+ abstract_method_missing(
6
+ method_name,
7
+ %i[rando],
8
+ *args,
9
+ &block
10
+ )
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,179 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: abstract-synthesizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - drzlnthslnt@gmail.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop-rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop-rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: solargraph
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: keycutter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: yard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: create resource based configuration DSL
126
+ email:
127
+ - drzlnthslnt@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".rubocop.yml"
134
+ - ".ruby-gemset"
135
+ - ".ruby-version"
136
+ - ".solargraph.yml"
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE
140
+ - README.md
141
+ - Rakefile
142
+ - abstract-synthesizer.gemspec
143
+ - flake.lock
144
+ - flake.nix
145
+ - gemset.nix
146
+ - lib/abstract-synthesizer.rb
147
+ - lib/abstract-synthesizer/errors/invalid_synthesizer_key_error.rb
148
+ - lib/abstract-synthesizer/errors/not_enough_resource_keys.rb
149
+ - lib/abstract-synthesizer/errors/too_many_field_values.rb
150
+ - lib/abstract-synthesizer/primitives/bury.rb
151
+ - lib/abstract-synthesizer/version.rb
152
+ - spec/abstract_spec.rb
153
+ - spec/factory_spec.rb
154
+ - spec/spec_helper.rb
155
+ homepage: https://github.com/drzln/abstract-synthesizer
156
+ licenses:
157
+ - MIT
158
+ metadata:
159
+ rubygems_mfa_required: 'true'
160
+ post_install_message:
161
+ rdoc_options: []
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: 3.1.0
169
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ requirements: []
175
+ rubygems_version: 3.3.20
176
+ signing_key:
177
+ specification_version: 4
178
+ summary: create resource based configuration DSL
179
+ test_files: []