shoes-dsl 4.0.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +84 -0
  3. data/Gemfile +24 -0
  4. data/Guardfile +11 -0
  5. data/LICENSE +31 -0
  6. data/README.md +201 -0
  7. data/ext/install/Rakefile +29 -0
  8. data/ext/install/shoes.bat +9 -0
  9. data/fonts/Coolvetica.ttf +0 -0
  10. data/fonts/Lacuna.ttf +0 -0
  11. data/lib/shoes/animation.rb +56 -0
  12. data/lib/shoes/app.rb +131 -0
  13. data/lib/shoes/arc.rb +25 -0
  14. data/lib/shoes/background.rb +24 -0
  15. data/lib/shoes/border.rb +24 -0
  16. data/lib/shoes/builtin_methods.rb +77 -0
  17. data/lib/shoes/button.rb +30 -0
  18. data/lib/shoes/check_button.rb +44 -0
  19. data/lib/shoes/color.rb +385 -0
  20. data/lib/shoes/common/background_element.rb +9 -0
  21. data/lib/shoes/common/changeable.rb +34 -0
  22. data/lib/shoes/common/clickable.rb +24 -0
  23. data/lib/shoes/common/inspect.rb +14 -0
  24. data/lib/shoes/common/positioning.rb +30 -0
  25. data/lib/shoes/common/registration.rb +33 -0
  26. data/lib/shoes/common/remove.rb +10 -0
  27. data/lib/shoes/common/state.rb +18 -0
  28. data/lib/shoes/common/style.rb +152 -0
  29. data/lib/shoes/common/style_normalizer.rb +16 -0
  30. data/lib/shoes/common/ui_element.rb +11 -0
  31. data/lib/shoes/common/visibility.rb +40 -0
  32. data/lib/shoes/configuration.rb +96 -0
  33. data/lib/shoes/dialog.rb +27 -0
  34. data/lib/shoes/dimension.rb +239 -0
  35. data/lib/shoes/dimensions.rb +209 -0
  36. data/lib/shoes/download.rb +121 -0
  37. data/lib/shoes/dsl.rb +591 -0
  38. data/lib/shoes/font.rb +49 -0
  39. data/lib/shoes/gradient.rb +31 -0
  40. data/lib/shoes/image.rb +29 -0
  41. data/lib/shoes/image_pattern.rb +12 -0
  42. data/lib/shoes/input_box.rb +60 -0
  43. data/lib/shoes/internal_app.rb +219 -0
  44. data/lib/shoes/key_event.rb +17 -0
  45. data/lib/shoes/line.rb +87 -0
  46. data/lib/shoes/link.rb +59 -0
  47. data/lib/shoes/link_hover.rb +5 -0
  48. data/lib/shoes/list_box.rb +50 -0
  49. data/lib/shoes/logger.rb +66 -0
  50. data/lib/shoes/logger/ruby.rb +18 -0
  51. data/lib/shoes/mock.rb +31 -0
  52. data/lib/shoes/mock/animation.rb +8 -0
  53. data/lib/shoes/mock/app.rb +47 -0
  54. data/lib/shoes/mock/arc.rb +9 -0
  55. data/lib/shoes/mock/background.rb +10 -0
  56. data/lib/shoes/mock/border.rb +7 -0
  57. data/lib/shoes/mock/button.rb +10 -0
  58. data/lib/shoes/mock/check.rb +25 -0
  59. data/lib/shoes/mock/clickable.rb +8 -0
  60. data/lib/shoes/mock/common_methods.rb +12 -0
  61. data/lib/shoes/mock/dialog.rb +13 -0
  62. data/lib/shoes/mock/download.rb +18 -0
  63. data/lib/shoes/mock/font.rb +17 -0
  64. data/lib/shoes/mock/image.rb +13 -0
  65. data/lib/shoes/mock/image_pattern.rb +9 -0
  66. data/lib/shoes/mock/input_box.rb +30 -0
  67. data/lib/shoes/mock/keypress.rb +10 -0
  68. data/lib/shoes/mock/keyrelease.rb +10 -0
  69. data/lib/shoes/mock/line.rb +14 -0
  70. data/lib/shoes/mock/link.rb +12 -0
  71. data/lib/shoes/mock/list_box.rb +19 -0
  72. data/lib/shoes/mock/oval.rb +12 -0
  73. data/lib/shoes/mock/progress.rb +10 -0
  74. data/lib/shoes/mock/radio.rb +27 -0
  75. data/lib/shoes/mock/rect.rb +14 -0
  76. data/lib/shoes/mock/shape.rb +20 -0
  77. data/lib/shoes/mock/slot.rb +16 -0
  78. data/lib/shoes/mock/sound.rb +8 -0
  79. data/lib/shoes/mock/star.rb +14 -0
  80. data/lib/shoes/mock/text_block.rb +36 -0
  81. data/lib/shoes/mock/timer.rb +8 -0
  82. data/lib/shoes/not_implemented_error.rb +4 -0
  83. data/lib/shoes/oval.rb +20 -0
  84. data/lib/shoes/point.rb +54 -0
  85. data/lib/shoes/progress.rb +25 -0
  86. data/lib/shoes/radio.rb +16 -0
  87. data/lib/shoes/rect.rb +21 -0
  88. data/lib/shoes/renamed_delegate.rb +15 -0
  89. data/lib/shoes/shape.rb +158 -0
  90. data/lib/shoes/slot.rb +271 -0
  91. data/lib/shoes/slot_contents.rb +50 -0
  92. data/lib/shoes/sound.rb +18 -0
  93. data/lib/shoes/span.rb +16 -0
  94. data/lib/shoes/star.rb +45 -0
  95. data/lib/shoes/text.rb +24 -0
  96. data/lib/shoes/text_block.rb +143 -0
  97. data/lib/shoes/text_block_dimensions.rb +52 -0
  98. data/lib/shoes/timer.rb +12 -0
  99. data/lib/shoes/url.rb +44 -0
  100. data/lib/shoes/version.rb +3 -0
  101. data/lib/shoes/widget.rb +69 -0
  102. data/manifests/common.rb +34 -0
  103. data/manifests/shoes-dsl.rb +34 -0
  104. data/shoes-dsl.gemspec +19 -0
  105. data/spec/code_coverage.rb +14 -0
  106. data/spec/shoes/animation_spec.rb +65 -0
  107. data/spec/shoes/app_spec.rb +484 -0
  108. data/spec/shoes/arc_spec.rb +51 -0
  109. data/spec/shoes/background_spec.rb +53 -0
  110. data/spec/shoes/border_spec.rb +47 -0
  111. data/spec/shoes/builtin_methods_spec.rb +110 -0
  112. data/spec/shoes/button_spec.rb +44 -0
  113. data/spec/shoes/check_spec.rb +35 -0
  114. data/spec/shoes/cli_spec.rb +15 -0
  115. data/spec/shoes/color_spec.rb +408 -0
  116. data/spec/shoes/common/inspect_spec.rb +26 -0
  117. data/spec/shoes/common/remove_spec.rb +38 -0
  118. data/spec/shoes/common/style_normalizer_spec.rb +28 -0
  119. data/spec/shoes/common/style_spec.rb +147 -0
  120. data/spec/shoes/configuration_spec.rb +36 -0
  121. data/spec/shoes/constants_spec.rb +38 -0
  122. data/spec/shoes/dialog_spec.rb +163 -0
  123. data/spec/shoes/dimension_spec.rb +407 -0
  124. data/spec/shoes/dimensions_spec.rb +837 -0
  125. data/spec/shoes/download_spec.rb +142 -0
  126. data/spec/shoes/flow_spec.rb +133 -0
  127. data/spec/shoes/font_spec.rb +37 -0
  128. data/spec/shoes/framework_learning_spec.rb +30 -0
  129. data/spec/shoes/gradient_spec.rb +32 -0
  130. data/spec/shoes/helpers/fake_element.rb +17 -0
  131. data/spec/shoes/helpers/inspect_helpers.rb +5 -0
  132. data/spec/shoes/helpers/sample17_helper.rb +66 -0
  133. data/spec/shoes/image_spec.rb +49 -0
  134. data/spec/shoes/images/shoe.jpg +0 -0
  135. data/spec/shoes/input_box_spec.rb +80 -0
  136. data/spec/shoes/integration_spec.rb +20 -0
  137. data/spec/shoes/internal_app_spec.rb +141 -0
  138. data/spec/shoes/keypress_spec.rb +11 -0
  139. data/spec/shoes/keyrelease_spec.rb +12 -0
  140. data/spec/shoes/line_spec.rb +49 -0
  141. data/spec/shoes/link_spec.rb +105 -0
  142. data/spec/shoes/list_box_spec.rb +74 -0
  143. data/spec/shoes/logger/ruby_spec.rb +8 -0
  144. data/spec/shoes/logger_spec.rb +45 -0
  145. data/spec/shoes/oval_spec.rb +24 -0
  146. data/spec/shoes/point_spec.rb +71 -0
  147. data/spec/shoes/progress_spec.rb +54 -0
  148. data/spec/shoes/radio_spec.rb +32 -0
  149. data/spec/shoes/rect_spec.rb +39 -0
  150. data/spec/shoes/renamed_delegate_spec.rb +70 -0
  151. data/spec/shoes/shape_spec.rb +95 -0
  152. data/spec/shoes/shared_examples/button.rb +6 -0
  153. data/spec/shoes/shared_examples/changeable.rb +26 -0
  154. data/spec/shoes/shared_examples/clickable.rb +5 -0
  155. data/spec/shoes/shared_examples/common_methods.rb +35 -0
  156. data/spec/shoes/shared_examples/dimensions.rb +32 -0
  157. data/spec/shoes/shared_examples/dsl.rb +44 -0
  158. data/spec/shoes/shared_examples/dsl/animate.rb +29 -0
  159. data/spec/shoes/shared_examples/dsl/arc.rb +45 -0
  160. data/spec/shoes/shared_examples/dsl/background.rb +26 -0
  161. data/spec/shoes/shared_examples/dsl/border.rb +10 -0
  162. data/spec/shoes/shared_examples/dsl/button.rb +5 -0
  163. data/spec/shoes/shared_examples/dsl/cap.rb +6 -0
  164. data/spec/shoes/shared_examples/dsl/check.rb +11 -0
  165. data/spec/shoes/shared_examples/dsl/edit_box.rb +8 -0
  166. data/spec/shoes/shared_examples/dsl/edit_line.rb +8 -0
  167. data/spec/shoes/shared_examples/dsl/editable_element.rb +29 -0
  168. data/spec/shoes/shared_examples/dsl/fill.rb +27 -0
  169. data/spec/shoes/shared_examples/dsl/flow.rb +15 -0
  170. data/spec/shoes/shared_examples/dsl/gradient.rb +62 -0
  171. data/spec/shoes/shared_examples/dsl/image.rb +21 -0
  172. data/spec/shoes/shared_examples/dsl/line.rb +9 -0
  173. data/spec/shoes/shared_examples/dsl/nofill.rb +6 -0
  174. data/spec/shoes/shared_examples/dsl/nostroke.rb +6 -0
  175. data/spec/shoes/shared_examples/dsl/oval.rb +88 -0
  176. data/spec/shoes/shared_examples/dsl/pattern.rb +34 -0
  177. data/spec/shoes/shared_examples/dsl/progress.rb +7 -0
  178. data/spec/shoes/shared_examples/dsl/rect.rb +92 -0
  179. data/spec/shoes/shared_examples/dsl/rgb.rb +26 -0
  180. data/spec/shoes/shared_examples/dsl/shape.rb +21 -0
  181. data/spec/shoes/shared_examples/dsl/star.rb +48 -0
  182. data/spec/shoes/shared_examples/dsl/stroke.rb +30 -0
  183. data/spec/shoes/shared_examples/dsl/strokewidth.rb +19 -0
  184. data/spec/shoes/shared_examples/dsl/style.rb +32 -0
  185. data/spec/shoes/shared_examples/dsl/text_elements.rb +81 -0
  186. data/spec/shoes/shared_examples/dsl/video.rb +5 -0
  187. data/spec/shoes/shared_examples/dsl_app_context.rb +8 -0
  188. data/spec/shoes/shared_examples/hover_leave.rb +11 -0
  189. data/spec/shoes/shared_examples/parent.rb +6 -0
  190. data/spec/shoes/shared_examples/scroll.rb +41 -0
  191. data/spec/shoes/shared_examples/shared_element_method.rb +60 -0
  192. data/spec/shoes/shared_examples/slot.rb +331 -0
  193. data/spec/shoes/shared_examples/state.rb +19 -0
  194. data/spec/shoes/shared_examples/style.rb +82 -0
  195. data/spec/shoes/slot_spec.rb +130 -0
  196. data/spec/shoes/sound_spec.rb +15 -0
  197. data/spec/shoes/span_spec.rb +112 -0
  198. data/spec/shoes/spec_helper.rb +24 -0
  199. data/spec/shoes/stack_spec.rb +79 -0
  200. data/spec/shoes/star_spec.rb +31 -0
  201. data/spec/shoes/text_block_dimensions_spec.rb +75 -0
  202. data/spec/shoes/text_block_spec.rb +270 -0
  203. data/spec/shoes/url_spec.rb +68 -0
  204. data/spec/shoes/widget_spec.rb +70 -0
  205. data/spec/shoes_spec.rb +44 -0
  206. data/spec/spec_helper.rb +18 -0
  207. data/static/Shoes.icns +0 -0
  208. data/static/shoes-icon.png +0 -0
  209. metadata +354 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c38bb83189388abc0d71bb36ad93efd5910d6b4
