limelight 0.3.0-java → 0.3.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.
Files changed (58) hide show
  1. data/lib/init.rb +1 -1
  2. data/lib/limelight.jar +0 -0
  3. data/lib/limelight/builtin/players.rb +2 -1
  4. data/lib/limelight/builtin/players/combo_box.rb +2 -0
  5. data/lib/limelight/builtin/players/curtains.rb +1 -0
  6. data/lib/limelight/builtin/players/password_box.rb +34 -0
  7. data/lib/limelight/casting_director.rb +2 -1
  8. data/lib/limelight/client/playbills.rb +83 -0
  9. data/lib/limelight/commands/command.rb +14 -2
  10. data/lib/limelight/commands/help_command.rb +50 -0
  11. data/lib/limelight/commands/unpack_command.rb +44 -0
  12. data/lib/limelight/commands/version_command.rb +31 -0
  13. data/lib/limelight/data.rb +47 -0
  14. data/lib/limelight/java_couplings.rb +1 -0
  15. data/lib/limelight/limelight_exception.rb +13 -0
  16. data/lib/limelight/main.rb +22 -24
  17. data/lib/limelight/producer.rb +3 -2
  18. data/lib/limelight/prop.rb +2 -1
  19. data/lib/limelight/scene.rb +8 -1
  20. data/lib/limelight/util/downloader.rb +113 -0
  21. data/lib/limelight/version.rb +1 -1
  22. data/productions/examples/8thlight.com/styles.rb +147 -149
  23. data/productions/examples/calculator/styles.rb +2 -4
  24. data/productions/examples/langstons_ant/styles.rb +1 -2
  25. data/productions/examples/sandbox/click_me/players/chromaton.rb +2 -3
  26. data/productions/examples/sandbox/click_me/styles.rb +6 -7
  27. data/productions/examples/sandbox/floaters/players/floater.rb +2 -2
  28. data/productions/examples/sandbox/floaters/styles.rb +1 -2
  29. data/productions/examples/sandbox/frameing/players/sandbox.rb +14 -0
  30. data/productions/examples/sandbox/frameing/props.rb +32 -0
  31. data/productions/examples/sandbox/frameing/styles.rb +42 -0
  32. data/productions/examples/sandbox/header.rb +1 -0
  33. data/productions/examples/sandbox/homer/styles.rb +1 -2
  34. data/productions/examples/sandbox/images_scene/styles.rb +3 -2
  35. data/productions/examples/sandbox/inputs/styles.rb +0 -1
  36. data/productions/examples/sandbox/rounded_corners/styles.rb +1 -2
  37. data/productions/examples/sandbox/scrolling/styles.rb +1 -2
  38. data/productions/examples/sandbox/styles.rb +7 -9
  39. data/productions/examples/sandbox/teaser/styles.rb +1 -2
  40. data/productions/examples/tutorials/tutorial_1/styles.rb +2 -4
  41. data/productions/startup/stages.rb +6 -0
  42. data/productions/startup/{players → welcome/players}/browse_button.rb +0 -0
  43. data/productions/startup/{players → welcome/players}/download_button.rb +3 -3
  44. data/productions/startup/{players → welcome/players}/sandbox_button.rb +0 -0
  45. data/productions/startup/{props.rb → welcome/props.rb} +0 -0
  46. data/productions/startup/{styles.rb → welcome/styles.rb} +0 -0
  47. data/spec/builtin/players/password_box_spec.rb +27 -0
  48. data/spec/client/playbills_spec.rb +76 -0
  49. data/spec/commands/help_command_spec.rb +39 -0
  50. data/spec/commands/unpack_command_spec.rb +44 -0
  51. data/spec/data_spec.rb +47 -0
  52. data/spec/main_spec.rb +20 -0
  53. data/spec/prop_spec.rb +18 -0
  54. data/spec/scene_spec.rb +43 -0
  55. data/spec/spec_helper.rb +2 -1
  56. data/spec/util/downloader_spec.rb +89 -0
  57. metadata +33 -11
  58. data/productions/examples/sandbox.llp +0 -0
