limelight 0.4.0-java → 0.5.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/lib/limelight.jar +0 -0
  2. data/lib/limelight/animation.rb +4 -3
  3. data/lib/limelight/builtin/players.rb +3 -1
  4. data/lib/limelight/builtin/players/image.rb +4 -0
  5. data/lib/limelight/builtin/players/stage_mover.rb +31 -0
  6. data/lib/limelight/builtin/players/stage_sizer.rb +34 -0
  7. data/lib/limelight/builtin/utilities_production/alert/players/alert.rb +11 -0
  8. data/lib/limelight/builtin/utilities_production/alert/props.rb +3 -0
  9. data/lib/limelight/builtin/utilities_production/alert/styles.rb +7 -0
  10. data/lib/limelight/builtin/utilities_production/incompatible_version/props.rb +3 -0
  11. data/lib/limelight/builtin/utilities_production/incompatible_version/styles.rb +3 -0
  12. data/lib/limelight/builtin/utilities_production/production.rb +3 -0
  13. data/lib/limelight/builtin/utilities_production/stages.rb +3 -0
  14. data/lib/limelight/builtin/utilities_production/styles.rb +3 -0
  15. data/lib/limelight/casting_director.rb +1 -1
  16. data/lib/limelight/commands/create_command.rb +33 -19
  17. data/lib/limelight/commands/freeze_command.rb +20 -5
  18. data/lib/limelight/commands/open_command.rb +2 -1
  19. data/lib/limelight/dsl/styles_builder.rb +40 -18
  20. data/lib/limelight/file_loader.rb +1 -1
  21. data/lib/limelight/gems.rb +3 -1
  22. data/lib/limelight/java_couplings.rb +1 -0
  23. data/lib/limelight/producer.rb +4 -47
  24. data/lib/limelight/production.rb +20 -0
  25. data/lib/limelight/prop.rb +32 -32
  26. data/lib/limelight/scene.rb +2 -1
  27. data/lib/limelight/specs/spec_helper.rb +24 -22
  28. data/lib/limelight/specs/test_scene_opener.rb +60 -0
  29. data/lib/limelight/string.rb +1 -1
  30. data/lib/limelight/studio.rb +28 -9
  31. data/lib/limelight/templates/production_templater.rb +5 -2
  32. data/lib/limelight/templates/scene_templater.rb +7 -6
  33. data/lib/limelight/templates/sources/production/production.rb.template +1 -1
  34. data/lib/limelight/templates/sources/production/spec/spec_helper.rb.template +8 -1
  35. data/lib/limelight/version.rb +1 -1
  36. data/productions/examples/sandbox/alerts/incompatible_production/default_scene/props.rb +3 -0
  37. data/productions/examples/sandbox/alerts/incompatible_production/default_scene/styles.rb +3 -0
  38. data/productions/examples/sandbox/alerts/incompatible_production/production.rb +3 -0
  39. data/productions/examples/sandbox/alerts/incompatible_production/spec/default_scene/default_scene_spec.rb +3 -0
  40. data/productions/examples/sandbox/alerts/incompatible_production/spec/spec_helper.rb +3 -0
  41. data/productions/examples/sandbox/alerts/incompatible_production/stages.rb +3 -0
  42. data/productions/examples/sandbox/alerts/incompatible_production/styles.rb +3 -0
  43. data/productions/examples/sandbox/alerts/players/alerts.rb +3 -0
  44. data/productions/examples/sandbox/alerts/props.rb +3 -0
  45. data/productions/examples/sandbox/alerts/styles.rb +3 -0
  46. data/productions/examples/sandbox/background_images/props.rb +3 -0
  47. data/productions/examples/sandbox/header.rb +1 -0
  48. data/productions/examples/sandbox/images_scene/props.rb +8 -0
  49. data/productions/examples/sandbox/kiosk/players/kiosk.rb +3 -0
  50. data/productions/examples/sandbox/kiosk/props.rb +3 -0
  51. data/productions/examples/sandbox/kiosk/styles.rb +3 -0
  52. data/productions/examples/sandbox/spec/alerts/alerts_spec.rb +3 -0
  53. data/productions/examples/sandbox/stage_handles/players/sizer.rb +35 -0
  54. data/productions/examples/sandbox/stage_handles/props.rb +17 -0
  55. data/productions/examples/sandbox/stage_handles/styles.rb +58 -0
  56. data/productions/playbills.lll +1 -0
  57. data/productions/startup/production.rb +3 -0
  58. data/productions/startup/spec/default_scene/default_scene_spec.rb +3 -0
  59. data/productions/startup/spec/spec_helper.rb +3 -0
  60. data/productions/startup/styles.rb +3 -0
  61. data/spec/{builtin → limelight/builtin}/players/button_spec.rb +1 -1
  62. data/spec/{builtin → limelight/builtin}/players/check_box_spec.rb +1 -1
  63. data/spec/{builtin → limelight/builtin}/players/combo_box_spec.rb +1 -1
  64. data/spec/{builtin → limelight/builtin}/players/image_spec.rb +1 -2
  65. data/spec/{builtin → limelight/builtin}/players/password_box_spec.rb +1 -1
  66. data/spec/{builtin → limelight/builtin}/players/radio_button_spec.rb +1 -1
  67. data/spec/limelight/builtin/players/stage_mover_spec.rb +36 -0
  68. data/spec/limelight/builtin/players/stage_sizer_spec.rb +40 -0
  69. data/spec/{builtin → limelight/builtin}/players/text_area_spec.rb +1 -1
  70. data/spec/{builtin → limelight/builtin}/players/text_box_spec.rb +1 -1
  71. data/spec/limelight/builtin/utilities_production/spec_helper.rb +7 -0
  72. data/spec/{builtin → limelight/builtin}/utilities_production/utilities_production_spec.rb +3 -0
  73. data/spec/{casting_director_spec.rb → limelight/casting_director_spec.rb} +1 -1
  74. data/spec/{client → limelight/client}/playbills_spec.rb +1 -1
  75. data/spec/{commands → limelight/commands}/command_spec.rb +1 -1
  76. data/spec/{commands → limelight/commands}/create_command_spec.rb +23 -19
  77. data/spec/limelight/commands/freeze_command_spec.rb +143 -0
  78. data/spec/{commands → limelight/commands}/help_command_spec.rb +1 -1
  79. data/spec/{commands → limelight/commands}/open_command_spec.rb +1 -1
  80. data/spec/{commands → limelight/commands}/pack_command_spec.rb +1 -1
  81. data/spec/{commands → limelight/commands}/unpack_command_spec.rb +1 -1
  82. data/spec/{data_spec.rb → limelight/data_spec.rb} +1 -1
  83. data/spec/{dsl → limelight/dsl}/prop_builder_spec.rb +1 -1
  84. data/spec/{dsl → limelight/dsl}/stage_builder_spec.rb +1 -1
  85. data/spec/{dsl → limelight/dsl}/styles_builder_spec.rb +52 -13
  86. data/spec/{file_chooser_spec.rb → limelight/file_chooser_spec.rb} +1 -1
  87. data/spec/{file_filter_spec.rb → limelight/file_filter_spec.rb} +1 -1
  88. data/spec/{file_loader_spec.rb → limelight/file_loader_spec.rb} +1 -1
  89. data/spec/{gems_spec.rb → limelight/gems_spec.rb} +10 -4
  90. data/spec/{java_util_spec.rb → limelight/java_util_spec.rb} +1 -1
  91. data/spec/{main_spec.rb → limelight/main_spec.rb} +1 -1
  92. data/spec/{paint_action_spec.rb → limelight/paint_action_spec.rb} +1 -1
  93. data/spec/{pen_spec.rb → limelight/pen_spec.rb} +1 -1
  94. data/spec/{producer_spec.rb → limelight/producer_spec.rb} +4 -12
  95. data/spec/{production_spec.rb → limelight/production_spec.rb} +32 -11
  96. data/spec/{prop_spec.rb → limelight/prop_spec.rb} +30 -2
  97. data/spec/{scene_spec.rb → limelight/scene_spec.rb} +28 -2
  98. data/spec/{stage_spec.rb → limelight/stage_spec.rb} +1 -1
  99. data/spec/{string_spec.rb → limelight/string_spec.rb} +1 -1
  100. data/spec/{studio_spec.rb → limelight/studio_spec.rb} +16 -1
  101. data/spec/{styles_spec.rb → limelight/styles_spec.rb} +1 -1
  102. data/spec/{templates → limelight/templates}/production_templater_spec.rb +17 -6
  103. data/spec/{templates → limelight/templates}/scene_templater_spec.rb +15 -4
  104. data/spec/{templates → limelight/templates}/templater_logger_spec.rb +1 -1
  105. data/spec/{templates → limelight/templates}/templater_spec.rb +1 -1
  106. data/spec/{theater_spec.rb → limelight/theater_spec.rb} +1 -1
  107. data/spec/{util → limelight/util}/downloader_spec.rb +1 -1
  108. data/spec/spec_helper.rb +11 -0
  109. metadata +62 -70
  110. data/lib/limelight/dsl/production_builder.rb +0 -71
  111. data/spec/builtin/utilities_production/spec_helper.rb +0 -4
  112. data/spec/commands/freeze_command_spec.rb +0 -62
  113. data/spec/dsl/production_builder_spec.rb +0 -46
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
5
5
  require 'limelight/dsl/stage_builder'
