sevgi-showcase 0.95.0 → 1.0.0

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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +221 -2
  3. data/README.md +10 -17
  4. data/lib/sevgi/showcase/dark.rb +4 -0
  5. data/lib/sevgi/showcase/minitest/script.rb +59 -57
  6. data/lib/sevgi/showcase/minitest/suite.rb +48 -46
  7. data/lib/sevgi/showcase/minitest.rb +8 -1
  8. data/lib/sevgi/showcase/version.rb +1 -1
  9. data/lib/sevgi/showcase.rb +0 -3
  10. data/srv/arc.sevgi +29 -0
  11. data/srv/arc.svg +32 -0
  12. data/srv/arc.yml +4 -0
  13. data/srv/checkers.sevgi +78 -0
  14. data/srv/checkers.svg +118 -0
  15. data/srv/clover.sevgi +19 -0
  16. data/srv/clover.svg +12 -0
  17. data/srv/clover.yml +3 -0
  18. data/srv/copperplate.sevgi +50 -0
  19. data/srv/copperplate.svg +99 -0
  20. data/srv/copperplate.yml +5 -0
  21. data/srv/gear.sevgi +25 -0
  22. data/srv/gear.svg +12 -0
  23. data/srv/gear.yml +2 -0
  24. data/srv/grid.sevgi +23 -0
  25. data/srv/{grid-cells.svg → grid.svg} +14 -1
  26. data/srv/hatch.sevgi +9 -0
  27. data/srv/hatch.svg +30 -0
  28. data/srv/hatch.yml +4 -0
  29. data/srv/heart.sevgi +17 -0
  30. data/srv/heart.svg +9 -0
  31. data/srv/heart.yml +3 -0
  32. data/srv/logo.sevgi +39 -0
  33. data/srv/logo.svg +30 -0
  34. data/srv/logo.yml +4 -0
  35. data/srv/logos.sevgi +34 -0
  36. data/srv/logos.svg +39 -0
  37. data/srv/logos.yml +4 -0
  38. data/srv/meter.sevgi +20 -0
  39. data/srv/meter.svg +19 -0
  40. data/srv/orb.sevgi +14 -0
  41. data/srv/orb.svg +11 -0
  42. data/srv/orb.yml +4 -0
  43. data/srv/pacman.sevgi +18 -0
  44. data/srv/pacman.svg +16 -0
  45. data/srv/pokey.sevgi +14 -0
  46. data/srv/{pacman-pokey.svg → pokey.svg} +1 -3
  47. data/srv/protractor.sevgi +40 -0
  48. data/srv/protractor.svg +605 -0
  49. data/srv/ruler.sevgi +61 -0
  50. data/srv/ruler.svg +445 -0
  51. data/srv/{snow-flake.sevgi → snowflake.sevgi} +3 -3
  52. data/srv/{snow-flake.svg → snowflake.svg} +3 -2
  53. data/srv/snowflake.yml +2 -0
  54. data/srv/squared.sevgi +42 -0
  55. data/srv/squared.svg +71 -0
  56. data/srv/squared.yml +4 -0
  57. data/srv/stars.sevgi +19 -0
  58. data/srv/stars.svg +31 -0
  59. data/srv/stars.yml +3 -0
  60. data/srv/tulips.sevgi +27 -0
  61. data/srv/tulips.svg +20 -0
  62. data/srv/tulips.yml +3 -0
  63. metadata +66 -37
  64. data/lib/sevgi/showcase/minitest/shell.rb +0 -166
  65. data/srv/checker-board.sevgi +0 -96
  66. data/srv/checker-board.svg +0 -117
  67. data/srv/gear-wheel.sevgi +0 -27
  68. data/srv/gear-wheel.svg +0 -12
  69. data/srv/gear-wheel.yml +0 -3
  70. data/srv/grid-cells.sevgi +0 -24
  71. data/srv/heart-mask.sevgi +0 -17
  72. data/srv/heart-mask.svg +0 -8
  73. data/srv/heart-mask.yml +0 -3
  74. data/srv/meter-face.sevgi +0 -20
  75. data/srv/meter-face.svg +0 -13
  76. data/srv/pacman-pokey.sevgi +0 -17
  77. data/srv/pacman-single.sevgi +0 -17
  78. data/srv/pacman-single.svg +0 -14
  79. data/srv/ruler-hline.sevgi +0 -55
  80. data/srv/ruler-hline.svg +0 -443
  81. data/srv/ruler-line.sevgi +0 -52
  82. data/srv/ruler-line.svg +0 -443
  83. data/srv/snow-flake.yml +0 -1
  84. /data/srv/{checker-board.yml → checkers.yml} +0 -0
  85. /data/srv/{grid-cells.yml → grid.yml} +0 -0
  86. /data/srv/{meter-face.yml → meter.yml} +0 -0
  87. /data/srv/{pacman-pokey.yml → pacman.yml} +0 -0
  88. /data/srv/{pacman-single.yml → pokey.yml} +0 -0
  89. /data/srv/{ruler-hline.yml → protractor.yml} +0 -0
  90. /data/srv/{ruler-line.yml → ruler.yml} +0 -0
