draw_color_repeat 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +556 -0
  4. data/VERSION +1 -0
  5. data/app/dcr.rb +51 -0
  6. data/app/dcr/launch.rb +3 -0
  7. data/app/models/dcr/command.rb +129 -0
  8. data/app/models/dcr/command/backward.rb +45 -0
  9. data/app/models/dcr/command/color.rb +120 -0
  10. data/app/models/dcr/command/empty.rb +30 -0
  11. data/app/models/dcr/command/forward.rb +47 -0
  12. data/app/models/dcr/command/left.rb +37 -0
  13. data/app/models/dcr/command/repeat.rb +42 -0
  14. data/app/models/dcr/command/right.rb +36 -0
  15. data/app/models/dcr/polygon.rb +37 -0
  16. data/app/models/dcr/program.rb +130 -0
  17. data/app/views/dcr/app_view.rb +128 -0
  18. data/app/views/dcr/compass.rb +56 -0
  19. data/bin/dcr +13 -0
  20. data/config/warble.rb +183 -0
  21. data/dcr.gemspec +0 -0
  22. data/lib/icon.rb +53 -0
  23. data/package/linux/Draw Color Repeat.png +0 -0
  24. data/package/macosx/Draw Color Repeat.icns +0 -0
  25. data/package/windows/Draw Color Repeat.ico +0 -0
  26. data/samples/aztec_pyramid.dcr +15 -0
  27. data/samples/bee_hive.dcr +15 -0
  28. data/samples/circle.dcr +4 -0
  29. data/samples/circle_of_circles.dcr +7 -0
  30. data/samples/envelope.dcr +14 -0
  31. data/samples/equilateral_triangle.dcr +6 -0
  32. data/samples/five_pointed_star.dcr +4 -0
  33. data/samples/house.dcr +25 -0
  34. data/samples/octagon.dcr +4 -0
  35. data/samples/octagon_of_octagons.dcr +6 -0
  36. data/samples/octagon_of_squares.dcr +7 -0
  37. data/samples/playing_cards.dcr +9 -0
  38. data/samples/rectangle.dcr +6 -0
  39. data/samples/sherrif_badge_star.dcr +8 -0
  40. data/samples/spider_web.dcr +6 -0
  41. data/samples/square.dcr +4 -0
  42. data/samples/stairs.dcr +16 -0
  43. data/samples/stick_figure.dcr +21 -0
  44. data/samples/sun.dcr +9 -0
  45. data/samples/swirl.dcr +7 -0
  46. data/samples/traffic_light.dcr +29 -0
  47. data/samples/triangle.dcr +5 -0
  48. data/vendor/jars/org/yaml/snakeyaml/1.28/snakeyaml-1.28.jar +0 -0
  49. metadata +207 -0