@@ -0,0 +1,39 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/commands/help_command'
3
+
4
+ describe Limelight::Commands::HelpCommand do
5
+
6
+ before(:all) do
7
+ @command_class = Limelight::Commands::HelpCommand
8
+ @command = @command_class.new
9
+ Limelight::Commands["help"] #load listing
10
+ end
11
+
12
+ before(:each) do
13
+ @mock_output = StringIO.new
14
+ Limelight::Commands.output = @mock_output
15
+ end
16
+
17
+ it "should be listed" do
18
+ Limelight::Commands["help"].should == @command_class
19
+ end
20
+
21
+ it "should print all commands not starting in --" do
22
+ @command.run([])
23
+
24
+ Limelight::Commands::LISTING.keys.each do |key|
25
+ if key[0...1] == "-"
26
+ @mock_output.string.should_not include("\t#{key}")
27
+ else
28
+ @mock_output.string.should include("\t#{key}")
29
+ end
30
+ end
31
+ end
32
+
33
+ it "should include options in the header" do
34
+ @command.run([])
35
+
36
+ @mock_output.string.should include("[--version]")
37
+ end
38
+
39
+ end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/commands/unpack_command'
3
+
4
+ describe Limelight::Commands::UnpackCommand do
5
+
6
+ before(:all) do
7
+ @command_class = Limelight::Commands::UnpackCommand
8
+ @command = @command_class.new
9
+ end
10
+
11
+ before(:each) do
12
+ @mock_output = StringIO.new
13
+ Limelight::Commands.output = @mock_output
14
+
15
+ @mock_unpacker = make_mock("unpacker")
16
+ Limelight::Util::Packer.stub!(:new).and_return(@mock_unpacker)
17
+ @mock_unpacker.stub!(:unpack).and_return "unpacked location"
18
+
19
+ Limelight::Main.stub!(:initialize_temp_directory)
20
+ end
21
+
22
+ it "should be listed" do
23
+ Limelight::Commands::LISTING["unpack"].should == @command_class
24
+ end
25
+
26
+ it "set the context temp dir" do
27
+ Limelight::Main.should_receive(:initialize_temp_directory)
28
+
29
+ @command.run(["production_to_pack"])
30
+ end
31
+
32
+ it "should unpack a production" do
33
+ @mock_unpacker.should_receive(:unpack).with("production_to_pack")
34
+
35
+ @command.run(["production_to_pack"])
36
+ end
37
+
38
+ it "print the unpacked location" do
39
+ @command.run(["production_to_pack"])
40
+
41
+ @mock_output.string.should include("Production was unpacked to: unpacked location")
42
+ end
43
+
44
+ end
data/spec/data_spec.rb ADDED
@@ -0,0 +1,47 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
+ require 'limelight/data'
3
+
4
+ describe Limelight::Data do
5
+
6
+ before(:each) do
7
+ Limelight::Data.reset
8
+ Limelight::Context.instance.stub!(:os).and_return("osx")
9
+ end
10
+
11
+ it "should have a root on osx" do
12
+ Limelight::Context.instance.stub!(:os).and_return("osx")
13
+ expected = File.expand_path(File.join("~/Library/Application Support/Limelight"))
14
+
15
+ Limelight::Data.root.should == expected
16
+ end
17
+
18
+ it "should have a root on windows" do
19
+ Limelight::Context.instance.stub!(:os).and_return("windows")
20
+ expected = File.expand_path(File.join("~/Application Data/Limelight"))
21
+
22
+ Limelight::Data.root.should == expected
23
+ end
24
+
25
+ it "should have a Downloads dir" do
26
+ expected = File.join(Limelight::Data.root, "Downloads")
27
+
28
+ Limelight::Data.downloads_dir.should == expected
29
+ end
30
+
31
+ it "should have a Productions dir" do
32
+ expected = File.join(Limelight::Data.root, "Productions")
33
+
34
+ Limelight::Data.productions_dir.should == expected
35
+ end
36
+
37
+ it "should establish all the dirs" do
38
+ Limelight::Data.stub!(:root).and_return(TestDir.path("Limelight"))
39
+
40
+ Limelight::Data.establish_data_dirs
41
+
42
+ File.exists?(TestDir.path("Limelight")).should == true
43
+ File.exists?(TestDir.path("Limelight/Downloads")).should == true
44
+ File.exists?(TestDir.path("Limelight/Productions")).should == true
45
+ end
46
+
47
+ end
data/spec/main_spec.rb CHANGED
@@ -3,6 +3,11 @@ require 'limelight/main'
3
3
 