6
6
  require 'limelight/theater'
7
7
 
@@ -1,30 +1,30 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
5
5
  require 'limelight/dsl/styles_builder'
6
6
 
7
7
  describe Limelight::DSL::StylesBuilder do
8
8
 
9
9
  before(:each) do
10
10
  end
11
-
11
+
12
12
  it "should build a hash" do
13
13
  result = Limelight.build_styles
14
-
14
+
15
15
  result.class.should == Hash
16
16
  result.size.should == 0
17
17
  end
18
-
18
+
19
19
  it "should build one style" do
20
20
  result = Limelight.build_styles do
21
21
  root
22
22
  end
23
-
23
+
24
24
  result.size.should == 1
25
25
  result["root"].class.should == Limelight::Styles::RichStyle
26
26
  end
27
-
27
+
28
28
  it "should build one style with styling" do
29
29
  result = Limelight.build_styles do
30
30
  root do
@@ -33,14 +33,14 @@ describe Limelight::DSL::StylesBuilder do
33
33
  transparency "50%"
34
34
  end
35
35
  end
36
-
36
+
37
37
  result.size.should == 1
38
38
  style = result["root"]
39
39
  style.width.should == "100"
40
40
  style.top_border_color.should == "#0000ffff"
41
41
  style.transparency.should == "50%"
