limelight 0.5.0-java → 0.5.1-java

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.
@@ -15,7 +15,8 @@ module Limelight
15
15
  #
16
16
  attr_reader :active_stage
17
17
 
18
- def initialize
18
+ def initialize(production)
19
+ @production = production
19
20
  @stages = {}
20
21
  end
21
22
 
@@ -57,6 +58,7 @@ module Limelight
57
58
  def stage_closed(stage)
58
59
  @stages.delete(stage.name)
59
60
  @active_stage = nil if @active_stage == stage
61
+ @production.theater_empty! if @stages.empty?
60
62
  end
61
63
 
62
64
  # If no Stages are added, the Theater will provide a default Stage named "Limelight".
@@ -66,6 +68,14 @@ module Limelight
66
68
  return self["Limelight"]
67
69
  end
68
70
 
71
+ # Close this theater. All stages in this theater will be closed and the active_stage will be nil'ed.
72
+ #
73
+ def close
74
+ @stages.values.each { |stage| stage.close }
75
+ @stages.clear
76
+ @active_stage = nil
77
+ end
78
+
69
79
  protected #############################################
70
80
 
71
81
  def build_stage(name, options)
@@ -6,7 +6,7 @@ module Limelight
6
6
  unless defined? MAJOR
7
7
  MAJOR = 0
8
8
  MINOR = 5
9
- TINY = 0
9
+ TINY = 1
10
10
 
11
11
  STRING = [MAJOR, MINOR, TINY].join('.')
12
12
  TAG = "REL_" + [MAJOR, MINOR, TINY].join('_')
@@ -11,7 +11,7 @@ module Alerts
11
11
 
12
12
  def open_incompatible_production
13
13
  production_path = File.join(path, "incompatible_production")
14
- Thread.new { Limelight::Studio.open(production_path) }
14
+ Thread.new { Limelight::Context.instance.studio.open(production_path) }
15
15
  end
16
16
 
17
17
  end
@@ -5,9 +5,10 @@ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
5
5
 
6
6
  describe "Utilitites Production" do
7
7
 
8
- uses_scene "none"
8
+ uses_limelight
9
9
 
10
10
  before(:each) do
11
+ @result = nil
11
12
  production.production_opening
12
13
  end
13
14
 
@@ -17,8 +18,43 @@ describe "Utilitites Production" do
17
18
  end
18
19
 
19
20
  after(:all) do
20
- # Java::java.awt.Frame.getFrames.each { |frame| frame.close; frame.dispose; puts frame }
21
- # Java::limelight.util.Threads.showAll
21
+ # Java::java.awt.Frame.getFrames.each { |frame| frame.close; frame.dispose; puts frame }
22
+ # Java::limelight.util.Threads.showAll
23
+ end
24
+
25
+ def start_alert()
26
+ @thread = Thread.new do
27
+ begin
28
+ @result = production.alert("Some Message")
29
+ rescue Exception => e
30
+ puts e
31
+ puts e.backtrace
32
+ end
33
+ end
34
+ end
35
+
36
+ def start_proceed_with_incompatible_version()
37
+ @thread = Thread.new do
38
+ begin
39
+ @result = production.proceed_with_incompatible_version?("Some Production", "1.2.3")
40
+ rescue Exception => e
41
+ puts e
42
+ puts e.backtrace
43
+ end
44
+ end
45
+ end
46
+
47
+ def wait_for
48
+ 10.times do
49
+ return if yield
50
+ sleep(0.1)
51
+ end
52
+ raise "the desired condition was not met on time"
53
+ end
54
+
55
+ def scene_open?(stage_name)
56
+ stage = production.theater[stage_name]
57
+ return stage != nil && stage.current_scene != nil
22
58
  end
23
59
 
24
60
  it "should construct stage on load_with_incomptible_version_scene" do
@@ -51,30 +87,6 @@ describe "Utilitites Production" do
51
87
  scene.find("current_version_label").text.should == Limelight::VERSION::STRING
52
88
  end
53
89
 
54
- def start_proceed_with_incompatible_version()
55
- @thread = Thread.new do
56
- begin
57
- @result = production.proceed_with_incompatible_version?("Some Production", "1.2.3")
58
- rescue Exception => e
59
- puts e
60
- puts e.backtrace
61
- end
62
- end
63
- end
64
-
65
- def wait_for
66
- 10.times do
67
- return if yield
68
- sleep(0.1)
69
- end
70
- raise "the desired condition was not met on time"
71
- end
72
-
73
- def scene_open?(stage_name)
74
- stage = production.theater[stage_name]
75
- return stage != nil && stage.current_scene != nil
76
- end
77
-
78
90
  it "should return true when clicking proceed" do