data/srv/stars.svg ADDED
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48">
3
+ <rect width="48" height="48" rx="1" fill="white"/>
4
+ <symbol id="star">
5
+ <title>Star</title>
6
+ <path
7
+ d="m 7.06716,10 v -2.930223 h 2.932843 l -2.073449,-2.073131 2.073449,-2.068098
8
+ h -2.932843 v -2.928548 l -2.07848,2.074807 -2.067578,-2.074807 v 2.928547
9
+ h -2.921102 l 2.060869,2.068098 -2.060869,2.073131 h 2.921102 v 2.930223
10
+ l 2.067578,-2.066419 2.07848,2.066419
11
+ "
12
+ fill="purple"
13
+ />
14
+ </symbol>
15
+ <use id="star-1-1" href="#star" class="tile-row-1 tile-row-first tile-col-1 tile-col-first" x="4" y="4"/>
16
+ <use id="star-1-2" href="#star" class="tile-row-1 tile-row-first tile-col-2" x="14" y="4"/>
17
+ <use id="star-1-3" href="#star" class="tile-row-1 tile-row-first tile-col-3" x="24" y="4"/>
18
+ <use id="star-1-4" href="#star" class="tile-row-1 tile-row-first tile-col-4 tile-col-last" x="34" y="4"/>
19
+ <use id="star-2-1" href="#star" class="tile-row-2 tile-col-1 tile-col-first" x="4" y="14"/>
20
+ <use id="star-2-2" href="#star" class="tile-row-2 tile-col-2" x="14" y="14"/>
21
+ <use id="star-2-3" href="#star" class="tile-row-2 tile-col-3" x="24" y="14"/>
22
+ <use id="star-2-4" href="#star" class="tile-row-2 tile-col-4 tile-col-last" x="34" y="14"/>
23
+ <use id="star-3-1" href="#star" class="tile-row-3 tile-col-1 tile-col-first" x="4" y="24"/>
24
+ <use id="star-3-2" href="#star" class="tile-row-3 tile-col-2" x="14" y="24"/>
25
+ <use id="star-3-3" href="#star" class="tile-row-3 tile-col-3" x="24" y="24"/>
26
+ <use id="star-3-4" href="#star" class="tile-row-3 tile-col-4 tile-col-last" x="34" y="24"/>
27
+ <use id="star-4-1" href="#star" class="tile-row-4 tile-row-last tile-col-1 tile-col-first" x="4" y="34"/>
28
+ <use id="star-4-2" href="#star" class="tile-row-4 tile-row-last tile-col-2" x="14" y="34"/>
29
+ <use id="star-4-3" href="#star" class="tile-row-4 tile-row-last tile-col-3" x="24" y="34"/>
30
+ <use id="star-4-4" href="#star" class="tile-row-4 tile-row-last tile-col-4 tile-col-last" x="34" y="34"/>
31
+ </svg>
data/srv/stars.yml ADDED
@@ -0,0 +1,3 @@
1
+ dark:
2
+ purple: "#e5c39c"
3
+ white: "#222222"
data/srv/tulips.sevgi ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env -S ruby -S sevgi
2
+ # frozen_string_literal: true
3
+
4
+ TULIP = <<~PATH
5
+ m 7.072424,8.784891 c -1.62123,1.620145 -4.24191,1.620145 -5.860483,0
6
+ -1.611497,-1.619275 -1.62034,-4.239086 0,-5.854824 l 2.928473,-2.930067
7
+ -0.48823,3.907639 3.42024,-0.977572 -0.98,3.417962 3.90758,-0.488766
8
+ -2.92758,2.925628
9
+ PATH
10
+
11
+ CENTER = 13
12
+ SIDE = 3.5
13
+ ANCHOR = [1.211941, 8.784891].freeze
14
+ CORNER = [CENTER + (SIDE / 2), CENTER - (SIDE / 2)].freeze
15
+ SIZE = 26
16
+
17
+ SVG width: SIZE, height: SIZE do
18
+ rect width: SIZE, height: SIZE, rx: 0.75, fill: "white"
19
+ defs { path id: "Tulip", d: TULIP, fill: "purple" }
20
+
21
+ 4.times do |quarter|
22
+ flower = use href: "#Tulip", x: CORNER[0] - ANCHOR[0], y: CORNER[1] - ANCHOR[1]
23
+ flower.Rotate quarter * 90, CENTER, CENTER
24
+ end
25
+
26
+ square x: CENTER - (SIDE / 2), y: CENTER - (SIDE / 2), length: SIDE, fill: "purple"
27
+ end.Save
data/srv/tulips.svg ADDED
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26">
3
+ <rect width="26" height="26" rx="0.75" fill="white"/>
4
+ <defs>
5
+ <path
6
+ id="Tulip"
7
+ d="m 7.072424,8.784891 c -1.62123,1.620145 -4.24191,1.620145 -5.860483,0
8
+ -1.611497,-1.619275 -1.62034,-4.239086 0,-5.854824 l 2.928473,-2.930067
9
+ -0.48823,3.907639 3.42024,-0.977572 -0.98,3.417962 3.90758,-0.488766
10
+ -2.92758,2.925628
11
+ "
12
+ fill="purple"
13
+ />
14
+ </defs>
15
+ <use href="#Tulip" x="13.538059" y="2.465109"/>
16
+ <use href="#Tulip" x="13.538059" y="2.465109" transform="rotate(90, 13, 13)"/>
17
+ <use href="#Tulip" x="13.538059" y="2.465109" transform="rotate(180, 13, 13)"/>
18
+ <use href="#Tulip" x="13.538059" y="2.465109" transform="rotate(270, 13, 13)"/>
19
+ <rect width="3.5" height="3.5" x="11.25" y="11.25" fill="purple"/>
20
+ </svg>
data/srv/tulips.yml ADDED
@@ -0,0 +1,3 @@
1
+ dark:
2
+ purple: "#e5c39c"
3
+ white: "#222222"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevgi-showcase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.95.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recai Oktaş
@@ -15,15 +15,15 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.95.0
18
+ version: 1.0.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.95.0
26
- description: Provides documents and examples to demonstrate the Sevgi toolkit.
25
+ version: 1.0.0
26
+ description: Packages tested .sevgi examples and documentation site support.
27
27
  email: roktas@gmail.com