42
42
  end
43
-
43
+
44
44
  it "should raise an error on invalid styles" do
45
45
  lambda do
46
46
  Limelight.build_styles do
@@ -50,18 +50,18 @@ describe Limelight::DSL::StylesBuilder do
50
50
  end
51
51
  end.should raise_error(Limelight::DSL::StyleBuilderException)
52
52
  end
53
-
53
+
54
54
  it "should build multiple styles" do
55
55
  result = Limelight.build_styles do
56
56
  one { width 100 }
57
57
  two { width 50 }
58
58
  end
59
-
59
+
60
60
  result.size.should == 2
61
61
  result["one"].width.should == "100"
62
62
  result["two"].width.should == "50"
63
63
  end
64
-
64
+
65
65
  it "should allow hover styles" do
66
66
  styles = Limelight.build_styles do
67
67
  root do
@@ -71,7 +71,7 @@ describe Limelight::DSL::StylesBuilder do
71
71
  end
72
72
  end
73
73
  end
74
-
74
+
75
75
  styles.size.should == 2
76
76
  styles["root"].width.should == "100"
77
77
  styles["root.hover"].width.should == "50"
@@ -142,7 +142,6 @@ describe Limelight::DSL::StylesBuilder do
142
142
  two { width 123 }
143
143
  end
144
144
 
145
- styles1.should == styles2
146
145
  styles2.size.should == 2
147
146
  one = styles2["one"]