79
91
  @result = nil
80
92
  start_proceed_with_incompatible_version()
@@ -99,17 +111,6 @@ describe "Utilitites Production" do
99
111
  @result.should == false
100
112
  end
101
113
 
102
- def start_alert()
103
- @thread = Thread.new do
104
- begin
105
- @result = production.alert("Some Message")
106
- rescue Exception => e
107
- puts e
108
- puts e.backtrace
109
- end
110
- end
111
- end
112
-
113
114
  it "should construct alert stage" do
114
115
  production.load_alert_scene("Some Message")
115
116
  stage = production.theater["Alert"]
@@ -60,7 +60,7 @@ describe Limelight::Commands::CreateCommand do
60
60
  @command.scene_name.should == "default_scene"
61
61
  @command.template_type.should == "production"
62
62
  @command.production_path.should == "blah"
63
- @command.spec_path.should == "blah/spec"
63
+ @command.spec_path.should == "spec"
64
64
  end
65
65
 
66
66
  it "should have a default production path" do
@@ -8,6 +8,7 @@ require 'limelight/producer'
8
8
  describe Limelight::Commands::OpenCommand do
9
9
 
10
10
  before(:all) do
11
+ @studio = Limelight::Studio.install
11
12
  @command_class = Limelight::Commands::OpenCommand
12
13
  @command = @command_class.new
13
14
  end
@@ -18,14 +19,14 @@ describe Limelight::Commands::OpenCommand do
18
19
 
19
20
  it "should open a production" do
20
21
  Limelight::Main.should_receive(:initialize_context)
21
- Limelight::Studio.should_receive(:open).with("production_name")
22
+ @studio.should_receive(:open).with("production_name")
22
23
 
23
24
  @command.run(["production_name"])
24
25
  end
25
26
 
26
27
  it "should open the default production" do
27
28
  Limelight::Main.should_receive(:initialize_context)
28
- Limelight::Studio.should_receive(:open).with(@command_class::DEFAULT_PRODUCTION)
29
+ @studio.should_receive(:open).with(@command_class::DEFAULT_PRODUCTION)
29
30
 
30
31
  @command.run([])
31
32
  end
@@ -43,8 +44,8 @@ describe Limelight::Commands::OpenCommand do
43
44
 
44
45
  it "should start the studio on drb" do
45
46
  Limelight::Main.should_receive(:initialize_context)
46
- Limelight::Studio.should_receive(:publish_on_drb).with(1234)
47
- Limelight::Studio.should_receive(:open).with("some_prod")
47
+ @studio.should_receive(:publish_on_drb).with(1234)
48
+ @studio.should_receive(:open).with("some_prod")
48
49
 
49
50
  @command.run ["-d", "1234", "some_prod"]
50
51
  end
@@ -8,7 +8,7 @@ require 'limelight/theater'
8
8
  describe Limelight::DSL::StageBuilder do
9
9
 
10
10
  before(:each) do
11
- @theater = Limelight::Theater.new
11
+ @theater = Limelight::Theater.new(nil)
12
12
  end
13
13
 
14
14
  it "should give no stages if empty" do
@@ -8,9 +8,10 @@ describe Limelight::Producer do
8
8
 
9
9
  before(:each) do
10
10
  TestDir.clean
11
- Limelight::Studio.reset
11
+ Limelight::Studio.uninstall
12
12
  @root_dir = TestDir.path("test_prod")
13
13
  @producer = Limelight::Producer.new(@root_dir)
14
+ Limelight::Studio.install
14
15
  end
15
16
 
16
17
  it "should have loader on creation" do
@@ -52,7 +53,7 @@ describe Limelight::Producer do
52
53
 
53
54
  it "should load styles" do
54
55
  TestDir.create_file("test_prod/styles.rb", "alpha { width 100 }")
55
- Limelight::Studio.stub!(:builtin_styles).and_return({})
56
+ Limelight::Producer.stub!(:builtin_styles).and_return({})
56
57
 
57
58
  styles = @producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod")))
58
59
  styles.size.should == 1
@@ -142,7 +143,7 @@ describe Limelight::Producer do
142
143
  end