4
4
  describe Limelight::Main do
5
5
 
6
+ before(:each) do
7
+ @mock_output = StringIO.new
8
+ Limelight::Commands.output = @mock_output
9
+ end
10
+
6
11
  it "should run the specified command" do
7
12
  command_class = make_mock("command_class")
8
13
  command = make_mock("command")
@@ -14,4 +19,19 @@ describe Limelight::Main do
14
19
  Limelight::Main.run(["mock", "1", "2", "3"])
15
20
  end
16
21
 
22
+ it "should handle --version option" do
23
+ Limelight::Main.run(["--version"])
24
+
25
+ @mock_output.string.should == "Limelight, version #{Limelight::VERSION::STRING}\n"
26
+ end
27
+
28
+ it "should print usage" do
29
+ begin
30
+ Limelight::Main.run(["garbage"])
31
+ rescue SystemExit
32
+ end
33
+
34
+ @mock_output.string.should include("Usage: limelight")
35
+ end
36
+
17
37
  end
data/spec/prop_spec.rb CHANGED
@@ -273,6 +273,24 @@ describe Limelight::Prop do
273
273
  @prop.children[1].children[0].name.should == "three"
274
274
  end
275
275
 
276
+ it "should build children with options" do
277
+ @prop.scene.production = Limelight::Production.new("some/path")
278
+ @prop.build(:one_val => "hello") do
279
+ one :text => @one_val
280
+ two do
281
+ three
282
+ end
283
+
284
+ end
285
+
286
+ @prop.children.length.should == 2
287
+ @prop.children[0].name.should == "one"
288
+ @prop.children[0].text.should == "hello"
289
+ @prop.children[1].name.should == "two"
290
+ @prop.children[1].children.length.should == 1
291
+ @prop.children[1].children[0].name.should == "three"
292
+ end
293
+
276
294
  it "should play sound" do
277
295
  production = Limelight::Production.new("/blah")
278
296
  @scene.production = production
data/spec/scene_spec.rb CHANGED
@@ -92,7 +92,50 @@ describe Limelight::Scene do
92
92
 
93
93
  @scene.find("some_id").should == nil
94
94
  end
95
+
96
+ it "should unindex child's prop" do
97
+ prop = Limelight::Prop.new(:id => "some_id")
98
+ child = Limelight::Prop.new(:id => "child_id")
99
+ prop.children << child
100
+
101
+ @scene << child
102
+ @scene << prop
103
+
104
+ @scene.unindex_prop(prop)
105
+
106
+ @scene.find("some_id").should == nil
107
+ @scene.find("child_id").should == nil
108
+ end
109
+
110
+ it "should not blow up if child has no id" do
111
+ prop = Limelight::Prop.new(:id => "some_id")
112
+ child = Limelight::Prop.new(:id => nil)
113
+ prop.children << child
114
+
115
+ @scene << child
116
+ @scene << prop
95
117
 