4
+ data.tar.gz: adfd2e5ebf36c6049c18176ac52a943f005f9727
5
+ SHA512:
6
+ metadata.gz: e5823fd4c595ca428aa74832c4d6792cbb01d103783228062d30d55e010cf69ec98c7730ac01152811de82e957d7e9f4c564814eede7143d6f6203b8266c8456
7
+ data.tar.gz: f4b09220bc4702152955df7c20d9bf8864ca03d8eaa99fe2b1cccd0a14130d52d81b6c812a86285a157f1475aa43ed5a16cce3b4312bd9ab2d3b0bdc81b6b252
@@ -0,0 +1,84 @@
1
+ 4.0.0.pre2 (438 commits)
2
+ ----------------
3
+
4
+ New features (1)
5
+ ----------------
6
+
7
+ * Shoes 4.0.0.pre1 was a single gem. Now we ship as as three gems [e16a0c4]:
8
+
9
+ * shoes -- Home to the shoes executable. Declares dependencies on other
10
+ shoes gems for ease of installation.
11
+ * shoes-dsl -- Code for the Shoes DSL. No direct UI rendering and will be
12
+ reused with all future backends.
13
+ * shoes-swt -- The first Shoes backend, implemented in JRuby on the SWT
14
+ library via the swt gem.
15
+
16
+ * Full style-setting functionality (element#style, setters, hash, app level) [56d91f8]
17
+
18
+ Improvements (36)
19
+ -----------------
20
+
21
+ * Update SWT to 4.4 [536ffae]
22
+ * Update packaging dependency to 0.2.0 now supporting rubyzip > 1.0 [c3dd289]
23
+ * Update all elements to use new style methods [1b76aa3, 29498d1, d569a77, e6eec90, 54e5edf, 1238977, 2dc222f, dbeffff, 25b2ec6, cb865a6, 49fa0a1]
24
+ * Update list of app level styles and partially fix rotate angle issues [2affdbb]
25
+ * Shoes application context improved to avoid conflicts between user-defined and shoes-defined methods. [732108a]
26
+ * Builtin methods are also available from the Shoes class [de37d59]
27
+ * #gray, #rgb and #gradient builtin methods [8f7ee92]
28
+ * Removed redrawing triggers after Dimension methods [61a55ba]
29
+ * Apply fraction from progress initialize [b241240]
30
+ * Trigger redraw on hover/leave for slot and image update [ae5dfb5]
31
+ * Nobody Knows Shoes samples added [68e84e6]
32
+ * Add sample56 snapshot [e7eb0d3]
33
+ * Add scroll* methods to slots. Scrolling functionality not implemented yet. [6fb0e79]
34
+ * Click passes element, not coordinates to most blocks [78ecb23]
35
+ * Allow button calls without a button name [a315ef4]
36
+ * Add common #to_s and #inspect methods for DSL objects [350c4dc]
37
+ * Disposal for Images and Patterns. [ddcd9fb]
38
+ * Move Swt::TextBlock related classes to subdirectory. [226e03f]
39
+ * Revise TextBlock cursor to be more like other text functionality. [f016ee7]
40
+ * Updated manual to show correct syntax for rect. [2fee530]
41
+ * App#parent method to show the parent of the slot currently evaled [48e811f]
42
+ * Add keypress to close app cleanly when running leak hunter and dispose of app-level resources. [af4d6bb]
43
+
44
+ Bug Fixes (32)
45
+ --------------
46
+
47
+ * Fix running bin/shoes.bat from source [fe47075]
48
+ * Move shoes executable from shoes-dsl to shoes [92583e6]
49
+ * Fix for crash on empty link text [3da3159]
50
+ * Hide only the elements of a slot, not its parent contents [f2ea17c]
51
+ * Fix crash for Border when hiding [1c2ab74]
52
+ * Methods defined in widgets are available in URL instances [3a94afb]
53
+ * Make texts know their TextBlock and hence their visibility [7b4ea24]
54
+ * Non resizable apps can not be maximized (fixes resizable on mac) #872 [b08b215]
55
+ * Keypress#remove removes the keys listener and does not blow up [498588c]
56
+ * Run shape blocks with app as self [dbb0a46]
57
+ * When an element is removed or removed, cursor shouldn't change shape over that location. [918288f, 7fcd93a]
58
+ * Removing children from slot should trigger redraw [be35743]
59
+ * Fix for allowing widgets to use widget DSL methods [99d22e1]
60
+ * Fix for secret on edit lines [79c4c98]
61
+ * Fix crash computing height with hidden elements [41ebafe]
62
+ * Fix for unbounded height crash on centering [11fc3ae]
63
+ * Windows build requires shoes.bat from ext/install [232ec68]
64
+ * Reuse created fonts in the factory [7959bd8]
65
+ * Disposal of Shape SWT resources. [650365b]
66
+ * Fix for offsetting of second text segments [97fe79b]
67
+ * Consider relatively positioned elements for slot height [3e71126]
68
+ * Fix fatal exceptions in samples/simple-calc.rb [d53d588]
69
+ * Fix slot clearing [3697802]
70
+ * Don't clear top_slot when clear is called, clear current_slot [a57778c]
71
+ * Handling for text centering [87405f5]
72
+ * Fix common remove to allow removal of slots [c25df7e]
73
+ * Clear transform after painting each object, to avoid side effects on other painters [5a57ce3]
74
+ * Fix off by one error in slot positioning. [baee69a]
75
+ * Dispose of transform resources. [265600c]
76
+ * Only report start/end relative to the parent if there is one [c82e763]
77
+ * Links must be cleared on TextBlock#replace [4b90786]
78
+
79
+ Contributors (16)
80
+ -----------------
81
+
82
+ Jason R. Clark, Eric Watson, Tobias Pfeiffer, KC Erb, Charles Chamberlain,
83
+ George, Marcell Monteiro Cruz, Glenn Murray, Jason Clark, Tim Krajcar,
84
+ glenn-murray-bse, KCErb, PeterWAWood, Suirtimed, ashbb, Carlos R Tirado
data/Gemfile ADDED
@@ -0,0 +1,24 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :name => 'shoes'
4
+ gemspec :name => 'shoes-dsl'
5
+ gemspec :name => 'shoes-swt'
6
+
7
+ group :development do
8
+ gem "guard"
9
+ gem "guard-rspec"
10
+ gem "pry"
11
+
12
+ gem "rspec", "~>3.0.0"
13
+ gem "rspec-its", "~>1.0.1"
14
+ gem "rake"
15
+
16
+ gem "yard"
17
+ gem "kramdown"
18
+ gem 'simplecov'
19
+ gem 'coveralls'
20
+ gem "codeclimate-test-reporter"
21
+ gem 'jruby-lint'
22
+ gem 'webmock'
23
+ gem 'hometown'
24
+ end
@@ -0,0 +1,11 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec' do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
+ watch(%r{^lib/shoes/mock/(.+)\.rb$}) { |m| "spec/shoes/#{m[1]}_spec.rb" }
8
+ watch(%r{^lib/shoes/swt/(.+)\.rb$}) { |m| "spec/swt_shoes/#{m[1]}_spec.rb" }
9
+ watch('lib/shoes/dsl.rb') { |m| "spec/swt_shoes/dsl_spec.rb" }
10
+ end
11
+
data/LICENSE ADDED
@@ -0,0 +1,31 @@
1
+ Copyright (C) 2011 Steve Klabnik, Peter Fitzgibbons
2
+ Copyright (c) 2008 why the lucky stiff
3
+ Except:
4
+ fonts/Coolvetica.ttf (c) 1999 Ray Larabie
5
+ fonts/Lacuna.ttf (c) 2003 Glashaus, designed by Peter Hoffman
6
+ samples/expert-minesweeper.rb (c) 2008 que
7
+ samples/expert-othello.rb (c) 2008 Tieg Zaharia
8
+ samples/expert-tankspank.rb (c) 2008 Kevin C.
9
+ samples/good-clock.rb (c) 2008 Thomas Bell
10
+ samples/good-reminder.rb (c) 2008 Oliver Smith
11
+
12
+ Permission is hereby granted, free of charge, to any person
13
+ obtaining a copy of this software and associated documentation
14
+ files (the "Software"), to deal in the Software without restriction,
15
+ including without limitation the rights to use, copy, modify, merge,
16
+ publish, distribute, sublicense, and/or sell copies of the Software,
17
+ and to permit persons to whom the Software is furnished to do so,
18
+ subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
24
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
25
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
26
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
27
+ SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
29
+ OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
@@ -0,0 +1,201 @@
1
+ # shoes4 [![Build Status](https://secure.travis-ci.org/shoes/shoes4.svg?branch=master)](http://travis-ci.org/shoes/shoes4)[![Code Climate](https://img.shields.io/codeclimate/github/shoes/shoes4.svg)](https://codeclimate.com/github/shoes/shoes4)[![Coverage Status](https://img.shields.io/coveralls/shoes/shoes4.svg)](https://coveralls.io/r/shoes/shoes4?branch=master)[![Dependency Status](https://img.shields.io/gemnasium/shoes/shoes4.svg)](https://gemnasium.com/shoes/shoes4)
2
+
3
+ Shoes 4 : the next version of Shoes
4
+
5
+ ## Pre-alpha
6
+
7
+ Hi there, thanks for checking by! Shoes 4 is still pre-alpha software. It currently supports almost all of the shoes DSL, but there are still some spots where you might get surprising results. If you're not too adventurous just yet you can still use the [old shoes](https://github.com/shoes/shoes)!
8
+
9
+ There is a first [preview release](https://rubygems.org/gems/shoes/versions/4.0.0.pre1) now :)
10
+
11
+ ## Installing Shoes4
12
+
13
+ There are two ways to get your hands on shoes 4 - the preview gem release and installing it straight from github. For both you need a current [JRuby](http://www.jruby.org/) installation.
14
+
15
+
16
+ ### Get a JDK and JRuby
17
+
18
+ So your first step is to install a [JDK](http://www.oracle.com/technetwork/java/javase/downloads/) (shoes also works with [OpenJDK](http://openjdk.java.net/)) and [JRuby](http://jruby.org). Make sure to grab the appropriate JRuby version for your operating system. On Linux/Mac you can also use ruby installation tools to install JRuby. For instance [rvm](http://rvm.io/):
19
+
20
+ $ rvm install jruby
21
+
22
+ **Important JRuby version note:** JRuby 1.7.14 and 1.7.15 have a bug where `bundle install` won't work with shoes4. Make sure to use JRuby 1.7.16 or JRuby-1.7.13 with shoes4.
23
+
24
+ **JDK version note:** While shoes4 should generally work with JDK version 6 and up we recommend to use newer version. Also within the JDK major version make sure to have the latest updates installed, we had cases where newer versions resolved bugs.
25
+
26
+ ### Installing Shoes4 as a gem
27
+
28
+ #### *nix (Mac OSX/Linux)
29
+
30
+ $ gem install shoes --pre
31
+
32
+ #### Windows
33
+
34
+ C:\tmp> jruby -S gem install shoes --pre
35
+
36
+ ### Installing Shoes4 from github
37
+
38
+ If you want to be on the bleeding edge or want to contribute code you need to install it straight from the github repository.
39
+
40
+ #### *nix (Mac OSX/Linux)
41
+
42
+ 1. Fork the repository and clone your fork, or
43
+
44
+ $ git clone git://github.com/shoes/shoes4.git
45
+
46
+ 2. Set up your local environment
47
+
48
+ $ cd shoes4
49
+ $ gem install bundler && bundle install
50
+
51
+ Note: If you got rvm, rbenv or something like that installed it might complain that you should use jruby version xx. That's because we keep our .ruby-version files up to date. You should be able to run it with a JRuby version >= 1.7.0. We recommend up to date versions though.
52
+
53
+ 3. You're ready to go!
54
+
55
+ #### Windows
56
+
57
+ 1. Fork the repository and clone your fork, or
58
+
59
+ C:\tmp> git clone git://github.com/shoes/shoes4.git
60
+
61
+ 2. Set up your local environment
62
+
63
+ C:\tmp>cd shoes4
64
+ C:\tmp\shoes4>jruby -S gem install bundler
65
+ C:\tmp\shoes4>jruby -S bundle install
66
+
67
+ 3. You're ready to go!
68
+
69
+ ## Running a Shoes App
70
+
71
+ Shoes 4 comes with a command-line app runner. Just pass it the filename of your Shoes app.
72
+
73
+ $ bin/shoes samples/simple-sound.rb
74
+
75
+ **Note:** For Windows, `C:\tmp\shoes4>bin\shoes samples\simple-sound.rb` If you installed Shoes4 as a gem, just do `C:\tmp> shoes path\to\file.rb`
76
+
77
+ There is also a simple ruby starter script which you may use as follows:
78
+
79
+ $ bin/ruby-shoes samples/simple-sound.rb
80
+
81
+ This does not work yet on Mac as JRuby (the JVM) needs some additional parameters. Here you can just do the following (which basically is what bin/shoes does):
82
+
83
+ $ jruby -J-XstartOnFirstThread bin/ruby-shoes samples/simple-sound.rb
84
+
85
+ Another alternative yet is to put `require 'shoes'` at the top of your applications, then you can simply do
86
+
87
+ $ jruby path/to/file.rb
88
+
89
+ On OS X you still need to supply the additional parameters to JRuby
90
+
91
+ $ jruby -J-XstartOnFirstThread path/to/file.rb
92
+
93
+ ## Want to see what shoes can do?
94
+
95
+ You can run `rake samples` and random samples we believe are working will be run until you quit with Ctr + C. Some of them are really simple, while others are more complex or even games!
96
+ If you notice any issue with those samples please [let us know](https://github.com/shoes/shoes4/issues/new)!
97
+
98
+ ## Packaging a Shoes App
99
+
100
+ Packaging is just a baby, so be gentle.
101
+
102
+ In order to package an app, you need to have the Shoes gem installed in your environment. If you didn't do the gem installation you can always generate a gem and install it from the current source:
103
+
104
+ $ rake install:all
105
+
106
+ Now, you can package an app. But first, look here:
107
+
108
+ - The packager will include ***everything*** in the directory of your shoes script and below, unless you tell it not to.
109
+ - The packager will probably not work properly if it detects a `.gemspec` or a `Gemfile`. It uses Warbler, which always looks for those files. If you run the specs, you may notice some warnings like this:
110
+
111
+ > warning: Bundler \`path' components are not currently supported.
112
+ > The \`shoes-4.0.0.pre1' component was not bundled.
113
+ > Your application may fail to boot!
114
+
115
+ That's Warbler talking. Actually, we sneak the Shoes gem in anyway, but don't tell.
116
+
117
+ Okay, now for real. The simplest thing is to put your script in a directory by itself and then:
118
+
119
+ $ bin/shoes -p swt:app path/to/directory-of/your-shoes-app.rb
120
+
121
+ This will produce a Mac app, which you can then find at `path/to/directory-of/pkg/Shoes App.app`.
122
+
123
+ You can also package a shoes app up as a jar through:
124
+
125
+ $ bin/shoes -p swt:jar path/to/directory-of/your-shoes-app.rb
126
+
127
+ You can find the jar in the same directory as above, i.e. path/to/directory-of/pkg/your-shoes-app.jar
128
+
129
+ If you want more control (like you want to name your app something besides "Shoes App", or you don't want to include all of those files we talked about before), make an `app.yaml` file. See [the example](https://github.com/shoes/shoes4/blob/master/app.yaml) for more details.
130
+
131
+ ***Note:*** *If you use an `app.yaml`, you will have to customize or comment out each option. The example is just an example ;)*
132
+
133
+ When you have an `app.yaml` file right next to your script, you have three options:
134
+
135
+ $ bin/shoes -p swt:app path/to/directory-of/your-shoes-app.rb
136
+ $ bin/shoes -p swt:app path/to/directory-of/app.yaml
137
+ $ bin/shoes -p swt:app path/to/directory-of
138
+
139
+ The packager will find your instructions using any of those commands. Again, you'll find your app in the `pkg` directory inside your project's directory. Find out more at `bin/shoes --help`.
140
+
141
+ Oh, and you can also just run your Shoes apps with `bin/shoes`.
142
+
143
+ ## Want to contribute?
144
+
145
+ That's awesome, thank you!
146
+
147
+ You can go ahead an try to fix one of our [issues](https://github.com/shoes/shoes4/issues).
148
+ We have introduced a new tag 'Newcomer Friendly' for issues we believe are suitable to get started with shoes contributing. These issues either are relatively easy to accomplish or don't depend on a lot of other shoes code (e.g. completely new features) so that it's easier to get started.
149
+ Please feel free to tackle any issue - we will help you if needed. The tag is just a suggestion! =)
150
+
151
+ Also there is a list of samples that already work at samples/README, along with all the other samples. You can try to get a new sample to run. In order to do so you can run `rake non_samples` to run a random sample we think does not work. If you just want to list the non working samples you can also run `rake list_non_samples`.
152
+
153
+ With all you do, please make sure to write specs as Shoes 4 is developed TDD-style (see the [Running Specs](https://github.com/shoes/shoes4#running-specs) section below). So make sure that you don't break any tests :-)
154
+
155
+ If you feel unsure about testing or your implementation just open an issue or a pull request. Pull requests don't need to be done - they are great discussion starters! We're happy to help you get your contribution ready to be merged in order to help build Shoes 4!
156
+
157
+ In fact we greatly appreciate early pull requests to review code and help you find your way around Shoes4! =)
158
+
159
+ If you have questions, also feel free to drop by on the #shoes channel on FreeNode irc. People might not respond instantly, but after some time someone will respond :-)
160
+
161
+ It sometimes is also a good way to refactor some code or write some specs in order to get familiar with a project. If you want to try this approach you can have a look at our [Code Climate](https://codeclimate.com/github/shoes/shoes4) to find candidates for refactoring or after running the specs locally take a peak into the coverage directory and open index.html - it shows you our current coverage data. See something that isn't covered and maybe you can write a spec for it?
162
+
163
+ Refer to the following section for information on how to run the specs, that were mentioned before :-)
164
+
165
+ ## Running Specs
166
+
167
+ Shoes 4 is developed in a TDD style. You should be writing and running the specs :)
168
+
169
+ There are two kinds of Shoes 4 specs:
170
+
171
+ 1. **Integration specs:** These specify the functionality of the Shoes
172
+ DSL. They can be run with any compatible Shoes backend. Shoes 4 comes
173
+ with a mock backend and an Swt backend that can run the integration
174
+ specs.
175
+
176
+ 2. **Isolation specs:** These specify the internal behavior of a Shoes
177
+ backend, in isolation from the DSL. Shoes 4 comes with an isolation spec
178
+ suite for the Swt backend.
179
+
180
+ There are rake tasks for running specs. Some examples:
181
+
182
+ $ rake spec # Run the whole spec suite
183
+ $ rake spec:shoes # Run integration specs using the mock backend
184
+ $ rake spec:swt # Run integration specs using the Swt backend, plus isolation specs for the Swt backend
185
+ $ rake spec:swt:isolation # Run isolation specs for the Swt backend
186
+ $ rake spec:swt:integration # Run integration specs using the Swt backend
187
+ $ rake spec[Shape] # Run the whole spec suite, but only for Shape
188
+ $ rake spec:shoes[Shape] # Run integration specs for Shape using the mock backend
189
+ $ rake spec:swt[Shape] # Run integration and isolation specs for Shape, using the Swt backend
190
+ $ rake spec:swt:isolation[Shape] # Run isolation specs for Shape using the Swt backend
191
+
192
+ **Note:** For Windows, `C:\tmp\shoes4>jruby -S rake spec`
193
+
194
+ ## Contact
195
+
196
+ Want to get in touch with the shoes community? That's great! You can get in touch here:
197
+
198
+ * You can join the mailing list, simply send an email to shoes@librelist.com - you can also check out [the archives](http://librelist.com/browser/shoes/)
199
+ * We also have an irc channel #shoes on freenode - a lot of people are idling there so it might take some time to react
200
+
201
+ However we try to keep most discussions about the development in this repository/its issues so everyone can see them and look them up.
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'fileutils'
3
+
4
+ # Running JRuby on OS X requires options passed at the start. To pass those
5
+ # options and avoid double JVM startup, we want 'shoes' to be a bash script on
6
+ # Unix systems, but Rubygems only supports installing Ruby to the bin.
7
+
8
+ # We work around this by installing our script as shoes-stub, then acting like
9
+ # a "native extension" via this Rakefile, we manually generate the right script
10
+ # (a copy of shoes-stub) in the Gem.bindir.
11
+
12
+ # Because we don't actually declare shoes as an executable, we also have to
13
+ # copy our shoes.bat into place as well on Windows systems.
14
+
15
+ # We also provide a Rubygems plugin to clean up our manual file on uninstall.
16
+ # Post-install hooks didn't seem to work, though, hence the extension trick.
17
+
18
+ task :default => ['install_script']
19
+
20
+ task :install_script do
21
+ if Gem.win_platform?
22
+ source_path = File.join(File.dirname(__FILE__), "shoes.bat")
23
+ dest_path = File.join(Gem.bindir, "shoes.bat")
24
+ else
25
+ source_path = File.join(File.dirname(__FILE__), "..", "..", "bin", "shoes-stub")
26
+ dest_path = File.join(Gem.bindir, "shoes")
27
+ end
28
+ FileUtils.cp(source_path, dest_path)
29
+ end
@@ -0,0 +1,9 @@
1
+ @setlocal enableextensions enabledelayedexpansion
2
+ @echo off
3
+
4
+ REM If we're running from source, bin/shoes.bat will have set bin_dir already.
5
+ if not defined bin_dir set bin_dir=%~dp0
6
+
7
+ set command=jruby --1.9 !bin_dir!/ruby-shoes %*
8
+ call !command!
9
+ endlocal
Binary file
Binary file
@@ -0,0 +1,56 @@
1
+ class Shoes
2
+ class Animation
3
+ include Common::Inspect
4
+
5
+ # Creates a new Animation.
6
+ #
7
+ # @overload initialize(opts, &blk)
8
+ # @param [Hash] opts An options hash
9
+ # @param [Proc] blk A block of code to be executed for each
10
+ # animation frame
11
+ # @option opts [Integer] :framerate (24) The framerate (frames per second)
12
+ # @option opts [Shoes::App] :app The current Shoes app
13
+ def initialize(app, opts, blk)
14
+ @style = opts
15
+ @framerate = @style[:framerate] || 10
16
+ @app = app
17
+ @blk = blk
18
+ @current_frame = 0
19
+ @stopped = false
20
+ @gui = Shoes.configuration.backend_for(self, @app.gui)
21
+ end
22
+
23
+ attr_reader :current_frame, :framerate, :blk
24
+
25
+ def start
26
+ @stopped = false
27
+ end
28
+
29
+ def stop
30
+ @stopped = true
31
+ end
32
+
33
+ def stopped?
34
+ @stopped
35
+ end
36
+
37
+ def toggle
38
+ @stopped = !@stopped
39
+ end
40
+
41
+ def remove
42
+ @removed = true
43
+ end
44
+
45
+ def removed?
46
+ @removed
47
+ end
48
+
49
+ # Increments the current frame by 1
50
+ #
51
+ # @return [Integer] The new current frame
52
+ def increment_frame
53
+ @current_frame += 1
54
+ end
55
+ end
56
+ end