data/config/warble.rb ADDED
@@ -0,0 +1,183 @@
1
+
2
+ # Disable Rake-environment-task framework detection by uncommenting/setting to false
3
+ # Warbler.framework_detection = false
4
+
5
+ # Warbler web application assembly configuration file
6
+ Warbler::Config.new do |config|
7
+ # Features: additional options controlling how the jar is built.
8
+ # Currently the following features are supported:
9
+ # - *gemjar*: package the gem repository in a jar file in WEB-INF/lib
10
+ # - *executable*: embed a web server and make the war executable
11
+ # - *runnable*: allows to run bin scripts e.g. `java -jar my.war -S rake -T`
12
+ # - *compiled*: compile .rb files to .class files
13
+ # config.features = %w(gemjar)
14
+
15
+ # Application directories to be included in the webapp.
16
+ config.dirs = %w(app bin config db docs fonts icons images lib package script sounds vendor videos)
17
+
18
+ # Additional files/directories to include, above those in config.dirs
19
+ config.includes = FileList['LICENSE.txt', 'VERSION']
20
+
21
+ # Additional files/directories to exclude
22
+ # config.excludes = FileList["lib/tasks/*"]
23
+
24
+ # Additional Java .jar files to include. Note that if .jar files are placed
25
+ # in lib (and not otherwise excluded) then they need not be mentioned here.
26
+ # JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include your
27
+ # own versions if you directly set the value
28
+ # config.java_libs += FileList["lib/java/*.jar"]
29
+
30
+ # Loose Java classes and miscellaneous files to be included.
31
+ # config.java_classes = FileList["target/classes/**.*"]
32
+
33
+ # One or more pathmaps defining how the java classes should be copied into
34
+ # the archive. The example pathmap below accompanies the java_classes
35
+ # configuration above. See http://rake.rubyforge.org/classes/String.html#M000017
36
+ # for details of how to specify a pathmap.
37
+ # config.pathmaps.java_classes << "%{target/classes/,}p"
38
+
39
+ # Bundler support is built-in. If Warbler finds a Gemfile in the
40
+ # project directory, it will be used to collect the gems to bundle
41
+ # in your application. If you wish to explicitly disable this
42
+ # functionality, uncomment here.
43
+ # config.bundler = false
44
+
45
+ # An array of Bundler groups to avoid including in the war file.
46
+ # Defaults to ["development", "test", "assets"].
47
+ # config.bundle_without = []
48
+
49
+ # Other gems to be included. If you don't use Bundler or a gemspec
50
+ # file, you need to tell Warbler which gems your application needs
51
+ # so that they can be packaged in the archive.
52
+ # For Rails applications, the Rails gems are included by default
53
+ # unless the vendor/rails directory is present.
54
+ # config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
55
+ # config.gems << "tzinfo"
56
+
57
+ # Uncomment this if you don't want to package rails gem.
58
+ # config.gems -= ["rails"]
59
+
60
+ # The most recent versions of gems are used.
61
+ # You can specify versions of gems by using a hash assignment:
62
+ # config.gems["rails"] = "4.2.5"
63
+
64
+ # You can also use regexps or Gem::Dependency objects for flexibility or
65
+ # finer-grained control.
66
+ # config.gems << /^sinatra-/
67
+ # config.gems << Gem::Dependency.new("sinatra", "= 1.4.7")
68
+
69
+ # Include gem dependencies not mentioned specifically. Default is
70
+ # true, uncomment to turn off.
71
+ # config.gem_dependencies = false
72
+
73
+ # Array of regular expressions matching relative paths in gems to be
74
+ # excluded from the war. Defaults to empty, but you can set it like
75
+ # below, which excludes test files.
76
+ # config.gem_excludes = [/^(test|spec)\//]
77
+
78
+ # Pathmaps for controlling how application files are copied into the archive
79
+ # config.pathmaps.application = ["WEB-INF/%p"]
80
+
81
+ # Name of the archive (without the extension). Defaults to the basename
82
+ # of the project directory.
83
+ # config.jar_name = "mywar"
84
+
85
+ # File extension for the archive. Defaults to either 'jar' or 'war'.
86
+ # config.jar_extension = "jar"
87
+
88
+ # Destionation for the created archive. Defaults to project's root directory.
89
+ config.autodeploy_dir = "dist/"
90
+
91
+ # Name of the MANIFEST.MF template for the war file. Defaults to a simple
92
+ # MANIFEST.MF that contains the version of Warbler used to create the war file.
93
+ # config.manifest_file = "config/MANIFEST.MF"
94
+
95
+ # When using the 'compiled' feature and specified, only these Ruby
96
+ # files will be compiled. Default is to compile all \.rb files in
97
+ # the application.
98
+ # config.compiled_ruby_files = FileList['app/**/*.rb']
99
+
100
+ # Determines if ruby files in supporting gems will be compiled.
101
+ # Ignored unless compile feature is used.
102
+ # config.compile_gems = false
103
+
104
+ # When set it specify the bytecode version for compiled class files
105
+ # config.bytecode_version = "1.6"
106
+
107
+ # When set to true, Warbler will override the value of ENV['GEM_HOME'] even it
108
+ # has already been set. When set to false it will use any existing value of
109
+ # GEM_HOME if it is set.
110
+ # config.override_gem_home = true
111
+
112
+ # Allows for specifing custom executables
113
+ # config.executable = ["rake", "bin/rake"]
114
+
115
+ # Sets default (prefixed) parameters for the executables
116
+ # config.executable_params = "do:something"
117
+
118
+ # If set to true, moves jar files into WEB-INF/lib. Prior to version 1.4.2 of Warbler this was done
119
+ # by default. But since 1.4.2 this config defaults to false. It may need to be set to true for
120
+ # web servers that do not explode the WAR file.
121
+ # Alternatively, this option can be set to a regular expression, which will
122
+ # act as a jar selector -- only jar files that match the pattern will be
123
+ # included in the archive.
124
+ # config.move_jars_to_webinf_lib = false
125
+
126
+ # === War files only below here ===
127
+
128
+ # Embedded webserver to use with the 'executable' feature. Currently supported
129
+ # webservers are:
130
+ # - *jetty* - Embedded Jetty from Eclipse
131
+ # config.webserver = 'jetty'
132
+
133
+ # Path to the pre-bundled gem directory inside the war file. Default
134
+ # is 'WEB-INF/gems'. Specify path if gems are already bundled
135
+ # before running Warbler. This also sets 'gem.path' inside web.xml.
136
+ # config.gem_path = "WEB-INF/vendor/bundler_gems"
137
+
138
+ # Files for WEB-INF directory (next to web.xml). This contains
139
+ # web.xml by default. If there is an .erb-File it will be processed
140
+ # with webxml-config. You may want to exclude this file via
141
+ # config.excludes.
142
+ # config.webinf_files += FileList["jboss-web.xml"]
143
+
144
+ # Files to be included in the root of the webapp. Note that files in public
145
+ # will have the leading 'public/' part of the path stripped during staging.
146
+ # config.public_html = FileList["public/**/*", "doc/**/*"]
147
+
148
+ # Pathmaps for controlling how public HTML files are copied into the .war
149
+ # config.pathmaps.public_html = ["%{public/,}p"]
150
+
151
+ # Value of RAILS_ENV for the webapp -- default as shown below
152
+ # config.webxml.rails.env = ENV['RAILS_ENV'] || 'production'
153
+
154
+ # Public ROOT mapping, by default assets are copied into .war ROOT directory.
155
+ # config.public.root = ''
156
+
157
+ # Application booter to use, either :rack or :rails (autodetected by default)
158
+ # config.webxml.booter = :rails
159
+
160
+ # When using the :rack booter, "Rackup" script to use.
161
+ # - For 'rackup.path', the value points to the location of the rackup
162
+ # script in the web archive file. You need to make sure this file
163
+ # gets included in the war, possibly by adding it to config.includes
164
+ # or config.webinf_files above.
165
+ # - For 'rackup', the rackup script you provide as an inline string
166
+ # is simply embedded in web.xml.
167
+ # The script is evaluated in a Rack::Builder to load the application.
168
+ # Examples:
169
+ # config.webxml.rackup.path = 'WEB-INF/hello.ru'
170
+ # config.webxml.rackup = %{require './lib/demo'; run Rack::Adapter::Camping.new(Demo)}
171
+ # config.webxml.rackup = require 'cgi' && CGI::escapeHTML(File.read("config.ru"))
172
+
173
+ # Control the pool of Rails runtimes. Leaving unspecified means
174
+ # the pool will grow as needed to service requests. It is recommended
175
+ # that you fix these values when running a production server!
176
+ # If you're using threadsafe! mode, you probably don't want to set these values,
177
+ # since 1 runtime(default for threadsafe mode) will be enough.
178
+ # config.webxml.jruby.min.runtimes = 2
179
+ # config.webxml.jruby.max.runtimes = 4
180
+
181
+ # JNDI data source name
182
+ # config.webxml.jndi = 'jdbc/rails'
183
+ end
data/dcr.gemspec ADDED
Binary file
data/lib/icon.rb ADDED
@@ -0,0 +1,53 @@
1
+ # Copyright (c) 2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ # The DCR Icon is generated by Glimmer GUI DSL code script
23
+
24
+ require 'glimmer-dsl-swt'
25
+ require 'glimmer-cp-stickfigure'
26
+
27
+ include Glimmer
28
+
29
+ @font_name = 'Tahoma'
30
+
31
+ @image = image(512, 512) {
32
+ rectangle(0, 0, :max, :max) {
33
+ background rgb(255, 254, 114)
34
+ }
35
+ stick_figure(
36
+ location_x: 80,
37
+ location_y: 30,
38
+ size: 290,
39
+ ) {
40
+ line_width 12
41
+ foreground :black
42
+ }
43
+ text('DCR', :default, [:default, 150]) {
44
+ font name: @font_name, height: 155, style: :bold
45
+ }
46
+ }
47
+
48
+ shell(:no_trim) {
49
+ image @image
50
+ label {
51
+ image @image
52
+ }
53
+ }.open
Binary file
@@ -0,0 +1,15 @@
1
+ right
2
+ forward 20
3
+ left
4
+ forward 20
5
+ repeat 5
6
+
7
+ right
8
+ forward 20
9
+
10
+ right
11
+ forward 20
12
+ left
13
+ forward 20
14
+ repeat 5
15
+ color yellow
@@ -0,0 +1,15 @@
1
+ right 60
2
+ forward 20
3
+ repeat 4
4
+ color yellow
5
+ left 60
6
+ forward 20
7
+ repeat 2
8
+ right 60
9
+ forward 20
10
+ repeat 4
11
+ right 60
12
+ forward 20
13
+ left 60
14
+ forward 20
15
+ repeat 5
@@ -0,0 +1,4 @@
1
+ forward
2
+ right 1
3
+ repeat 360
4
+ color orange
@@ -0,0 +1,7 @@
1
+ right 8
2
+ forward 2
3
+ repeat 45
4
+ color
5
+ right 10
6
+ forward 32
7
+ repeat 19
@@ -0,0 +1,14 @@
1
+ left 60
2
+ forward 104
3
+ right 150
4
+ forward 180
5
+ right 150
6
+ forward 104
7
+ backward 104
8
+ left 60
9
+ forward 90
10
+ right
11
+ forward 180
12
+ right
13
+ forward 90
14
+ color white
@@ -0,0 +1,6 @@
1
+ left
2
+
3
+ forward 100
4
+ right 120
5
+ repeat 2
6
+ color blue
@@ -0,0 +1,4 @@
1
+ left 144
2
+ forward 140
3
+ repeat 4
4
+ color white
data/samples/house.dcr ADDED
@@ -0,0 +1,25 @@
1
+ right 45
2
+ forward 80
3
+ right
4
+ forward 80
5
+ right 135
6
+ forward 113
7
+ color red
8
+ right
9
+
10
+ right
11
+ forward 113
12
+ right
13
+ forward 113
14
+ right
15
+ forward 74
16
+ right
17
+ forward 40
18
+ right
19
+ forward 30
20
+ right
21
+ forward 40
22
+ right
23
+ forward 70
24
+ right
25
+ color grey
@@ -0,0 +1,4 @@
1
+ right 45
2
+ forward 80
3
+ repeat 7
4
+ color red
@@ -0,0 +1,6 @@
1
+ forward 20
2
+ right 45
3
+ repeat 6
4
+ color
5
+ forward 70
6
+ repeat 9
@@ -0,0 +1,7 @@
1
+ right
2
+ forward 30
3
+ repeat 2
4
+ right 45
5
+ forward 60
6
+ repeat 7
7
+ color blue
@@ -0,0 +1,9 @@
1
+ forward 50
2
+ right
3
+ forward 36
4
+ right
5
+ repeat
6
+ color
7
+ left 9
8
+ forward 5
9
+ repeat 14
@@ -0,0 +1,6 @@
1
+ forward 80
2
+ right
3
+ forward 160
4
+ right
5
+ repeat
6
+ color green
@@ -0,0 +1,8 @@
1
+ right 37
2
+
3
+ forward 28
4
+ right 51
5
+ forward 28
6
+ left 102
7
+ repeat 6
8
+ color yellow
@@ -0,0 +1,6 @@
1
+ r 10
2
+ f 180
3
+ p 35
4
+ r 110
5
+ f 260
6
+ p 35
@@ -0,0 +1,4 @@
1
+ forward 80
2
+ right
3
+ repeat 3
4
+ color yellow
@@ -0,0 +1,16 @@
1
+ forward 20
2
+ right
3
+ forward 20
4
+ left
5
+ repeat 5
6
+ backward 240
7
+ left
8
+ forward 240
9
+ right
10
+
11
+ forward 20
12
+ right
13
+ forward 20
14
+ left
15
+ repeat 5
16
+ color white
@@ -0,0 +1,21 @@
1
+ right 65
2
+ forward 70
3
+ backward 70
4
+ left 130
5
+ forward 70
6
+ backward 70
7
+ right 65
8
+ forward 30
9
+ right
10
+
11
+ left 4
12
+ forward 1
13
+ repeat 90
14
+
15
+ right 94
16
+ forward 80
17
+ right 55
18
+ forward 90
19
+ backward 90
20
+ left 110
21
+ forward 90