143
144
 
144
145
  it "should load empty styles if styles.rb doesn't exist" do
145
- Limelight::Studio.stub!(:builtin_styles).and_return({})
146
+ Limelight::Producer.stub!(:builtin_styles).and_return({})
146
147
 
147
148
  @producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod"))).should == {}
148
149
  end
@@ -207,4 +208,9 @@ describe Limelight::Producer do
207
208
  @producer.open_scene("name", stage, :instance_variables => { :foo => "bar" })
208
209
  end
209
210
 
211
+ it "should give the same buildin_styles hash twice" do
212
+ Limelight::Producer.builtin_styles.should be(Limelight::Producer.builtin_styles)
213
+ Limelight::Producer.builtin_styles["limelight_builtin_players_curtains"].should_not == nil
214
+ end
215
+
210
216
  end
@@ -9,6 +9,7 @@ describe Limelight::Production, "Instance methods" do
9
9
  before(:each) do
10
10
  @producer = make_mock("producer")
11
11
  @theater = make_mock("theater")
12
+ @studio = Limelight::Studio.install
12
13
  @production = Limelight::Production.new("/tmp")
13
14
  @production.producer = @producer
14
15
  @production.theater = @theater
@@ -20,20 +21,6 @@ describe Limelight::Production, "Instance methods" do
20
21
  @production.path.should == "/tmp"
21
22
  end
22
23
 
23
- it "should be indexed" do
24
- Limelight::Studio.index(@production)
25
- Limelight::Studio[@production.name].should == @production
26
- end
27
-
28
- it "should raise an error when setting the name to a duplicate name" do
29
- @production.name = "Bill"
30
- Limelight::Studio.index(@production)
31
-
32
- production = Limelight::Production.new("/tmp")
33
- Limelight::Studio.index(production)
34
- lambda { production.name = "Bill" }.should raise_error(Limelight::LimelightException, "Production name 'Bill' is already taken")
35
- end
36
-
37
24
  it "should get it's name from the file" do
38
25
  Limelight::Production.new("/tmp").name.should == "tmp"
39
26
  Limelight::Production.new("/Somewhere/over/the/rainbow").name.should == "rainbow"
@@ -72,12 +59,20 @@ describe Limelight::Production, "Instance methods" do
72
59
 
73
60
  it "should tell studio it closed and triger it's closing events" do
74
61
  @production.should_receive(:production_closing)
75
- Limelight::Studio.should_receive(:production_closed).with(@production)
62
+ @studio.should_receive(:production_closed).with(@production)
76
63
  @production.should_receive(:production_closed)
64
+ @theater.should_receive(:close)
77
65
 
78
66
  @production.close
79
67
  end
80
68
 
69
+ it "should handle empty theater" do
70
+ @production.should_receive(:allow_close?).at_least(1).and_return(true)
71
+ @production.should_receive(:close)
72
+
73
+ @production.theater_empty!
74
+ end
75
+
81
76
  describe "with files" do
82
77
 
83
78
  after(:each) do
@@ -5,12 +5,12 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/stage'
6
6
  require 'limelight/scene'
7
7
  require 'limelight/theater'
8
- require 'limelight/studio'
9
8
 
10
9
  describe Limelight::Stage do
11
10
 
12
11
  before(:each) do
13
- @theater = Limelight::Theater.new
12
+ @production = mock("production")
13
+ @theater = Limelight::Theater.new(@production)
14
14
  @stage = @theater.add_stage("George")
15
15
  @stage.should_remain_hidden = true
16
16
  Limelight::Context.instance.frameManager = Java::limelight.ui.model.InertFrameManager.new
@@ -126,7 +126,10 @@ describe Limelight::Stage do
126
126
  end
127
127
 
128
128
  describe "when opening a scene" do
129
+
129
130
  before(:each) do
131
+ @production.stub!(:theater_empty!)
132
+ Limelight::Studio.install
130
133
  @scene = Limelight::Scene.new
131
134
  @scene.stub!(:illuminate)
132
135
  end
@@ -182,6 +185,17 @@ describe Limelight::Stage do
182
185
  @stage.current_scene.should == nil
183
186
  end
184
187
 
188
+ it "should clean up when replacing scene" do
189
+ @stage.open(@scene)
190
+ new_scene = Limelight::Scene.new(:name => "new scene")
191
+ new_scene.stub!(:illuminate)
192
+
193
+ @stage.open(new_scene)
194
+
195
+ @scene.visible?.should == false
196
+ @stage.current_scene.should == new_scene
197
+ end
198
+
185
199
  it "should be removed from the theater when closed" do