148
147
  two = styles2["two"]
@@ -151,5 +150,45 @@ describe Limelight::DSL::StylesBuilder do
151
150
  two.width.should == "123"
152
151
  end
153
152
 
153
+ it "should be able to modify style within same build" do
154
+ styles = Limelight.build_styles do
155
+ one { width 100 }
156
+ one { height 200 }
157
+ end
158
+
159
+ styles["one"].width.should == "100"
160
+ styles["one"].height.should == "200"
161
+ end
162
+
163
+ it "should beable to extend existing styles but not modify them" do
164
+ styles1 = Limelight.build_styles do
165
+ one { width 100; height 200 }
166
+ end
167
+ styles2 = Limelight.build_styles(styles1) do
168
+ one { width 300 }
169
+ end
170
+
171
+ styles1["one"].width.should == "100"
172
+ styles1["one"].height.should == "200"
173
+ styles2["one"].width.should == "300"
174
+ styles2["one"].height.should == "200"
175
+
176
+ styles1["one"].height = "400"
177
+ styles2["one"].height.should == "400"
178
+ end
179
+
180
+ it "should be able to explicitely extend extendable_styles" do
181
+ styles1 = Limelight.build_styles do
182
+ one { width 100; height 200 }
183
+ end
184
+ styles2 = Limelight.build_styles(styles1) do
185
+ two { extends "one"; x 25 }
186
+ end
187
+
188
+ styles2["two"].width.should == "100"
189
+ styles2["two"].height.should == "200"
190
+ styles2["two"].x.should == "25"
191
+ end
192
+
154
193
  end
155
194
 
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/file_chooser'
6
6
 
7
7
  describe Limelight::FileChooser do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/file_filter'
6
6
 
7
7
  describe Limelight::FileFilter do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/file_loader'
6
6
 
7
7
  describe Limelight::FileLoader do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require "limelight/gems"
6
6
  require 'limelight/production'
7
7
 
@@ -57,9 +57,9 @@ describe Limelight::Gems do
57
57
  end
58
58
 
59
59
  it "should load all the gems in a production" do
60
- TestDir.create_file("prod/__resources/gems/gem1/limelight_init.rb", "Limelight::Gems.install('gem1', ['fee'])")
61
- TestDir.create_file("prod/__resources/gems/gem2/limelight_init.rb", "Limelight::Gems.install('gem2', ['fie'])")
62
- TestDir.create_file("prod/__resources/gems/gem3/limelight_init.rb", "Limelight::Gems.install('gem3', ['foe', 'fum'])")
60
+ TestDir.create_file("prod/__resources/gems/gems/gem1/limelight_init.rb", "Limelight::Gems.install('gem1', ['fee'])")
61
+ TestDir.create_file("prod/__resources/gems/gems/gem2/limelight_init.rb", "Limelight::Gems.install('gem2', ['fie'])")
62
+ TestDir.create_file("prod/__resources/gems/gems/gem3/limelight_init.rb", "Limelight::Gems.install('gem3', ['foe', 'fum'])")
63
63
  path = []
64
64
  Limelight::Gems.stub!(:load_path).and_return(path)
65
65
 
@@ -81,6 +81,12 @@ describe Limelight::Gems do
81
81
 
82
82
  path.length.should == 0
83
83
  end
84
+
85
+ it "should set the gem home and gem path to the __resources/gems so that using the gem command within frozen gems will work" do
86
+ Gem.should_receive(:use_paths).with(@production.gems_root, Gem.default_path)
87
+
88
+ Limelight::Gems.install_gems_in_production(@production)
89
+ end
84
90
  end
85
91
 
86
92
  end
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/java_util'
6
6
 
7
7
  describe Class do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/main'
6
6
 
7
7
  describe Limelight::Main do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/paint_action'
6
6
 
7
7
  describe Limelight::PaintAction do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/pen'
6
6
 
7
7
  describe Limelight::Pen do
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/producer'
6
6
 
7
7
  describe Limelight::Producer do
@@ -52,7 +52,7 @@ describe Limelight::Producer do
52
52
 
