shoes-core 4.0.0.pre3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +31 -0
- data/README.md +8 -0
- data/Rakefile +1 -0
- data/bin/shoes +62 -0
- data/bin/shoes-guard +8 -0
- data/bin/shoes-picker +6 -0
- data/bin/shoes-stub +62 -0
- data/ext/install/Rakefile +29 -0
- data/ext/install/shoes.bat +15 -0
- data/fonts/Coolvetica.ttf +0 -0
- data/fonts/Lacuna.ttf +0 -0
- data/lib/rubygems_plugin.rb +24 -0
- data/lib/shoes.rb +1 -0
- data/lib/shoes/animation.rb +56 -0
- data/lib/shoes/app.rb +130 -0
- data/lib/shoes/arc.rb +25 -0
- data/lib/shoes/background.rb +20 -0
- data/lib/shoes/border.rb +20 -0
- data/lib/shoes/builtin_methods.rb +76 -0
- data/lib/shoes/button.rb +29 -0
- data/lib/shoes/check_button.rb +41 -0
- data/lib/shoes/color.rb +387 -0
- data/lib/shoes/common/background_element.rb +9 -0
- data/lib/shoes/common/changeable.rb +34 -0
- data/lib/shoes/common/clickable.rb +24 -0
- data/lib/shoes/common/inspect.rb +14 -0
- data/lib/shoes/common/positioning.rb +30 -0
- data/lib/shoes/common/registration.rb +31 -0
- data/lib/shoes/common/remove.rb +10 -0
- data/lib/shoes/common/state.rb +16 -0
- data/lib/shoes/common/style.rb +160 -0
- data/lib/shoes/common/style_normalizer.rb +16 -0
- data/lib/shoes/common/ui_element.rb +11 -0
- data/lib/shoes/common/visibility.rb +41 -0
- data/lib/shoes/configuration.rb +96 -0
- data/lib/shoes/core.rb +1 -0
- data/lib/shoes/core/version.rb +5 -0
- data/lib/shoes/dialog.rb +56 -0
- data/lib/shoes/dimension.rb +269 -0
- data/lib/shoes/dimensions.rb +203 -0
- data/lib/shoes/download.rb +130 -0
- data/lib/shoes/dsl.rb +656 -0
- data/lib/shoes/file_not_found_error.rb +4 -0
- data/lib/shoes/font.rb +50 -0
- data/lib/shoes/gradient.rb +31 -0
- data/lib/shoes/image.rb +53 -0
- data/lib/shoes/image_pattern.rb +12 -0
- data/lib/shoes/input_box.rb +59 -0
- data/lib/shoes/internal_app.rb +230 -0
- data/lib/shoes/key_event.rb +17 -0
- data/lib/shoes/line.rb +84 -0
- data/lib/shoes/link.rb +57 -0
- data/lib/shoes/link_hover.rb +5 -0
- data/lib/shoes/list_box.rb +50 -0
- data/lib/shoes/logger.rb +65 -0
- data/lib/shoes/logger/ruby.rb +16 -0
- data/lib/shoes/mock.rb +33 -0
- data/lib/shoes/mock/animation.rb +8 -0
- data/lib/shoes/mock/app.rb +49 -0
- data/lib/shoes/mock/arc.rb +9 -0
- data/lib/shoes/mock/background.rb +10 -0
- data/lib/shoes/mock/border.rb +7 -0
- data/lib/shoes/mock/button.rb +22 -0
- data/lib/shoes/mock/check.rb +24 -0
- data/lib/shoes/mock/clickable.rb +8 -0
- data/lib/shoes/mock/common_methods.rb +12 -0
- data/lib/shoes/mock/dialog.rb +13 -0
- data/lib/shoes/mock/download.rb +16 -0
- data/lib/shoes/mock/font.rb +15 -0
- data/lib/shoes/mock/image.rb +13 -0
- data/lib/shoes/mock/image_pattern.rb +8 -0
- data/lib/shoes/mock/input_box.rb +30 -0
- data/lib/shoes/mock/keypress.rb +11 -0
- data/lib/shoes/mock/keyrelease.rb +11 -0
- data/lib/shoes/mock/line.rb +14 -0
- data/lib/shoes/mock/link.rb +11 -0
- data/lib/shoes/mock/list_box.rb +19 -0
- data/lib/shoes/mock/oval.rb +11 -0
- data/lib/shoes/mock/packager.rb +13 -0
- data/lib/shoes/mock/progress.rb +10 -0
- data/lib/shoes/mock/radio.rb +27 -0
- data/lib/shoes/mock/rect.rb +14 -0
- data/lib/shoes/mock/shape.rb +20 -0
- data/lib/shoes/mock/slot.rb +16 -0
- data/lib/shoes/mock/sound.rb +8 -0
- data/lib/shoes/mock/star.rb +14 -0
- data/lib/shoes/mock/text_block.rb +36 -0
- data/lib/shoes/mock/timer.rb +8 -0
- data/lib/shoes/not_implemented_error.rb +4 -0
- data/lib/shoes/oval.rb +20 -0
- data/lib/shoes/packager.rb +26 -0
- data/lib/shoes/point.rb +54 -0
- data/lib/shoes/progress.rb +25 -0
- data/lib/shoes/radio.rb +15 -0
- data/lib/shoes/rect.rb +21 -0
- data/lib/shoes/renamed_delegate.rb +15 -0
- data/lib/shoes/shape.rb +159 -0
- data/lib/shoes/slot.rb +276 -0
- data/lib/shoes/slot_contents.rb +51 -0
- data/lib/shoes/sound.rb +18 -0
- data/lib/shoes/span.rb +16 -0
- data/lib/shoes/star.rb +50 -0
- data/lib/shoes/text.rb +24 -0
- data/lib/shoes/text_block.rb +142 -0
- data/lib/shoes/text_block_dimensions.rb +51 -0
- data/lib/shoes/timer.rb +14 -0
- data/lib/shoes/ui/cli.rb +67 -0
- data/lib/shoes/ui/picker.rb +47 -0
- data/lib/shoes/url.rb +44 -0
- data/lib/shoes/version.rb +3 -0
- data/lib/shoes/widget.rb +67 -0
- data/shoes-core.gemspec +22 -0
- data/spec/shoes/animation_spec.rb +71 -0
- data/spec/shoes/app_spec.rb +484 -0
- data/spec/shoes/arc_spec.rb +51 -0
- data/spec/shoes/background_spec.rb +47 -0
- data/spec/shoes/border_spec.rb +46 -0
- data/spec/shoes/builtin_methods_spec.rb +110 -0
- data/spec/shoes/button_spec.rb +44 -0
- data/spec/shoes/check_spec.rb +35 -0
- data/spec/shoes/color_spec.rb +408 -0
- data/spec/shoes/common/inspect_spec.rb +26 -0
- data/spec/shoes/common/remove_spec.rb +38 -0
- data/spec/shoes/common/style_normalizer_spec.rb +28 -0
- data/spec/shoes/common/style_spec.rb +147 -0
- data/spec/shoes/configuration_spec.rb +36 -0
- data/spec/shoes/constants_spec.rb +38 -0
- data/spec/shoes/dialog_spec.rb +171 -0
- data/spec/shoes/dimension_spec.rb +433 -0
- data/spec/shoes/dimensions_spec.rb +837 -0
- data/spec/shoes/download_spec.rb +146 -0
- data/spec/shoes/flow_spec.rb +133 -0
- data/spec/shoes/font_spec.rb +37 -0
- data/spec/shoes/framework_learning_spec.rb +30 -0
- data/spec/shoes/gradient_spec.rb +32 -0
- data/spec/shoes/helpers/fake_element.rb +17 -0
- data/spec/shoes/helpers/inspect_helpers.rb +5 -0
- data/spec/shoes/helpers/sample17_helper.rb +66 -0
- data/spec/shoes/image_spec.rb +68 -0
- data/spec/shoes/images/shoe.jpg +0 -0
- data/spec/shoes/input_box_spec.rb +80 -0
- data/spec/shoes/integration_spec.rb +20 -0
- data/spec/shoes/internal_app_spec.rb +141 -0
- data/spec/shoes/keypress_spec.rb +11 -0
- data/spec/shoes/keyrelease_spec.rb +12 -0
- data/spec/shoes/line_spec.rb +87 -0
- data/spec/shoes/link_spec.rb +118 -0
- data/spec/shoes/list_box_spec.rb +74 -0
- data/spec/shoes/logger/ruby_spec.rb +8 -0
- data/spec/shoes/logger_spec.rb +45 -0
- data/spec/shoes/oval_spec.rb +24 -0
- data/spec/shoes/packager_spec.rb +25 -0
- data/spec/shoes/point_spec.rb +71 -0
- data/spec/shoes/progress_spec.rb +54 -0
- data/spec/shoes/radio_spec.rb +32 -0
- data/spec/shoes/rect_spec.rb +39 -0
- data/spec/shoes/renamed_delegate_spec.rb +70 -0
- data/spec/shoes/shape_spec.rb +106 -0
- data/spec/shoes/shared_examples/button.rb +6 -0
- data/spec/shoes/shared_examples/changeable.rb +26 -0
- data/spec/shoes/shared_examples/clickable.rb +5 -0
- data/spec/shoes/shared_examples/common_methods.rb +35 -0
- data/spec/shoes/shared_examples/dimensions.rb +32 -0
- data/spec/shoes/shared_examples/dsl.rb +44 -0
- data/spec/shoes/shared_examples/dsl/animate.rb +29 -0
- data/spec/shoes/shared_examples/dsl/arc.rb +45 -0
- data/spec/shoes/shared_examples/dsl/background.rb +26 -0
- data/spec/shoes/shared_examples/dsl/border.rb +10 -0
- data/spec/shoes/shared_examples/dsl/button.rb +5 -0
- data/spec/shoes/shared_examples/dsl/cap.rb +6 -0
- data/spec/shoes/shared_examples/dsl/check.rb +11 -0
- data/spec/shoes/shared_examples/dsl/edit_box.rb +8 -0
- data/spec/shoes/shared_examples/dsl/edit_line.rb +8 -0
- data/spec/shoes/shared_examples/dsl/editable_element.rb +29 -0
- data/spec/shoes/shared_examples/dsl/fill.rb +27 -0
- data/spec/shoes/shared_examples/dsl/flow.rb +15 -0
- data/spec/shoes/shared_examples/dsl/gradient.rb +62 -0
- data/spec/shoes/shared_examples/dsl/image.rb +21 -0
- data/spec/shoes/shared_examples/dsl/line.rb +9 -0
- data/spec/shoes/shared_examples/dsl/nofill.rb +6 -0
- data/spec/shoes/shared_examples/dsl/nostroke.rb +6 -0
- data/spec/shoes/shared_examples/dsl/oval.rb +88 -0
- data/spec/shoes/shared_examples/dsl/pattern.rb +34 -0
- data/spec/shoes/shared_examples/dsl/progress.rb +7 -0
- data/spec/shoes/shared_examples/dsl/rect.rb +92 -0
- data/spec/shoes/shared_examples/dsl/rgb.rb +26 -0
- data/spec/shoes/shared_examples/dsl/shape.rb +57 -0
- data/spec/shoes/shared_examples/dsl/star.rb +111 -0
- data/spec/shoes/shared_examples/dsl/stroke.rb +30 -0
- data/spec/shoes/shared_examples/dsl/strokewidth.rb +19 -0
- data/spec/shoes/shared_examples/dsl/style.rb +32 -0
- data/spec/shoes/shared_examples/dsl/text_elements.rb +81 -0
- data/spec/shoes/shared_examples/dsl/video.rb +5 -0
- data/spec/shoes/shared_examples/dsl_app_context.rb +8 -0
- data/spec/shoes/shared_examples/hover_leave.rb +11 -0
- data/spec/shoes/shared_examples/parent.rb +6 -0
- data/spec/shoes/shared_examples/scroll.rb +41 -0
- data/spec/shoes/shared_examples/shared_element_method.rb +60 -0
- data/spec/shoes/shared_examples/slot.rb +394 -0
- data/spec/shoes/shared_examples/state.rb +19 -0
- data/spec/shoes/shared_examples/style.rb +82 -0
- data/spec/shoes/slot_spec.rb +186 -0
- data/spec/shoes/sound_spec.rb +15 -0
- data/spec/shoes/span_spec.rb +112 -0
- data/spec/shoes/spec_helper.rb +24 -0
- data/spec/shoes/stack_spec.rb +79 -0
- data/spec/shoes/star_spec.rb +48 -0
- data/spec/shoes/text_block_dimensions_spec.rb +75 -0
- data/spec/shoes/text_block_spec.rb +270 -0
- data/spec/shoes/url_spec.rb +68 -0
- data/spec/shoes/widget_spec.rb +70 -0
- data/spec/shoes_spec.rb +44 -0
- data/spec/spec_helper.rb +19 -0
- data/static/downloading.png +0 -0
- data/static/shoes-icon-blue.png +0 -0
- data/static/shoes-icon-brown.png +0 -0
- data/static/shoes-icon.png +0 -0
- metadata +366 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: bcbcba9d1c9969a08d30f3f2afef20d02ecc677e
|
|
4
|
+
data.tar.gz: 4c455368fa53653c7d1fb16e029625b8175ebcc0
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dee92066957d08625a5b0f785aa480d7596a4a33b1096a4a5203bcf83b36890c68215bd69cc82a7f748d233fa4766caace13944e8c0b1b9dddcdee2e17778dda
|
|
7
|
+
data.tar.gz: 5c231e8b80f0c5c0f93b1a4d44cf1702155b188c4fbc0c51e95137838689aeddd4043c24e9f66cbea0bbe00db58884f2f1ccc720867ab12f595ebb7e6ff1b294
|
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.
|
data/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# shoes-core
|
|
2
|
+
|
|
3
|
+
This is the primary, backend-agnostic implementation of shoes. This gem is
|
|
4
|
+
intended for use with any Shoes backend, and defines the interactions between
|
|
5
|
+
the DSL and the backend.
|
|
6
|
+
|
|
7
|
+
`shoes-core` is also responsible for installation of the main `shoes`
|
|
8
|
+
executable and `shoes-picker` executable for choosing a Shoes backend.
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/shoes
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# This script is symlinked to be present as both bin/shoes and bin/shoes-stub
|
|
4
|
+
# See ext/install/Rakefile for the full explanation of why we do that.
|
|
5
|
+
|
|
6
|
+
# Don't try to cd on an empty $NEXT_DIR (link in same directory)
|
|
7
|
+
mac_move_to_link_dir () {
|
|
8
|
+
# Skip if already in link directory
|
|
9
|
+
NEXT_DIR=$(dirname $1)
|
|
10
|
+
if [[ -n "$NEXT_DIR" ]]; then
|
|
11
|
+
cd $NEXT_DIR
|
|
12
|
+
fi
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
mac_readlink_f () {
|
|
16
|
+
# based on http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
|
|
17
|
+
|
|
18
|
+
# A relative or absolute path to a file, potentially a symlink
|
|
19
|
+
LINK=$1
|
|
20
|
+
|
|
21
|
+
if [ ! -L "$LINK" ] ; then
|
|
22
|
+
# Not a link, all good
|
|
23
|
+
echo $LINK
|
|
24
|
+
return
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# http://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/
|
|
28
|
+
unset CDPATH
|
|
29
|
+
|
|
30
|
+
# Look up links until we find something that is not a symlink
|
|
31
|
+
while [ -L "$LINK" ] ; do
|
|
32
|
+
mac_move_to_link_dir $LINK
|
|
33
|
+
RELATIVE_LINK=$(basename $LINK)
|
|
34
|
+
LINK=$(readlink $RELATIVE_LINK)
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
# Now PATH is an unqualified file name, but we're in its directory, so turn
|
|
38
|
+
# it into an absolute path by prefixing with the current working directory.
|
|
39
|
+
|
|
40
|
+
PHYS_DIR=`pwd -P`
|
|
41
|
+
RESULT=$PHYS_DIR/$LINK
|
|
42
|
+
echo $RESULT
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
case "${MACHTYPE:-}" in
|
|
46
|
+
(*darwin*)
|
|
47
|
+
SCRIPT=$(mac_readlink_f $0);;
|
|
48
|
+
(*)
|
|
49
|
+
# see http://stackoverflow.com/a/1638397/1810896
|
|
50
|
+
SCRIPT=$(readlink -f "$0");;
|
|
51
|
+
esac
|
|
52
|
+
|
|
53
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
54
|
+
|
|
55
|
+
BACKEND_FILE="$SCRIPTPATH/shoes-backend"
|
|
56
|
+
if [ ! -e "$BACKEND_FILE" ]
|
|
57
|
+
then
|
|
58
|
+
$SCRIPTPATH/shoes-picker $SCRIPTPATH
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
BACKEND_COMMAND=$(cat $BACKEND_FILE)
|
|
62
|
+
$BACKEND_COMMAND $@
|
data/bin/shoes-guard
ADDED
data/bin/shoes-picker
ADDED
data/bin/shoes-stub
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# This script is symlinked to be present as both bin/shoes and bin/shoes-stub
|
|
4
|
+
# See ext/install/Rakefile for the full explanation of why we do that.
|
|
5
|
+
|
|
6
|
+
# Don't try to cd on an empty $NEXT_DIR (link in same directory)
|
|
7
|
+
mac_move_to_link_dir () {
|
|
8
|
+
# Skip if already in link directory
|
|
9
|
+
NEXT_DIR=$(dirname $1)
|
|
10
|
+
if [[ -n "$NEXT_DIR" ]]; then
|
|
11
|
+
cd $NEXT_DIR
|
|
12
|
+
fi
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
mac_readlink_f () {
|
|
16
|
+
# based on http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
|
|
17
|
+
|
|
18
|
+
# A relative or absolute path to a file, potentially a symlink
|
|
19
|
+
LINK=$1
|
|
20
|
+
|
|
21
|
+
if [ ! -L "$LINK" ] ; then
|
|
22
|
+
# Not a link, all good
|
|
23
|
+
echo $LINK
|
|
24
|
+
return
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# http://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/
|
|
28
|
+
unset CDPATH
|
|
29
|
+
|
|
30
|
+
# Look up links until we find something that is not a symlink
|
|
31
|
+
while [ -L "$LINK" ] ; do
|
|
32
|
+
mac_move_to_link_dir $LINK
|
|
33
|
+
RELATIVE_LINK=$(basename $LINK)
|
|
34
|
+
LINK=$(readlink $RELATIVE_LINK)
|
|
35
|
+
done
|
|
36
|
+
|
|
37
|
+
# Now PATH is an unqualified file name, but we're in its directory, so turn
|
|
38
|
+
# it into an absolute path by prefixing with the current working directory.
|
|
39
|
+
|
|
40
|
+
PHYS_DIR=`pwd -P`
|
|
41
|
+
RESULT=$PHYS_DIR/$LINK
|
|
42
|
+
echo $RESULT
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
case "${MACHTYPE:-}" in
|
|
46
|
+
(*darwin*)
|
|
47
|
+
SCRIPT=$(mac_readlink_f $0);;
|
|
48
|
+
(*)
|
|
49
|
+
# see http://stackoverflow.com/a/1638397/1810896
|
|
50
|
+
SCRIPT=$(readlink -f "$0");;
|
|
51
|
+
esac
|
|
52
|
+
|
|
53
|
+
SCRIPTPATH=$(dirname "$SCRIPT")
|
|
54
|
+
|
|
55
|
+
BACKEND_FILE="$SCRIPTPATH/shoes-backend"
|
|
56
|
+
if [ ! -e "$BACKEND_FILE" ]
|
|
57
|
+
then
|
|
58
|
+
$SCRIPTPATH/shoes-picker $SCRIPTPATH
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
BACKEND_COMMAND=$(cat $BACKEND_FILE)
|
|
62
|
+
$BACKEND_COMMAND $@
|
|
@@ -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,15 @@
|
|
|
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
|
+
if not exist !bin_dir!\shoes-backend (
|
|
8
|
+
REM TODO: Can we get rid of jruby in some way here? My Windows box didn't
|
|
9
|
+
REM have a global ruby installed by just installing jruby :(
|
|
10
|
+
jruby --1.9 !bin_dir!\shoes-picker !bin_dir!
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
set /p command=<!bin_dir!/shoes-backend
|
|
14
|
+
call !command! %*
|
|
15
|
+
endlocal
|
|
Binary file
|
data/fonts/Lacuna.ttf
ADDED
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
|
|
4
|
+
# See ext/install/Rakefile for why this cleanup is our responsibility.
|
|
5
|
+
# Decide if user uninstalled executables based on our actual Ruby script.
|
|
6
|
+
Gem.post_uninstall do |gem|
|
|
7
|
+
uninstalling_shoes = gem.spec.name == "shoes"
|
|
8
|
+
missing_executable = !File.exist?(File.join(Gem.bindir, "shoes-picker")) &&
|
|
9
|
+
!File.exist?(File.join(Gem.bindir, "shoes-picker.bat"))
|
|
10
|
+
|
|
11
|
+
if uninstalling_shoes && missing_executable
|
|
12
|
+
puts "Removing shoes"
|
|
13
|
+
if Gem.win_platform?
|
|
14
|
+
FileUtils.rm(File.join(Gem.bindir, "shoes.bat"))
|
|
15
|
+
else
|
|
16
|
+
FileUtils.rm(File.join(Gem.bindir, "shoes"))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Everybody potentially has a generated backend file in their bin
|
|
20
|
+
puts "Removing shoes-backend"
|
|
21
|
+
backend = File.join(Gem.bindir, "shoes-backend")
|
|
22
|
+
FileUtils.rm(backend) if File.exists?(backend)
|
|
23
|
+
end
|
|
24
|
+
end
|
data/lib/shoes.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'shoes/core'
|
|
@@ -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 = @app.current_slot.create_bound_block(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
|
data/lib/shoes/app.rb
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
class Shoes
|
|
2
|
+
ICON = File.join(DIR, 'static/shoes-icon.png').freeze
|
|
3
|
+
|
|
4
|
+
# Instantiates a new Shoes app.
|
|
5
|
+
#
|
|
6
|
+
# @param opts [Hash] A hash of options used instantiate the Shoes::App object with.
|
|
7
|
+
# @param blk [Proc] The block containing the DSL instructions for the actual app.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Shoes.app(title: "Chunky") do
|
|
11
|
+
# para "Bacon is awesome!"
|
|
12
|
+
# end
|
|
13
|
+
#
|
|
14
|
+
# @return A new instance of Shoes::App
|
|
15
|
+
#
|
|
16
|
+
# @see Shoes::App#initialize
|
|
17
|
+
|
|
18
|
+
def self.app(opts = {}, &blk)
|
|
19
|
+
Shoes::App.new(opts, &blk)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# This is the user-facing App object. It is `self` inside of a Shoes.app
|
|
23
|
+
# block, and is the context in which a Shoes app is evaled. It delegates most
|
|
24
|
+
# of its functionality to an InternalApp object, which interacts with other
|
|
25
|
+
# Shoes objects. There should be no unnecessary instance variables or methods
|
|
26
|
+
# in this class, so users are free to use whatever names they choose for
|
|
27
|
+
# their own code.
|
|
28
|
+
class App
|
|
29
|
+
include DSL
|
|
30
|
+
include BuiltinMethods
|
|
31
|
+
include Common::Inspect
|
|
32
|
+
|
|
33
|
+
# Instantiates a new Shoes app.
|
|
34
|
+
#
|
|
35
|
+
# @param opts [Hash] The options to initialize the app with.
|
|
36
|
+
# @param blk [Proc] The block containing the DSL instructions to be executed within the app.
|
|
37
|
+
#
|
|
38
|
+
# @option opts [String] :title ("Shoes 4") The title of the window
|
|
39
|
+
# @option opts [Boolean] :resizable (true) Whether the window is resizable
|
|
40
|
+
# @option opts [Boolean] :fullscreen (false) Whether the app should start in fullscreen
|
|
41
|
+
# @option opts [Fixnum] :width (600) The width of the app window
|
|
42
|
+
# @option opts [Fixnum] :height (500) The height of the app window
|
|
43
|
+
#
|
|
44
|
+
# @see Dimension#initialize
|
|
45
|
+
def initialize(opts = {}, &blk)
|
|
46
|
+
@__app__ = Shoes::InternalApp.new(self, opts, &blk)
|
|
47
|
+
@__app__.setup_gui
|
|
48
|
+
Shoes.register self
|
|
49
|
+
@__app__.open_gui
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Shoes 3 exposes the app object like this, so we keep it for
|
|
53
|
+
# compatibility
|
|
54
|
+
def app
|
|
55
|
+
self
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def window(options = {}, &block)
|
|
59
|
+
options.merge! owner: self
|
|
60
|
+
self.class.new(options, &block)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def close
|
|
64
|
+
quit
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def quit
|
|
68
|
+
Shoes.unregister self
|
|
69
|
+
@__app__.quit
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def parent
|
|
73
|
+
@__app__.current_slot.parent
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
%w(
|
|
77
|
+
width height owner started? location left top absolute_left
|
|
78
|
+
absolute_top click release clear fullscreen fullscreen=
|
|
79
|
+
contents wait_until_closed
|
|
80
|
+
).each do |method|
|
|
81
|
+
define_method method do |*args, &block|
|
|
82
|
+
@__app__.public_send method, *args, &block
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
alias_method :fullscreen?, :fullscreen
|
|
87
|
+
|
|
88
|
+
def to_s
|
|
89
|
+
super.insert(-2, " \"#{@__app__.app_title}\"")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def inspect
|
|
93
|
+
super.insert(-2, " \"#{@__app__.app_title}\")")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def eval_with_additional_context(context, &blk)
|
|
97
|
+
@__additional_context__ = context
|
|
98
|
+
instance_eval(&blk) if blk
|
|
99
|
+
ensure
|
|
100
|
+
@__additional_context__ = nil
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def method_missing(name, *args, &blk)
|
|
104
|
+
if @__additional_context__
|
|
105
|
+
@__additional_context__.public_send(name, *args, &blk)
|
|
106
|
+
else
|
|
107
|
+
super
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
DELEGATE_BLACKLIST = [:parent, :app]
|
|
112
|
+
|
|
113
|
+
# class definitions are evaluated top to bottom, want to have all of them
|
|
114
|
+
# so define at bottom
|
|
115
|
+
DELEGATE_METHODS = ((Shoes::App.public_instance_methods(false) +
|
|
116
|
+
Shoes::DSL.public_instance_methods) - DELEGATE_BLACKLIST).freeze
|
|
117
|
+
|
|
118
|
+
def self.subscribe_to_dsl_methods(klazz)
|
|
119
|
+
klazz.extend Forwardable unless klazz.is_a? Forwardable
|
|
120
|
+
klazz.def_delegators :app, *DELEGATE_METHODS
|
|
121
|
+
@method_subscribers ||= []
|
|
122
|
+
@method_subscribers << klazz
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def self.new_dsl_method(name, &blk)
|
|
126
|
+
define_method name, blk
|
|
127
|
+
@method_subscribers.each { |klazz| klazz.def_delegator :app, name }
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|