118
+ @scene.unindex_prop(prop)
119
+
120
+ @scene.find("some_id").should == nil
121
+ end
122
+
123
+ it "should unindex grandchildren props" do
124
+ prop = Limelight::Prop.new(:id => "some_id")
125
+ child = Limelight::Prop.new(:id => "child_id")
126
+ grandchild = Limelight::Prop.new(:id => "grandchild_id")
127
+ child.children << grandchild
128
+ prop.children << child
129
+
130
+ @scene << grandchild
131
+ @scene << child
132
+ @scene << prop
133
+
134
+ @scene.unindex_prop(prop)
135
+
136
+ @scene.find("grandchild_id").should == nil
137
+ end
138
+
96
139
  it "should convert ids to string when finding" do
97
140
  prop = Limelight::Prop.new(:id => 123)
98
141
  @scene << prop
data/spec/spec_helper.rb CHANGED
@@ -33,7 +33,7 @@ class TestDir
33
33
 
34
34
  def path(path)
35
35
  return File.join(root, path)
36
- end
36
+ end
37
37
 
38
38
  def clean
39
39
  Dir.entries(root).each do |file|
@@ -45,6 +45,7 @@ class TestDir
45
45
  filename = self.path(path)
46
46
  establish_dir(File.dirname(filename))
47
47
  File.open(filename, 'w') { |file| file.write content }
48
+ return filename
48
49
  end
49
50
 
50
51
  def establish_dir(path)
@@ -0,0 +1,89 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/util/downloader'
3
+
4
+ describe Limelight::Util::Downloader do
5
+
6
+ before(:each) do
7
+ Limelight::Data.stub!(:root).and_return(File.expand_path(File.join(TestDir.root, "Limelight")))
8
+ @downloader = Limelight::Util::Downloader.new
9
+ end
10
+
11
+ after(:each) do
12
+ TestDir.clean
13
+ end
14
+
15
+ it "should download a local file with the file protocol" do
16
+ test_file = TestDir.create_file("test_dir/test_file.txt", "a test file")
17
+
18
+ path = @downloader.download("file://#{test_file}")
19
+
20
+ File.basename(path).should == "test_file.txt"
21
+ File.dirname(path).should == Limelight::Data.downloads_dir
22
+ File.exists?(path).should == true
23
+ IO.read(path).should == "a test file"
24
+ end
25
+
26
+ it "should be find unique filenames" do
27
+ test_file = TestDir.create_file("test_dir/test_file.txt", "a test file")
28
+
29
+ path1 = @downloader.download("file://#{test_file}")
30
+ path2 = @downloader.download("file://#{test_file}")
31
+ path3 = @downloader.download("file://#{test_file}")
32
+
33
+ File.basename(path1).should == "test_file.txt"
34
+ File.basename(path2).should == "test_file_2.txt"
35
+ File.basename(path3).should == "test_file_3.txt"
36
+ end
37
+
38
+ it "should raise not found exception whe bad URLs" do
39
+ test_file = TestDir.path("test_dir/test_file.txt")
40
+
41
+ lambda { @downloader.download("file://#{test_file}") }.should raise_error(Limelight::LimelightException, "Download failed. Not found: #{test_file}")
42
+ end
43
+
44
+ it "should raise error on failed download" do
45
+ lambda { @downloader.download("http://blah.blah/blah.blah") }.should raise_error(Limelight::LimelightException)
46
+
47
+ path = File.join(Limelight::Data.downloads_dir, "blah.blah")
48
+ File.exists?(path).should == false
49
+ end
50
+
51
+ # The following tests should not run as part of the normal suite. They are expensive and require the net.
52
+
53
+ # it "should downaload via HTTP" do
54
+ # path = @downloader.download("http://limelight.8thlight.com/images/logo.png")
55
+ #
56
+ # File.basename(path).should == "logo.png"
57
+ # File.dirname(path).should == Limelight::Data.downloads_dir
58
+ # File.exists?(path).should == true
59
+ # end
60
+ #
61
+ # it "should handle 404s from HTTP" do
62
+ # url = "http://limelight.8thlight.com/blah.blah"
63
+ # lambda { @downloader.download(url) }.should raise_error(Limelight::LimelightException, "Download failed. 404: Not Found")
64
+ #
65
+ # path = File.join(Limelight::Data.downloads_dir, "blah.blah")
66
+ # File.exists?(path).should == false
67
+ # end
68
+ #
69
+ # it "should downaload via HTTPS" do
70
+ # path = @downloader.download("https://www.8thlight.com/images/header.jpg")
71
+ #
72
+ # File.basename(path).should == "header.jpg"
73
+ # File.dirname(path).should == Limelight::Data.downloads_dir
74
+ # File.exists?(path).should == true
75
+ # end
76
+ #
77
+ # it "should know how to get the filename from Content-Disposition" do
78
+ # path = @downloader.download("http://localhost:3000/playbills/1.llp")
79
+ #
80
+ # File.basename(path).should == "simon.llp"
81
+ # end
82
+ #
83
+ # it "should handle HTTP redirects" do
84
+ # path = @downloader.download("http://rubyforge.org/frs/download.php/37521/limelight-0.0.1-java.gem")
85
+ #
86
+ # File.basename(path).should == "limelight-0.0.1-java.gem"
87
+ # end
88
+
89
+ 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.3.0
4
+ version: 0.3.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: 2008-11-05 00:00:00 -06:00
12
+ date: 2009-02-13 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -36,6 +36,7 @@ files:
36
36
  - lib/limelight/builtin/players/combo_box_popup_list_item.rb