28
28
  executables: []
29
29
  extensions: []
@@ -36,40 +36,69 @@ files:
36
36
  - lib/sevgi/showcase/dark.rb
37
37
  - lib/sevgi/showcase/minitest.rb
38
38
  - lib/sevgi/showcase/minitest/script.rb
39
- - lib/sevgi/showcase/minitest/shell.rb
40
39
  - lib/sevgi/showcase/minitest/suite.rb
41
40
  - lib/sevgi/showcase/passive.rb
42
41
  - lib/sevgi/showcase/version.rb
43
- - srv/checker-board.sevgi
44
- - srv/checker-board.svg
45
- - srv/checker-board.yml
46
- - srv/gear-wheel.sevgi
47
- - srv/gear-wheel.svg
48
- - srv/gear-wheel.yml
49
- - srv/grid-cells.sevgi
50
- - srv/grid-cells.svg
51
- - srv/grid-cells.yml
52
- - srv/heart-mask.sevgi
53
- - srv/heart-mask.svg
54
- - srv/heart-mask.yml
55
- - srv/meter-face.sevgi
56
- - srv/meter-face.svg
57
- - srv/meter-face.yml
58
- - srv/pacman-pokey.sevgi
59
- - srv/pacman-pokey.svg
60
- - srv/pacman-pokey.yml
61
- - srv/pacman-single.sevgi
62
- - srv/pacman-single.svg
63
- - srv/pacman-single.yml
64
- - srv/ruler-hline.sevgi
65
- - srv/ruler-hline.svg
66
- - srv/ruler-hline.yml
67
- - srv/ruler-line.sevgi
68
- - srv/ruler-line.svg
69
- - srv/ruler-line.yml
70
- - srv/snow-flake.sevgi
71
- - srv/snow-flake.svg
72
- - srv/snow-flake.yml
42
+ - srv/arc.sevgi
43
+ - srv/arc.svg
44
+ - srv/arc.yml
45
+ - srv/checkers.sevgi
46
+ - srv/checkers.svg
47
+ - srv/checkers.yml
48
+ - srv/clover.sevgi
49
+ - srv/clover.svg
50
+ - srv/clover.yml
51
+ - srv/copperplate.sevgi
52
+ - srv/copperplate.svg
53
+ - srv/copperplate.yml
54
+ - srv/gear.sevgi
55
+ - srv/gear.svg
56
+ - srv/gear.yml
57
+ - srv/grid.sevgi
58
+ - srv/grid.svg
59
+ - srv/grid.yml
60
+ - srv/hatch.sevgi
61
+ - srv/hatch.svg
62
+ - srv/hatch.yml
63
+ - srv/heart.sevgi
64
+ - srv/heart.svg
65
+ - srv/heart.yml
66
+ - srv/logo.sevgi
67
+ - srv/logo.svg
68
+ - srv/logo.yml
69
+ - srv/logos.sevgi
70
+ - srv/logos.svg
71
+ - srv/logos.yml
72
+ - srv/meter.sevgi
73
+ - srv/meter.svg
74
+ - srv/meter.yml
75
+ - srv/orb.sevgi
76
+ - srv/orb.svg
77
+ - srv/orb.yml
78
+ - srv/pacman.sevgi
79
+ - srv/pacman.svg
80
+ - srv/pacman.yml
81
+ - srv/pokey.sevgi
82
+ - srv/pokey.svg
83
+ - srv/pokey.yml
84
+ - srv/protractor.sevgi
85
+ - srv/protractor.svg
86
+ - srv/protractor.yml
87
+ - srv/ruler.sevgi
88
+ - srv/ruler.svg
89
+ - srv/ruler.yml
90
+ - srv/snowflake.sevgi
91
+ - srv/snowflake.svg
92
+ - srv/snowflake.yml
93
+ - srv/squared.sevgi
94
+ - srv/squared.svg
95
+ - srv/squared.yml
96
+ - srv/stars.sevgi
97
+ - srv/stars.svg
98
+ - srv/stars.yml
99
+ - srv/tulips.sevgi
100
+ - srv/tulips.svg
101
+ - srv/tulips.yml
73
102
  homepage: https://sevgi.roktas.dev