53
53
  it "should load styles" do
54
54
  TestDir.create_file("test_prod/styles.rb", "alpha { width 100 }")
55
- @producer.builtin_styles = {}
55
+ Limelight::Studio.stub!(:builtin_styles).and_return({})
56
56
 
57
57
  styles = @producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod")))
58
58
  styles.size.should == 1
@@ -135,7 +135,6 @@ describe Limelight::Producer do
135
135
  scene = make_mock("scene")
136
136
  @producer.should_receive(:load_props).with(:production => @producer.production, :casting_director => anything, :path => TestDir.path("test_prod/name"), :name => "name").and_return(scene)
137
137
  @producer.should_receive(:load_styles).and_return("styles")
138
- @producer.should_receive(:merge_with_root_styles).with("styles")
139
138
  scene.should_receive(:styles=)
140
139
  stage.should_receive(:open).with(scene)
141
140
 
@@ -143,7 +142,7 @@ describe Limelight::Producer do
143
142
  end
144
143
 
145
144
  it "should load empty styles if styles.rb doesn't exist" do
146
- @producer.builtin_styles = {}
145
+ Limelight::Studio.stub!(:builtin_styles).and_return({})
147
146
 
148
147
  @producer.load_styles(Limelight::Scene.new(:path => TestDir.path("test_prod"))).should == {}
149
148
  end
@@ -189,12 +188,6 @@ describe Limelight::Producer do
189
188
  @producer.open
190
189
  end
191
190
 
192
- it "should give the same buildin_styles hash twice" do
193
- @producer.builtin_styles.should_not be(@producer.builtin_styles)
194
- # Try again
195
- @producer.builtin_styles.should_not be(@producer.builtin_styles)
196
- end
197
-
198
191
  it "should check limelight version" do
199
192
  @producer.production.should_receive(:minimum_limelight_version).and_return("0.0.0")
200
193
  @producer.version_compatible?.should == true
@@ -208,11 +201,10 @@ describe Limelight::Producer do
208
201
  scene = make_mock("scene")
209
202
  @producer.should_receive(:load_props).with(:instance_variables => { :foo => "bar" }, :production => @producer.production, :casting_director => anything, :path => TestDir.path("test_prod/name"), :name => "name").and_return(scene)
210
203
  @producer.should_receive(:load_styles).and_return("styles")
211
- @producer.should_receive(:merge_with_root_styles).with("styles")
212
204
  scene.should_receive(:styles=)
213
205
  stage.should_receive(:open).with(scene)
214
206
 
215
207
  @producer.open_scene("name", stage, :instance_variables => { :foo => "bar" })
216
208
  end
217
-
209
+
218
210
  end
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/production'
6
6
 
7
7
  describe Limelight::Production, "Instance methods" do
@@ -13,22 +13,22 @@ describe Limelight::Production, "Instance methods" do
13
13
  @production.producer = @producer
14
14
  @production.theater = @theater
15
15
  end
16
-
16
+
17
17
  it "should know it path, producer, and theater" do
18
18
  @production.producer.should == @producer
19
19
  @production.theater.should == @theater
20
20
  @production.path.should == "/tmp"
21
21
  end
22
-
22
+
23
23
  it "should be indexed" do
24
24
  Limelight::Studio.index(@production)
25
25
  Limelight::Studio[@production.name].should == @production
26
26
  end
27
-
27
+
28
28
  it "should raise an error when setting the name to a duplicate name" do
29
29
  @production.name = "Bill"
30
30
  Limelight::Studio.index(@production)
31
-
31
+
32
32
  production = Limelight::Production.new("/tmp")
33
33
  Limelight::Studio.index(production)
34
34
  lambda { production.name = "Bill" }.should raise_error(Limelight::LimelightException, "Production name 'Bill' is already taken")
@@ -37,23 +37,27 @@ describe Limelight::Production, "Instance methods" do
37
37
  it "should get it's name from the file" do
38
38
  Limelight::Production.new("/tmp").name.should == "tmp"
39
39
  Limelight::Production.new("/Somewhere/over/the/rainbow").name.should == "rainbow"
