epall-limelight 0.5.1-java → 0.5.2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/init.rb +2 -6
- data/lib/limelight.jar +0 -0
- data/lib/limelight/builtin/utilities_production/alert/players/alert.rb +4 -1
- data/lib/limelight/builtin/utilities_production/production.rb +6 -2
- data/lib/limelight/commands/create_command.rb +1 -1
- data/lib/limelight/commands/open_command.rb +4 -4
- data/lib/limelight/dsl/styles_builder.rb +5 -0
- data/lib/limelight/java_couplings.rb +3 -2
- data/lib/limelight/limelight_init.rb +12 -0
- data/lib/limelight/main.rb +43 -46
- data/lib/limelight/producer.rb +54 -13
- data/lib/limelight/production.rb +34 -7
- data/lib/limelight/scene.rb +1 -1
- data/lib/limelight/specs/spec_helper.rb +1 -1
- data/lib/limelight/specs/test_scene_opener.rb +3 -0
- data/lib/limelight/stage.rb +65 -5
- data/lib/limelight/studio.rb +28 -159
- data/lib/limelight/styles/style.rb +288 -0
- data/lib/limelight/theater.rb +27 -2
- data/lib/limelight/version.rb +2 -2
- data/productions/examples/sandbox/alerts/players/alerts.rb +1 -1
- data/productions/examples/sandbox/stage_handles/players/sizer.rb +3 -0
- data/spec/limelight/builtin/players/combo_box_spec.rb +1 -1
- data/spec/limelight/builtin/players/radio_button_spec.rb +1 -1
- data/spec/limelight/builtin/utilities_production/utilities_production_spec.rb +39 -38
- data/spec/limelight/casting_director_spec.rb +1 -1
- data/spec/limelight/commands/create_command_spec.rb +4 -4
- data/spec/limelight/commands/open_command_spec.rb +5 -4
- data/spec/limelight/commands/pack_command_spec.rb +1 -1
- data/spec/limelight/commands/unpack_command_spec.rb +1 -1
- data/spec/limelight/dsl/prop_builder_spec.rb +6 -6
- data/spec/limelight/dsl/stage_builder_spec.rb +1 -1
- data/spec/limelight/file_chooser_spec.rb +1 -1
- data/spec/limelight/file_filter_spec.rb +2 -2
- data/spec/limelight/main_spec.rb +2 -2
- data/spec/limelight/paint_action_spec.rb +1 -1
- data/spec/limelight/pen_spec.rb +1 -1
- data/spec/limelight/producer_spec.rb +30 -11
- data/spec/limelight/production_spec.rb +12 -20
- data/spec/limelight/prop_spec.rb +2 -2
- data/spec/limelight/scene_spec.rb +1 -1
- data/spec/limelight/stage_spec.rb +51 -6
- data/spec/limelight/templates/templater_spec.rb +1 -1
- data/spec/limelight/theater_spec.rb +49 -1
- data/spec/spec_helper.rb +0 -6
- metadata +5 -7
- data/lib/limelight/client/playbills.rb +0 -86
- data/lib/limelight/styles.rb +0 -347
- data/spec/limelight/client/playbills_spec.rb +0 -79
- data/spec/limelight/studio_spec.rb +0 -157
data/lib/init.rb
CHANGED
@@ -1,16 +1,12 @@
|
|
1
1
|
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
|
-
|
5
|
-
$: << $LIMELIGHT_LIB unless $:.include?($LIMELIGHT_LIB)
|
6
|
-
$LIMELIGHT_HOME = File.expand_path(File.join($LIMELIGHT_LIB, ".."))
|
4
|
+
|
7
5
|
|
8
6
|
require 'java'
|
9
7
|
if File.exists?(File.dirname(__FILE__) + "/limelight.jar")
|
10
8
|
require File.expand_path(File.dirname(__FILE__) + "/limelight.jar")
|
11
9
|
end
|
12
10
|
|
11
|
+
require File.expand_path(File.dirname(__FILE__) + "/limelight/limelight_init")
|
13
12
|
|
14
|
-
# ENV["GEM_HOME"] = ENV["GEM_PATH"] = File.expand_path(File.dirname(__FILE__) + "/../../jruby/lib/ruby/gems/1.8")
|
15
|
-
require 'rubygems'
|
16
|
-
require 'limelight/java_couplings'
|
data/lib/limelight.jar
CHANGED
Binary file
|
@@ -3,13 +3,17 @@
|
|
3
3
|
|
4
4
|
require 'monitor'
|
5
5
|
|
6
|
-
module Production
|
6
|
+
module Production #:nodoc:
|
7
7
|
|
8
8
|
def production_opening
|
9
9
|
@monitor = Monitor.new
|
10
10
|
@alert_monitor = @monitor.new_cond
|
11
11
|
end
|
12
12
|
|
13
|
+
def allow_close?
|
14
|
+
return false
|
15
|
+
end
|
16
|
+
|
13
17
|
def default_scene
|
14
18
|
nil
|
15
19
|
end
|
@@ -40,7 +44,7 @@ module Production
|
|
40
44
|
|
41
45
|
def alert(message)
|
42
46
|
@alert_monitor = @monitor.new_cond
|
43
|
-
load_alert_scene(message)
|
47
|
+
load_alert_scene(message.to_s)
|
44
48
|
@monitor.synchronize{ @alert_monitor.wait }
|
45
49
|
@alert_stage.close
|
46
50
|
return @alert_response
|
@@ -53,7 +53,7 @@ module Limelight
|
|
53
53
|
raise "Missing template type" if @template_type.nil?
|
54
54
|
raise "Unknown template type: #{@template_type}" if !["production", "scene"].include?(@template_type)
|
55
55
|
self.send "parse_#{@template_type}".to_sym, args
|
56
|
-
@spec_path =
|
56
|
+
@spec_path = "spec" unless @spec_path
|
57
57
|
end
|
58
58
|
|
59
59
|
def do_requires #:nodoc:
|
@@ -18,7 +18,7 @@ module Limelight
|
|
18
18
|
|
19
19
|
install_as "open"
|
20
20
|
|
21
|
-
DEFAULT_PRODUCTION = File.expand_path($LIMELIGHT_HOME + "/productions/
|
21
|
+
DEFAULT_PRODUCTION = File.expand_path($LIMELIGHT_HOME + "/productions/playbills.lll")
|
22
22
|
|
23
23
|
attr_reader :drb_port
|
24
24
|
|
@@ -36,7 +36,7 @@ module Limelight
|
|
36
36
|
return "<production_path>"
|
37
37
|
end
|
38
38
|
|
39
|
-
def do_requires
|
39
|
+
def do_requires
|
40
40
|
Main.initialize_context
|
41
41
|
require 'limelight/producer'
|
42
42
|
end
|
@@ -50,8 +50,8 @@ module Limelight
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def process
|
53
|
-
|
54
|
-
|
53
|
+
Context.instance.studio.publish_on_drb(@drb_port.to_i) if @drb_port
|
54
|
+
Context.instance.studio.open(@production_path)
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
@@ -143,6 +143,11 @@ module Limelight
|
|
143
143
|
raise StyleBuilderException.new("'#{sym}' is not a valid style") if !@__style.respond_to?(setter_sym)
|
144
144
|
@__style.send(setter_sym, value.to_s)
|
145
145
|
end
|
146
|
+
|
147
|
+
# Kernel.y was added by the yaml library in JRuby 1.4. Not sure what to do about this type of problem.
|
148
|
+
def y(*args) #:nodoc:
|
149
|
+
method_missing(:y, *args)
|
150
|
+
end
|
146
151
|
end
|
147
152
|
|
148
153
|
# Exception thrown by StyleBuilder when an error is encountered.
|
@@ -1,11 +1,12 @@
|
|
1
1
|
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
|
-
module Limelight
|
4
|
+
module Limelight
|
5
5
|
|
6
6
|
Main = Java::limelight.Main
|
7
7
|
ResourceLoader = Java::limelight.ResourceLoader
|
8
8
|
Context = Java::limelight.Context
|
9
|
+
Studio = Java::limelight.Studio
|
9
10
|
|
10
11
|
module Background
|
11
12
|
Animation = Java::limelight.background.Animation
|
@@ -50,7 +51,7 @@ module Limelight #:nodoc:
|
|
50
51
|
Prop = Java::limelight.ui.api.Prop
|
51
52
|
Stage = Java::limelight.ui.api.Stage
|
52
53
|
Theater = Java::limelight.ui.api.Theater
|
53
|
-
|
54
|
+
Production = Java::limelight.ui.api.Production
|
54
55
|
end
|
55
56
|
|
56
57
|
module Painting #:nodoc:
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#- Copyright � 2008-2009 8th Light, Inc. All Rights Reserved.
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
|
+
|
4
|
+
$LIMELIGHT_LIB = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
5
|
+
$: << $LIMELIGHT_LIB unless $:.include?($LIMELIGHT_LIB)
|
6
|
+
$LIMELIGHT_HOME = File.expand_path(File.join($LIMELIGHT_LIB, ".."))
|
7
|
+
|
8
|
+
if Java::java.lang.System.getProperty("limelight.home").nil?
|
9
|
+
Java::java.lang.System.setProperty("limelight.home", $LIMELIGHT_HOME)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'limelight/java_couplings'
|
data/lib/limelight/main.rb
CHANGED
@@ -5,31 +5,59 @@ require 'limelight/commands/command'
|
|
5
5
|
|
6
6
|
module Limelight
|
7
7
|
|
8
|
-
#
|
8
|
+
# Limelight::Main is used, when installed as a gem, to work with Limelight production. It provides
|
9
|
+
# a handful of utilities to create, bundle, and develop with Limelight.
|
9
10
|
#
|
10
|
-
#
|
11
|
+
# For example, running the following command will generate a new Limelight production for you.
|
11
12
|
#
|
12
|
-
#
|
13
|
+
# jruby -S limelight create production <production name>
|
13
14
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# | - <player_name>.rb
|
19
|
-
# | - *
|
15
|
+
# Assuming you used "sandbox" as the name or your production, you'd end up with the following directory structure
|
16
|
+
# generated for you.
|
17
|
+
#
|
18
|
+
# - sandbox
|
20
19
|
# | - stages.rb
|
20
|
+
# | - styles.rb
|
21
21
|
# | - production.rb
|
22
|
+
# | - default_scene
|
23
|
+
# | - props.rb
|
24
|
+
# | - styles.rb
|
25
|
+
# | - players
|
26
|
+
# | - <player_name>.rb
|
27
|
+
# | - spec
|
28
|
+
# | - spec_helper.rb
|
29
|
+
# | - default_scene
|
30
|
+
# | - default_scene_spec.rb
|
22
31
|
#
|
23
|
-
# In
|
24
|
-
#
|
32
|
+
# In this case, you've just created a production called "Sandbox". By convention, the name of the production matches the name of the root directory.
|
33
|
+
# Notice that there are 3 files and 2 directories. Let's start by talking about the files.
|
34
|
+
#
|
35
|
+
# == stages.rb
|
36
|
+
# This file uses a DSL to configure the stages that will be used in the production.
|
37
|
+
# See Limelight::StagesBuilder
|
38
|
+
#
|
39
|
+
# == styles.rb
|
40
|
+
# This file defines production level styles. Each scene may have their own styles but styles defined here will be avaiable to all scenes.
|
41
|
+
# See Limelight::StylesBuilder
|
42
|
+
#
|
43
|
+
# == production.rb
|
44
|
+
# This file defines a module names Production where you can defined hooks and behavior for your production.
|
45
|
+
# See Limelight::Production
|
46
|
+
#
|
47
|
+
# For the most part, each directory inside the root directory is a scene. This production has one scene named "default_scene" (this is the default name).
|
48
|
+
# Each scene starts out containing 2 file and a directory. Let's look at those..
|
25
49
|
#
|
26
50
|
# == props.rb
|
27
|
-
# This file defines the
|
51
|
+
# This file defines the structure of your scene. Scenes are composed of Props. In this file you use the Prop DSL to
|
52
|
+
# specify all the components of your scene.
|
28
53
|
# See Limelight::PropBuilder
|
54
|
+
# See Limelight::Prop
|
29
55
|
#
|
30
56
|
# == styles.rb
|
31
|
-
#
|
57
|
+
# Similar to the styles.rb file located in the root directory, this file contains definitions of styles. However,
|
58
|
+
# all styles defined here are only available to the containgin scene. Styles define the look and feel of your scenes.
|
32
59
|
# See Limelight::StylesBuilder
|
60
|
+
# See Limelight::Style
|
33
61
|
#
|
34
62
|
# == players
|
35
63
|
# A directory containing all the players used in the scene. Players are modules that are included by Prop objects.
|
@@ -37,40 +65,9 @@ module Limelight
|
|
37
65
|
# Inside 'wall.rb' you would define a module named 'Wall'. All behavior defined in the Wall modules will automatically be included
|
38
66
|
# in every prop named 'wall'.
|
39
67
|
#
|
40
|
-
#
|
41
|
-
# This file uses a DSL to configure the stages that will be used in the production.
|
42
|
-
# See Limelight::StagesBuilder
|
43
|
-
#
|
44
|
-
# == production.rb
|
45
|
-
# This file uses a DSL to configure the current Production.
|
46
|
-
# See Limelight::ProductionBuilder
|
47
|
-
#
|
48
|
-
# Multiple-Scene Production Directory Structure:
|
49
|
-
#
|
50
|
-
# - sandbox
|
51
|
-
# | - stages.rb
|
52
|
-
# | - production.rb
|
53
|
-
# | - styles.rb
|
54
|
-
# | - players
|
55
|
-
# | - <player_name>.rb
|
56
|
-
# | - fader
|
57
|
-
# | - props.rb
|
58
|
-
# | - styles.rb
|
59
|
-
# | - players
|
60
|
-
# | - <player_name>.rb
|
61
|
-
# | - floater
|
62
|
-
# | - props.rb
|
63
|
-
# | - styles.rb
|
64
|
-
# | - players
|
65
|
-
# | - <player_name>.rb
|
66
|
-
#
|
67
|
-
# In a Multiple-Scene production, the production acquires that name of the root directory. In this case the production is named 'sandbox'.
|
68
|
-
# Each directory inside the root directory is a scene. This production has two scenes named 'fader' and 'floater'. Each scene is structured
|
69
|
-
# the same as in a Single-Scene production with the exception of the 'stages.rb' file. This file is specific to the production. The production
|
70
|
-
# may contain a 'styles.rb' which contains styles used by multiple scenes. If some players are used in multiple Scenes, then it is useful to
|
71
|
-
# to create a players directory in the Production root to hold the common players. Other files may exist in the directory structure and they will not
|
72
|
-
# conflict with Limelight.
|
68
|
+
# So there's a brief overview for you. Besure to check out the Limelight Docs production. You can find it by installing Limelight and starting it up.
|
73
69
|
#
|
70
|
+
# For more info on available commands:
|
74
71
|
# See Limelight::Commands
|
75
72
|
#
|
76
73
|
class Main
|
data/lib/limelight/producer.rb
CHANGED
@@ -23,15 +23,27 @@ module Limelight
|
|
23
23
|
#
|
24
24
|
class Producer
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
class << self
|
27
|
+
# Creates a new Producer and has it open a Production by specified name.
|
28
|
+
#
|
29
|
+
def open(production_name, options={})
|
30
|
+
producer = new(production_name)
|
31
|
+
begin
|
32
|
+
producer.open(options)
|
33
|
+
rescue Exception => e
|
34
|
+
puts e
|
35
|
+
puts e.backtrace
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns a hash of all the built-in Limglight Styles
|
40
|
+
#
|
41
|
+
def builtin_styles
|
42
|
+
unless @builtin_styles
|
43
|
+
builtin_styles_file = File.join($LIMELIGHT_LIB, "limelight", "builtin", "styles.rb")
|
44
|
+
@builtin_styles = Limelight.build_styles_from_file(builtin_styles_file)
|
45
|
+
end
|
46
|
+
return @builtin_styles
|
35
47
|
end
|
36
48
|
end
|
37
49
|
|
@@ -50,7 +62,7 @@ module Limelight
|
|
50
62
|
root_path = unpack_production(root_path)
|
51
63
|
end
|
52
64
|
@production = production || Production.new(root_path)
|
53
|
-
@theater = theater.nil? ? Theater.new : theater
|
65
|
+
@theater = theater.nil? ? Theater.new(@production) : theater
|
54
66
|
establish_production
|
55
67
|
end
|
56
68
|
|
@@ -77,15 +89,23 @@ module Limelight
|
|
77
89
|
load_stages if File.exists?(@production.stages_file)
|
78
90
|
end
|
79
91
|
|
92
|
+
# Returns true if the production is compatible with the current version of Limelight or if the user proceeds
|
93
|
+
# despite the incompatible warning.
|
94
|
+
#
|
95
|
+
def can_proceed_with_compatibility?
|
96
|
+
return true if version_compatible?
|
97
|
+
return true if Context.instance.studio.utilities_production.should_proceed_with_incompatible_version(@production.name, @production.minimum_limelight_version)
|
98
|
+
return false
|
99
|
+
end
|
100
|
+
|
80
101
|
# Opens the Production.
|
81
102
|
#
|
82
103
|
def open(options = {})
|
83
|
-
return unless version_compatible? || Studio.utilities_production.proceed_with_incompatible_version?(@production.name, @production.minimum_limelight_version)
|
84
104
|
@production.production_opening
|
85
105
|
load
|
86
106
|
@production.production_loaded
|
87
107
|
if @theater.has_stages?
|
88
|
-
@theater.stages.each do |stage|
|
108
|
+
@theater.stages.each do |stage|
|
89
109
|
open_scene(stage.default_scene.to_s, stage) if stage.default_scene
|
90
110
|
end
|
91
111
|
elsif @production.default_scene
|
@@ -144,12 +164,33 @@ module Limelight
|
|
144
164
|
# Loads the specified 'styles.rb' file and created a Hash of Styles.
|
145
165
|
#
|
146
166
|
def load_styles(context)
|
147
|
-
extendable_styles =
|
167
|
+
extendable_styles = Producer.builtin_styles.merge(@production.root_styles)
|
148
168
|
return extendable_styles.dup if not File.exists?(context.styles_file)
|
149
169
|
new_styles = Limelight.build_styles_from_file(context.styles_file, extendable_styles)
|
150
170
|
return extendable_styles.merge(new_styles)
|
151
171
|
end
|
152
172
|
|
173
|
+
# Closes the specified production. The producer will trigger the hook, production_closing and production_closed,
|
174
|
+
# to keep the production aware of it's status. The Studio will also be informed of the closure. If no
|
175
|
+
# production remain opened, then the Limelight runtine will exit.
|
176
|
+
#
|
177
|
+
def close(production)
|
178
|
+
return if production.closed?
|
179
|
+
production.closed = true
|
180
|
+
return Thread.new do
|
181
|
+
begin
|
182
|
+
Thread.pass
|
183
|
+
production.production_closing
|
184
|
+
production.theater.close
|
185
|
+
production.production_closed
|
186
|
+
Context.instance.studio.production_closed(production)
|
187
|
+
rescue StandardError => e
|
188
|
+
puts e
|
189
|
+
puts e.backtrace
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
153
194
|
def establish_production #:nodoc:
|
154
195
|
@production.producer = self
|
155
196
|
@production.theater = @theater
|
data/lib/limelight/production.rb
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
|
4
4
|
require 'limelight/limelight_exception'
|
5
5
|
require 'limelight/file_loader'
|
6
|
-
require 'limelight/
|
6
|
+
require 'limelight/dsl/styles_builder'
|
7
7
|
require 'drb'
|
8
8
|
|
9
|
+
|
9
10
|
module Limelight
|
10
11
|
|
11
12
|
# The root object of Limelight Production. Every Prop in a production has access to its Production object.
|
@@ -15,6 +16,8 @@ module Limelight
|
|
15
16
|
#
|
16
17
|
class Production
|
17
18
|
|
19
|
+
include UI::Api::Production
|
20
|
+
|
18
21
|
class << self
|
19
22
|
|
20
23
|
def [](name) #:nodoc:
|
@@ -25,6 +28,8 @@ module Limelight
|
|
25
28
|
|
26
29
|
attr_reader :name, :root
|
27
30
|
attr_accessor :producer, :theater
|
31
|
+
attr_accessor :closed #:nodoc:
|
32
|
+
|
28
33
|
|
29
34
|
# Users typically need not create Production objects.
|
30
35
|
#
|
@@ -36,7 +41,7 @@ module Limelight
|
|
36
41
|
# Sets the name of the Production. The name must be unique amongst all Productions in memory.
|
37
42
|
#
|
38
43
|
def name=(value)
|
39
|
-
|
44
|
+
Context.instance.studio.error_if_duplicate_name(value)
|
40
45
|
@name = value
|
41
46
|
end
|
42
47
|
|
@@ -75,7 +80,7 @@ module Limelight
|
|
75
80
|
def gems_directory
|
76
81
|
return @root.path_to("__resources/gems/gems")
|
77
82
|
end
|
78
|
-
|
83
|
+
|
79
84
|
# Returns the path to the productions gems root
|
80
85
|
#
|
81
86
|
def gems_root
|
@@ -86,7 +91,7 @@ module Limelight
|
|
86
91
|
#
|
87
92
|
def scene_directory(name)
|
88
93
|
return @root.root if name == :root
|
89
|
-
|
94
|
+
return @root.path_to(name)
|
90
95
|
end
|
91
96
|
|
92
97
|
# Returns the minimum version of limelight required to run this production. Default: "0.0.0"
|
@@ -135,12 +140,24 @@ module Limelight
|
|
135
140
|
def production_closed
|
136
141
|
end
|
137
142
|
|
143
|
+
# returns true if the production has been closed.
|
144
|
+
#
|
145
|
+
def closed?
|
146
|
+
return @closed
|
147
|
+
end
|
148
|
+
|
138
149
|
# Closes the production. If there are no more productions open, the Limelight runtime will shutdown.
|
150
|
+
# The production will actually delegate to it's producer and the producer will close the production down.
|
139
151
|
#
|
140
152
|
def close
|
141
|
-
self
|
142
|
-
|
143
|
-
|
153
|
+
@producer.close(self)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Called when the last stage in this production's theater is closed. If the allow_close? returns true
|
157
|
+
# this production will be closed.
|
158
|
+
#
|
159
|
+
def theater_empty!
|
160
|
+
close if allow_close? && !closed?
|
144
161
|
end
|
145
162
|
|
146
163
|
# Returned the name of the default scene. This is only used when there are not stages defined in the production.
|
@@ -164,6 +181,16 @@ module Limelight
|
|
164
181
|
return @root_styles
|
165
182
|
end
|
166
183
|
|
184
|
+
alias :getName :name #:nodoc:
|
185
|
+
alias :setName :name= #:nodoc:
|
186
|
+
alias :allowClose :allow_close? #:nodoc:
|
187
|
+
|
188
|
+
def callMethod(name, java_obj_array) #:nodoc:
|
189
|
+
args = []
|
190
|
+
java_obj_array.length.times { |i| args << java_obj_array[i] }
|
191
|
+
send(name.to_sym, *args)
|
192
|
+
end
|
193
|
+
|
167
194
|
end
|
168
195
|
|
169
196
|
end
|