37
37
  - lib/limelight/builtin/players/curtains.rb
38
38
  - lib/limelight/builtin/players/image.rb
39
+ - lib/limelight/builtin/players/password_box.rb
39
40
  - lib/limelight/builtin/players/radio_button.rb
40
41
  - lib/limelight/builtin/players/text_area.rb
41
42
  - lib/limelight/builtin/players/text_box.rb
@@ -43,12 +44,18 @@ files:
43
44
  - lib/limelight/builtin/styles.rb
44
45
  - lib/limelight/button_group_cache.rb
45
46
  - lib/limelight/casting_director.rb
47
+ - lib/limelight/client
48
+ - lib/limelight/client/playbills.rb
46
49
  - lib/limelight/commands
47
50
  - lib/limelight/commands/command.rb
48
51
  - lib/limelight/commands/create_command.rb
49
52
  - lib/limelight/commands/freeze_command.rb
53
+ - lib/limelight/commands/help_command.rb
50
54
  - lib/limelight/commands/open_command.rb
51
55
  - lib/limelight/commands/pack_command.rb
56
+ - lib/limelight/commands/unpack_command.rb
57
+ - lib/limelight/commands/version_command.rb
58
+ - lib/limelight/data.rb
52
59
  - lib/limelight/dsl
53
60
  - lib/limelight/dsl/build_exception.rb
54
61
  - lib/limelight/dsl/menu_bar.rb
@@ -93,6 +100,8 @@ files:
93
100
  - lib/limelight/templates/templater.rb
94
101
  - lib/limelight/templates/templater_logger.rb
95
102
  - lib/limelight/theater.rb
103
+ - lib/limelight/util
104
+ - lib/limelight/util/downloader.rb
96
105
  - lib/limelight/util.rb
97
106
  - lib/limelight/version.rb
98
107
  - lib/limelight.jar
@@ -100,15 +109,20 @@ files:
100
109
  - spec/builtin/players/check_box_spec.rb
101
110
  - spec/builtin/players/combo_box_spec.rb
102
111
  - spec/builtin/players/image_spec.rb
112
+ - spec/builtin/players/password_box_spec.rb
103
113
  - spec/builtin/players/radio_button_spec.rb
104
114
  - spec/builtin/players/text_area_spec.rb
105
115
  - spec/builtin/players/text_box_spec.rb
106
116
  - spec/casting_director_spec.rb
117
+ - spec/client/playbills_spec.rb
107
118
  - spec/commands/command_spec.rb