186
200
  @stage.open(@scene)
187
201
  @theater["George"].should be(@stage)
@@ -191,7 +205,9 @@ describe Limelight::Stage do
191
205
  end
192
206
 
193
207
  it "should open an alert" do
194
- Limelight::Studio.utilities_production.should_receive(:alert).with("Some Message")
208
+ utilities_production = mock("utilities_production")
209
+ Limelight::Context.instance.studio.should_receive(:utilities_production).and_return(utilities_production)
210
+ utilities_production.should_receive(:alert).with("Some Message")
195
211
 
196
212
  @stage.alert("Some Message")
197
213
  sleep(0.01)
@@ -8,7 +8,8 @@ require 'limelight/stage'
8
8
  describe Limelight::Theater do
9
9
 
10
10
  before(:each) do
11
- @theater = Limelight::Theater.new
11
+ @production = mock("production", :theater_empty! => nil)
12
+ @theater = Limelight::Theater.new(@production)
12
13
  @stage = @theater.add_stage("default")
13
14
  end
14
15
 
@@ -69,4 +70,24 @@ describe Limelight::Theater do
69
70
  @theater.active_stage.should == nil
70
71
  end
71
72
 
73
+ it "should notify the production when all the stages are closed" do
74
+ @production.should_receive(:theater_empty!)
75
+
76
+ @theater.stage_closed(@stage)
77
+ end
78
+
79
+ it "should close" do
80
+ stage2 = @theater.add_stage("two")
81
+ stage3 = @theater.add_stage("three")
82
+ @theater.stage_activated(stage3)
83
+ stage2.should_receive(:close)
84
+ stage3.should_receive(:close)
85
+
86
+ @theater.close
87
+
88
+ @theater.stages.length.should == 0
89
+ @theater.active_stage.should == nil
90
+
91
+ end
92
+
72
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: limelight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: java
6
6
  authors:
7
7
  - Micah Martin, 8th Light
@@ -9,7 +9,7 @@ autorequire: init
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-21 00:00:00 -05:00
12
+ date: 2009-10-27 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -56,7 +56,6 @@ files:
56
56
  - lib/limelight/button_group_cache.rb
57
57
  - lib/limelight/casting_director.rb
58
58
  - lib/limelight/client
59
- - lib/limelight/client/playbills.rb
60
59
  - lib/limelight/commands
61
60
  - lib/limelight/commands/command.rb
62
61
  - lib/limelight/commands/create_command.rb
@@ -80,6 +79,7 @@ files:
80
79
  - lib/limelight/java_couplings.rb
81
80
  - lib/limelight/java_util.rb
82
81
  - lib/limelight/limelight_exception.rb
82
+ - lib/limelight/limelight_init.rb
83
83
  - lib/limelight/main.rb
84
84
  - lib/limelight/paint_action.rb
85
85
  - lib/limelight/pen.rb
@@ -133,7 +133,6 @@ files:
133
133
  - spec/limelight/builtin/utilities_production/spec_helper.rb
134
134
  - spec/limelight/builtin/utilities_production/utilities_production_spec.rb
135
135
  - spec/limelight/casting_director_spec.rb
136
- - spec/limelight/client/playbills_spec.rb
137
136
  - spec/limelight/commands/command_spec.rb
138
137
  - spec/limelight/commands/create_command_spec.rb
139
138
  - spec/limelight/commands/freeze_command_spec.rb
@@ -159,7 +158,6 @@ files:
159
158
  - spec/limelight/scene_spec.rb
160
159
  - spec/limelight/stage_spec.rb
161
160
  - spec/limelight/string_spec.rb
162
- - spec/limelight/studio_spec.rb
163
161
  - spec/limelight/styles_spec.rb
164
162
  - spec/limelight/templates/production_templater_spec.rb
165
163
  - spec/limelight/templates/scene_templater_spec.rb
@@ -415,6 +413,6 @@ rubyforge_project: limelight
415
413
  rubygems_version: 1.3.1
416
414
  signing_key:
417
415
  specification_version: 2
418
- summary: Limelight-0.5.0 - Limelight http://limelight.8thlight.com
416
+ summary: Limelight-0.5.1 - Limelight http://limelight.8thlight.com
419
417
  test_files: []
420
418