74
103
  licenses:
75
104
  - GPL-3.0-or-later
@@ -92,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
121
  - !ruby/object:Gem::Version
93
122
  version: '0'
94
123
  requirements: []
95
- rubygems_version: 4.0.11
124
+ rubygems_version: 4.0.20
96
125
  specification_version: 4
97
- summary: Documents and examples for the Sevgi toolkit.
126
+ summary: Executable examples and user documentation for Sevgi.
98
127
  test_files: []
@@ -1,166 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "open3"
4
- require "sevgi/function"
5
-
6
- module Sevgi
7
- # Minitest helpers used by the showcase component.
8
- # @api private
9
- module Test
10
- # Shell runner helpers for showcase tests.
11
- # @api private
12
- module Shell
13
- # Shared process-global SIGINT state.
14
- # @api private
15
- Signals = ::Sevgi::Function::Shell.const_get(:Signals, false)
16
-
17
- private_constant :Signals
18
-
19
- # Shell command result.
20
- # @api private
21
- Result = Data.define(:args, :out, :err, :exit_code) do
22
- # Returns the command string.
23
- # @return [String]
24
- def cmd = args.join(" ")
25
-
26
- # Reports whether the command failed.
27
- # @return [Boolean]
28
- def notok? = !ok?
29
-
30
- # Reports whether the command exited successfully.
31
- # @return [Boolean]
32
- def ok? = exit_code&.zero?
33
-
34
- # Returns the first stdout line.
35
- # @return [String, nil]
36
- def outline = out.first
37
-
38
- # Returns stdout as a newline-joined string.
39
- # @return [String]
40
- def to_s = out.join("\n")
41
- end
42
-
43
- # Adapted to popen3 from github.com/mina-deploy/mina
44
- # Shell command runner.
45
- # @api private
46
- class Runner
47
- # Creates a runner.
48
- # @return [void]
49
- def initialize
50
- @coathooks = 0
51
- end
52
-
53
- # Runs a command and captures stdout, stderr, and exit status.
54
- # @param args [Array<String>] command and arguments
55
- # @yield optional stdin writer evaluated with stdin as receiver
56
- # @yieldreturn [Object]
57
- # @return [Sevgi::Test::Shell::Result]
58
- # @raise [StandardError] when the input block raises; the child is terminated and reaped before propagation
59
- # @note The first SIGINT sends TERM and the second sends KILL outside trap context. The handler is restored after
60
- # the last active run.
61
- def run(*args, &block)
62
- @coathooks = 0
63
- out, err, status = Open3.popen3(*args) do |stdin, stdout, stderr, thread|
64
- capture(stdin, stdout, stderr, thread, &block)
65
- end
66
-
67
- Result[args, out, err, status.exitstatus]
68
- end
69
-
70
- private
71
-
72
- # rubocop:disable Lint/RescueException
73
- def capture(stdin, stdout, stderr, thread, &block)
74
- register_capture(thread)
75
- registered = true
76
- readers = outputs(stdout, stderr)
77
-
78
- collect_capture(stdin, thread, readers, &block)
79
- rescue Exception
80
- cleanup_failed_capture(stdin, thread, readers)
81
- raise
82
- ensure
83
- finish_capture(stdin, registered)
84
- end
85
- # rubocop:enable Lint/RescueException
86
-
87
- def finish_capture(stdin, registered)
88
- close_input(stdin)
89
- Signals.unregister(self) if registered
90
- end
91
-
92
- def register_capture(thread)
93
- Signals.register(self, thread.pid)
94
- end
95
-
96
- def cleanup_failed_capture(stdin, thread, readers)
97
- close_input(stdin)
98
- stop_process(thread)
99
- Array(readers).each(&:join)
100
- end
101
-
102
- def close_input(stdin)
103
- stdin.close unless stdin.closed?
104
- rescue IOError
105
- nil
106
- end
107
-
108
- def collect_capture(stdin, thread, readers, &block)
109
- inputs(stdin, thread, &block)
110
- close_input(stdin)
111
-
112
- [readers[0].value, readers[1].value, thread.value]
113
- end
114
-
115
- def handle_sigint(pid)
116
- @coathooks += 1
117
- message, signal = if @coathooks > 1
118
- ["SIGINT received again. Force quitting...", "KILL"]
119
- else
120
- ["SIGINT received.", "TERM"]
121
- end
122
-
123
- warn("\n#{message}")
124
- ::Process.kill(signal, pid)
125
- rescue Errno::ESRCH
126
- warn("No process to kill.")
127
- end
128
-
129
- def inputs(stdin, thread, &block)
130
- stdin.instance_exec(thread, &block) if block
131
- end
132
-
133
- def kill_process(signal, pid)
134
- ::Process.kill(signal, pid)
135
- rescue Errno::ESRCH
136
- nil
137
- end
138
-
139
- def outputs(stdout, stderr)
140
- [
141
- Thread.new { stdout.readlines.map(&:chomp) },
142
- Thread.new { stderr.readlines.map(&:chomp) }
143
- ]
144
- end
145
-
146
- def stop_process(thread)
147
- return unless thread&.alive?
148
-
149
- kill_process("TERM", thread.pid)
150
- return if thread.join(1)
151
-
152
- kill_process("KILL", thread.pid)
153
- thread.join
154
- end
155
- end
156
-
157
- extend self
158
-
159
- # @overload run(*args)
160
- # Runs a command through a fresh runner.
161
- # @param args [Array<String>] command and arguments
162
- # @return [Sevgi::Test::Shell::Result]
163
- def run(...) = Runner.new.run(...)
164
- end
165
- end
166
- end
@@ -1,96 +0,0 @@
1
- #!/usr/bin/env -S ruby -S sevgi
2
- # frozen_string_literal: true
3
-
4
- class CheckerBoard
5
- BOARD_MARGIN = 50
6
- CELL_SIZE = 100
7
- PIECE_SIZE = 80
8
-
9
- STYLE = {
10
- ".board-frame" => { fill: "#d1bfa7", stroke: "#6a3f2b" },
11
- ".inner-frame" => {
12
- fill: "#6a3f2b",
13
- stroke: "#6a3f2b",
14
- "stroke-width": (BOARD_MARGIN * 0.7).round
15
- },
16
- ".cell" => { stroke: "white", "stroke-width": 1 },
17
- ".light.cell" => { fill: "#d4a76f" },
18
- ".dark.cell" => { fill: "#6a3f2b" },
19
- ".piece" => {
20
- filter: "drop-shadow(8px 8px 8px rgba(0, 0, 0, 0.5))",
21
- stroke: "none"
22
- },
23
- ".light.piece" => { fill: "#f5f5f5" },
24
- ".dark.piece" => { fill: "#333" }
25
- }.freeze
26
-
27
- def initialize
28
- @pieces = []
29
- end
30
-
31
- def width = (CELL_SIZE * 8) + (BOARD_MARGIN * 2)
32
-
33
- def height = width
34
-
35
- def view_box = "0 0 #{width} #{height}"
36
-
37
- def add_piece(row, col, dark: false)
38
- @pieces << [row, col, dark]
39
- end
40
-
41
- def render_on(svg)
42
- svg.css STYLE
43
- add_frame(svg)
44
- add_cells(svg)
45
- add_pieces(svg)
46
- end
47
-
48
- private
49
-
50
- def add_frame(svg)
51
- svg.rect class: "board-frame", x: 0, y: 0, width: width, height: height
52
- svg.rect class: "inner-frame", x: BOARD_MARGIN, y: BOARD_MARGIN,
53
- width: width - (BOARD_MARGIN * 2),
54
- height: height - (BOARD_MARGIN * 2)
55
- end
56
-
57
- def add_cells(svg)
58
- 8.times do |row|
59
- 8.times do |col|
60
- svg.rect class: "#{(row + col).even? ? "dark" : "light"} cell",
61
- x: (col * CELL_SIZE) + BOARD_MARGIN,
62
- y: (row * CELL_SIZE) + BOARD_MARGIN,
63
- width: CELL_SIZE,
64
- height: CELL_SIZE
65
- end
66
- end
67
- end
68
-
69
- def add_pieces(svg)
70
- @pieces.each do |row, col, dark|
71
- x = (col * CELL_SIZE) + BOARD_MARGIN + 10
72
- y = (row * CELL_SIZE) + BOARD_MARGIN + 10
73
-
74
- svg.circle class: "#{dark ? "dark" : "light"} piece",
75
- cx: x + (PIECE_SIZE / 2),
76
- cy: y + (PIECE_SIZE / 2),
77
- r: PIECE_SIZE / 2
78
- end
79
- end
80
- end
81
-
82
- board = CheckerBoard.new
83
-
84
- [1, 3, 5, 7].each do |col|
85
- board.add_piece 0, col, dark: true
86
- board.add_piece 6, col, dark: false
87
- end
88
-
89
- [0, 2, 4, 6].each do |col|
90
- board.add_piece 1, col, dark: true
91
- board.add_piece 7, col, dark: false
92
- end
93
-
94
- SVG :minimal, width: board.width, height: board.height, viewBox: board.view_box do
95
- board.render_on(self)
96
- end.Save
@@ -1,117 +0,0 @@
1
- <svg width="900" height="900" viewBox="0 0 900 900">
2
- <style type="text/css">
3
- <![CDATA[
4
- .board-frame {
5
- fill: #d1bfa7;
6
- stroke: #6a3f2b;
7
- }
8
- .inner-frame {
9
- fill: #6a3f2b;
10
- stroke: #6a3f2b;
11
- stroke-width: 35;
12
- }
13
- .cell {
14
- stroke: white;
15
- stroke-width: 1;
16
- }
17
- .light.cell {
18
- fill: #d4a76f;
19
- }
20
- .dark.cell {
21
- fill: #6a3f2b;
22
- }
23
- .piece {
24
- filter: drop-shadow(8px 8px 8px rgba(0, 0, 0, 0.5));
25
- stroke: none;
26
- }
27
- .light.piece {
28
- fill: #f5f5f5;
29
- }
30
- .dark.piece {
31
- fill: #333;
32
- }
33
- ]]>
34
- </style>
35
- <rect class="board-frame" x="0" y="0" width="900" height="900"/>
36
- <rect class="inner-frame" x="50" y="50" width="800" height="800"/>
37
- <rect class="dark cell" x="50" y="50" width="100" height="100"/>
38
- <rect class="light cell" x="150" y="50" width="100" height="100"/>
39
- <rect class="dark cell" x="250" y="50" width="100" height="100"/>
40
- <rect class="light cell" x="350" y="50" width="100" height="100"/>
41
- <rect class="dark cell" x="450" y="50" width="100" height="100"/>
42
- <rect class="light cell" x="550" y="50" width="100" height="100"/>
43
- <rect class="dark cell" x="650" y="50" width="100" height="100"/>
44
- <rect class="light cell" x="750" y="50" width="100" height="100"/>
45
- <rect class="light cell" x="50" y="150" width="100" height="100"/>
46
- <rect class="dark cell" x="150" y="150" width="100" height="100"/>
47
- <rect class="light cell" x="250" y="150" width="100" height="100"/>
48
- <rect class="dark cell" x="350" y="150" width="100" height="100"/>
49
- <rect class="light cell" x="450" y="150" width="100" height="100"/>
50
- <rect class="dark cell" x="550" y="150" width="100" height="100"/>
51
- <rect class="light cell" x="650" y="150" width="100" height="100"/>
52
- <rect class="dark cell" x="750" y="150" width="100" height="100"/>
53
- <rect class="dark cell" x="50" y="250" width="100" height="100"/>
54
- <rect class="light cell" x="150" y="250" width="100" height="100"/>
55
- <rect class="dark cell" x="250" y="250" width="100" height="100"/>
56
- <rect class="light cell" x="350" y="250" width="100" height="100"/>
57
- <rect class="dark cell" x="450" y="250" width="100" height="100"/>
58
- <rect class="light cell" x="550" y="250" width="100" height="100"/>
59
- <rect class="dark cell" x="650" y="250" width="100" height="100"/>
60
- <rect class="light cell" x="750" y="250" width="100" height="100"/>
61
- <rect class="light cell" x="50" y="350" width="100" height="100"/>
62
- <rect class="dark cell" x="150" y="350" width="100" height="100"/>
63
- <rect class="light cell" x="250" y="350" width="100" height="100"/>
64
- <rect class="dark cell" x="350" y="350" width="100" height="100"/>
65
- <rect class="light cell" x="450" y="350" width="100" height="100"/>
66
- <rect class="dark cell" x="550" y="350" width="100" height="100"/>
67
- <rect class="light cell" x="650" y="350" width="100" height="100"/>
68
- <rect class="dark cell" x="750" y="350" width="100" height="100"/>
69
- <rect class="dark cell" x="50" y="450" width="100" height="100"/>
70
- <rect class="light cell" x="150" y="450" width="100" height="100"/>
71
- <rect class="dark cell" x="250" y="450" width="100" height="100"/>
72
- <rect class="light cell" x="350" y="450" width="100" height="100"/>
73
- <rect class="dark cell" x="450" y="450" width="100" height="100"/>
74
- <rect class="light cell" x="550" y="450" width="100" height="100"/>
75
- <rect class="dark cell" x="650" y="450" width="100" height="100"/>
76
- <rect class="light cell" x="750" y="450" width="100" height="100"/>
77
- <rect class="light cell" x="50" y="550" width="100" height="100"/>
78
- <rect class="dark cell" x="150" y="550" width="100" height="100"/>
79
- <rect class="light cell" x="250" y="550" width="100" height="100"/>
80
- <rect class="dark cell" x="350" y="550" width="100" height="100"/>
81
- <rect class="light cell" x="450" y="550" width="100" height="100"/>
82
- <rect class="dark cell" x="550" y="550" width="100" height="100"/>
83
- <rect class="light cell" x="650" y="550" width="100" height="100"/>
84
- <rect class="dark cell" x="750" y="550" width="100" height="100"/>
85
- <rect class="dark cell" x="50" y="650" width="100" height="100"/>
86
- <rect class="light cell" x="150" y="650" width="100" height="100"/>
87
- <rect class="dark cell" x="250" y="650" width="100" height="100"/>
88
- <rect class="light cell" x="350" y="650" width="100" height="100"/>
89
- <rect class="dark cell" x="450" y="650" width="100" height="100"/>
90
- <rect class="light cell" x="550" y="650" width="100" height="100"/>
91
- <rect class="dark cell" x="650" y="650" width="100" height="100"/>
92
- <rect class="light cell" x="750" y="650" width="100" height="100"/>
93
- <rect class="light cell" x="50" y="750" width="100" height="100"/>
94
- <rect class="dark cell" x="150" y="750" width="100" height="100"/>
95
- <rect class="light cell" x="250" y="750" width="100" height="100"/>
96
- <rect class="dark cell" x="350" y="750" width="100" height="100"/>
97
- <rect class="light cell" x="450" y="750" width="100" height="100"/>
98
- <rect class="dark cell" x="550" y="750" width="100" height="100"/>
99
- <rect class="light cell" x="650" y="750" width="100" height="100"/>
100
- <rect class="dark cell" x="750" y="750" width="100" height="100"/>
101
- <circle class="dark piece" cx="200" cy="100" r="40"/>
102
- <circle class="light piece" cx="200" cy="700" r="40"/>
103
- <circle class="dark piece" cx="400" cy="100" r="40"/>
104
- <circle class="light piece" cx="400" cy="700" r="40"/>
105
- <circle class="dark piece" cx="600" cy="100" r="40"/>
106
- <circle class="light piece" cx="600" cy="700" r="40"/>
107
- <circle class="dark piece" cx="800" cy="100" r="40"/>
108
- <circle class="light piece" cx="800" cy="700" r="40"/>
109
- <circle class="dark piece" cx="100" cy="200" r="40"/>
110
- <circle class="light piece" cx="100" cy="800" r="40"/>
111
- <circle class="dark piece" cx="300" cy="200" r="40"/>
112
- <circle class="light piece" cx="300" cy="800" r="40"/>
113
- <circle class="dark piece" cx="500" cy="200" r="40"/>
114
- <circle class="light piece" cx="500" cy="800" r="40"/>
115
- <circle class="dark piece" cx="700" cy="200" r="40"/>
116
- <circle class="light piece" cx="700" cy="800" r="40"/>
117
- </svg>
data/srv/gear-wheel.sevgi DELETED
@@ -1,27 +0,0 @@
1
- #!/usr/bin/env -S ruby -S sevgi
2
- # frozen_string_literal: true
3
-
4
- GEAR_STYLE = {
5
- fill: "#333",
6
- stroke: "none"
7
- }.freeze
8
-
9
- SVG :minimal, width: 100, height: 100, viewBox: "0 0 100 100" do
10
- rect x: 0, y: 0, width: 100, height: 100, fill: "lightgreen"
11
-
12
- mask id: "hole",
13
- maskUnits: "userSpaceOnUse",
14
- maskContentUnits: "userSpaceOnUse",
15
- x: 0, y: 0, width: 100, height: 100 do
16
- rect x: 0, y: 0, width: 100, height: 100, fill: "white"
17
- circle cx: 50, cy: 50, r: 15, fill: "black"
18
- end
19
-
20
- circle cx: 50, cy: 50, r: 30, mask: "url(#hole)", **GEAR_STYLE
21
-
22
- [0, 45, 90, 135].each do |angle|
23
- rect x: 45, y: 10, width: 10, height: 80,
24
- mask: "url(#hole)", transform: "rotate(#{angle} 50 50)",
25
- **GEAR_STYLE
26
- end
27
- end.Save
data/srv/gear-wheel.svg DELETED
@@ -1,12 +0,0 @@
1
- <svg width="100" height="100" viewBox="0 0 100 100">
2
- <rect x="0" y="0" width="100" height="100" fill="lightgreen"/>
3
- <mask id="hole" maskUnits="userSpaceOnUse" maskContentUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
4
- <rect x="0" y="0" width="100" height="100" fill="white"/>
5
- <circle cx="50" cy="50" r="15" fill="black"/>
6
- </mask>
7
- <circle cx="50" cy="50" r="30" mask="url(#hole)" fill="#333" stroke="none"/>
8
- <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(0 50 50)" fill="#333" stroke="none"/>
9
- <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(45 50 50)" fill="#333" stroke="none"/>
10
- <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(90 50 50)" fill="#333" stroke="none"/>
11
- <rect x="45" y="10" width="10" height="80" mask="url(#hole)" transform="rotate(135 50 50)" fill="#333" stroke="none"/>
12
- </svg>
data/srv/gear-wheel.yml DELETED
@@ -1,3 +0,0 @@
1
- dark:
2
- "#333": "#e5c39c"
3
- lightgreen: "#1f3522"