108
119
  - spec/commands/create_command_spec.rb
109
120
  - spec/commands/freeze_command_spec.rb
121
+ - spec/commands/help_command_spec.rb
110
122
  - spec/commands/open_command_spec.rb
111
123
  - spec/commands/pack_command_spec.rb
124
+ - spec/commands/unpack_command_spec.rb
125
+ - spec/data_spec.rb
112
126
  - spec/dsl/production_builder_spec.rb
113
127
  - spec/dsl/prop_builder_spec.rb
114
128
  - spec/dsl/stage_builder_spec.rb
@@ -135,6 +149,7 @@ files:
135
149
  - spec/templates/templater_logger_spec.rb
136
150
  - spec/templates/templater_spec.rb
137
151
  - spec/theater_spec.rb
152
+ - spec/util/downloader_spec.rb
138
153
  - productions/examples
139
154
  - productions/examples/8thlight.com
140
155
  - productions/examples/8thlight.com/about
@@ -195,6 +210,11 @@ files:
195
210
  - productions/examples/sandbox/floaters/players/surface.rb
196
211
  - productions/examples/sandbox/floaters/props.rb
197
212
  - productions/examples/sandbox/floaters/styles.rb
213
+ - productions/examples/sandbox/frameing
214
+ - productions/examples/sandbox/frameing/players
215
+ - productions/examples/sandbox/frameing/players/sandbox.rb
216
+ - productions/examples/sandbox/frameing/props.rb
217
+ - productions/examples/sandbox/frameing/styles.rb
198
218
  - productions/examples/sandbox/gradients
199
219
  - productions/examples/sandbox/gradients/players
200
220
  - productions/examples/sandbox/gradients/players/spinner.rb
@@ -266,7 +286,6 @@ files:
266
286
  - productions/examples/sandbox/teaser/players/fader.rb
267
287
  - productions/examples/sandbox/teaser/props.rb
268
288
  - productions/examples/sandbox/teaser/styles.rb
269
- - productions/examples/sandbox.llp
270
289
  - productions/examples/tutorials
271
290
  - productions/examples/tutorials/tutorial_1
272
291
  - productions/examples/tutorials/tutorial_1/players
@@ -296,12 +315,14 @@ files:
296
315
  - productions/startup/images
297
316
  - productions/startup/images/logo.png
298
317
  - productions/startup/images/splash.png
299
- - productions/startup/players
300
- - productions/startup/players/browse_button.rb
301
- - productions/startup/players/download_button.rb
302
- - productions/startup/players/sandbox_button.rb
303
- - productions/startup/props.rb
304
- - productions/startup/styles.rb
318
+ - productions/startup/stages.rb
319
+ - productions/startup/welcome
320
+ - productions/startup/welcome/players
321
+ - productions/startup/welcome/players/browse_button.rb
322
+ - productions/startup/welcome/players/download_button.rb
323
+ - productions/startup/welcome/players/sandbox_button.rb
324
+ - productions/startup/welcome/props.rb
325
+ - productions/startup/welcome/styles.rb
305
326
  - bin/icons
306
327
  - bin/icons/icon.ico
307
328
  - bin/icons/icon_48.gif
@@ -331,12 +352,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
352
  requirements: []
332
353
 
333
354
  rubyforge_project: limelight
334
- rubygems_version: 1.2.0
355
+ rubygems_version: 1.3.1
335
356
  signing_key:
336
357
  specification_version: 2
337
- summary: Limelight-0.3.0 - Limelight http://limelight.8thlight.com
358
+ summary: Limelight-0.3.1 - Limelight http://limelight.8thlight.com
338
359
  test_files:
339
360
  - spec/casting_director_spec.rb
361
+ - spec/data_spec.rb
340
362
  - spec/file_chooser_spec.rb
341
363
  - spec/file_filter_spec.rb
342
364
  - spec/file_loader_spec.rb