40
- Limelight::Production.new("my_name/is/kid").name.should == "kid"
40
+ Limelight::Production.new("my_name/is/kid").name.should == "kid"
41
41
  end
42
42
 
43
- it "should know it's init file" do
43
+ it "should know its init file" do
44
44
  @production.init_file.should == "/tmp/init.rb"
45
45
  end
46
46
 
47
- it "should know it's stages file" do
47
+ it "should know its stages file" do
48
48
  @production.stages_file.should == "/tmp/stages.rb"
49
49
  end
50
50
 
51
- it "should know it's styles file" do
51
+ it "should know its styles file" do
52
52
  @production.styles_file.should == "/tmp/styles.rb"
53
53
  end
54
54
 
55
- it "should know it's gems directory" do
56
- @production.gems_directory.should == "/tmp/__resources/gems"
55
+ it "should know its gems directory" do
56
+ @production.gems_directory.should == "/tmp/__resources/gems/gems"
57
+ end
58
+
59
+ it "should know its gems root" do
60
+ @production.gems_root.should == "/tmp/__resources/gems"
57
61
  end
58
62
 
59
63
  it "should provide paths to it's scenes" do
@@ -74,6 +78,23 @@ describe Limelight::Production, "Instance methods" do
74
78
  @production.close
75
79
  end
76
80
 
81
+ describe "with files" do
82
+
83
+ after(:each) do
84
+ TestDir.clean
85
+ end
86
+
87
+ it "should load it's root styles" do
88
+ TestDir.create_file("test_prod/styles.rb", "a_style { width 100; height 200 }")
89
+ @production = Limelight::Production.new( TestDir.path("test_prod"))
90
+
91
+ styles = @production.root_styles
92
+ styles["a_style"].width.should == "100"
93
+ styles["a_style"].height.should == "200"
94
+ @production.root_styles.should be(styles)
95
+ end
96
+ end
97
+
77
98
  end
78
99
 
79
100
 
@@ -1,7 +1,7 @@
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
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
4
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
5
5
  require 'limelight/prop'
6
6
  require 'limelight/dsl/styles_builder'
7
7
  require 'limelight/scene'
@@ -64,6 +64,13 @@ describe Limelight::Prop do
64
64
  @prop.illuminate
65
65
  @prop.id.should == "root"
66
66
  end
67
+
68
+ it "not start out being illuminated" do
69
+ prop = Limelight::Prop.new(nil)
70
+
71
+ prop.should_not be_illuminated
72
+ end
73
+
67
74
 
68
75
  def build_prop_tree
69
76
  @child1 = Limelight::Prop.new(:id => "child1", :name => "child_class")
@@ -151,7 +158,7 @@ describe Limelight::Prop do
151
158
 
152
159
  it "should set styles upon adding to parent" do
153
160
  styles = Limelight::build_styles { child { width 123 } }
154
- scene = Limelight::Scene.new(:casting_director => @casting_director, :styles => styles)
161
+ scene = Limelight::Scene.new(:casting_director => @casting_director, :styles_hash => styles)
155
162
  prop = Limelight::Prop.new(:name => "child")
156
163
  scene.illuminate
157
164
 
@@ -383,6 +390,27 @@ describe Limelight::Prop do
383
390
  @scene.find("child").should == nil
384
391
  @scene.find("grandchild").should == nil
385
392
  end
393
+
394
+ it "should index it's id when being re-added to the prop tree" do
395
+ child = Limelight::Prop.new(:id => "child")
396
+ @prop << child
397
+ @prop.remove(child)
398
+ @prop << child
399
+
400
+ @scene.find("child").should == child
401
+ end
402
+
403
+ it "should traverse and index children when being re-added to the prop tree" do
404
+ grandchild = Limelight::Prop.new(:id => "grandchild")
405
+ child = Limelight::Prop.new(:id => "child")
406
+ child << grandchild
407
+ @prop << child
408
+ @prop.remove(child)
409
+ @prop << child
410
+
411
+ @scene.find("grandchild").should == grandchild
412
+ end
413
+
386
414
 
387
415
  end
388
416