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.
- data/lib/init.rb +1 -1
- data/lib/limelight.jar +0 -0
- data/lib/limelight/builtin/players.rb +2 -1
- data/lib/limelight/builtin/players/combo_box.rb +2 -0
- data/lib/limelight/builtin/players/curtains.rb +1 -0
- data/lib/limelight/builtin/players/password_box.rb +34 -0
- data/lib/limelight/casting_director.rb +2 -1
- data/lib/limelight/client/playbills.rb +83 -0
- data/lib/limelight/commands/command.rb +14 -2
- data/lib/limelight/commands/help_command.rb +50 -0
- data/lib/limelight/commands/unpack_command.rb +44 -0
- data/lib/limelight/commands/version_command.rb +31 -0
- data/lib/limelight/data.rb +47 -0
- data/lib/limelight/java_couplings.rb +1 -0
- data/lib/limelight/limelight_exception.rb +13 -0
- data/lib/limelight/main.rb +22 -24
- data/lib/limelight/producer.rb +3 -2
- data/lib/limelight/prop.rb +2 -1
- data/lib/limelight/scene.rb +8 -1
- data/lib/limelight/util/downloader.rb +113 -0
- data/lib/limelight/version.rb +1 -1
- data/productions/examples/8thlight.com/styles.rb +147 -149
- data/productions/examples/calculator/styles.rb +2 -4
- data/productions/examples/langstons_ant/styles.rb +1 -2
- data/productions/examples/sandbox/click_me/players/chromaton.rb +2 -3
- data/productions/examples/sandbox/click_me/styles.rb +6 -7
- data/productions/examples/sandbox/floaters/players/floater.rb +2 -2
- data/productions/examples/sandbox/floaters/styles.rb +1 -2
- data/productions/examples/sandbox/frameing/players/sandbox.rb +14 -0
- data/productions/examples/sandbox/frameing/props.rb +32 -0
- data/productions/examples/sandbox/frameing/styles.rb +42 -0
- data/productions/examples/sandbox/header.rb +1 -0
- data/productions/examples/sandbox/homer/styles.rb +1 -2
- data/productions/examples/sandbox/images_scene/styles.rb +3 -2
- data/productions/examples/sandbox/inputs/styles.rb +0 -1
- data/productions/examples/sandbox/rounded_corners/styles.rb +1 -2
- data/productions/examples/sandbox/scrolling/styles.rb +1 -2
- data/productions/examples/sandbox/styles.rb +7 -9
- data/productions/examples/sandbox/teaser/styles.rb +1 -2
- data/productions/examples/tutorials/tutorial_1/styles.rb +2 -4
- data/productions/startup/stages.rb +6 -0
- data/productions/startup/{players → welcome/players}/browse_button.rb +0 -0
- data/productions/startup/{players → welcome/players}/download_button.rb +3 -3
- data/productions/startup/{players → welcome/players}/sandbox_button.rb +0 -0
- data/productions/startup/{props.rb → welcome/props.rb} +0 -0
- data/productions/startup/{styles.rb → welcome/styles.rb} +0 -0
- data/spec/builtin/players/password_box_spec.rb +27 -0
- data/spec/client/playbills_spec.rb +76 -0
- data/spec/commands/help_command_spec.rb +39 -0
- data/spec/commands/unpack_command_spec.rb +44 -0
- data/spec/data_spec.rb +47 -0
- data/spec/main_spec.rb +20 -0
- data/spec/prop_spec.rb +18 -0
- data/spec/scene_spec.rb +43 -0
- data/spec/spec_helper.rb +2 -1
- data/spec/util/downloader_spec.rb +89 -0
- metadata +33 -11
- data/productions/examples/sandbox.llp +0 -0
data/lib/init.rb
CHANGED
@@ -10,4 +10,4 @@ require File.expand_path(File.dirname(__FILE__) + "/limelight.jar")
|
|
10
10
|
|
11
11
|
# ENV["GEM_HOME"] = ENV["GEM_PATH"] = File.expand_path(File.dirname(__FILE__) + "/../../jruby/lib/ruby/gems/1.8")
|
12
12
|
require 'rubygems'
|
13
|
-
require 'limelight/java_couplings'
|
13
|
+
require 'limelight/java_couplings'
|
data/lib/limelight.jar
CHANGED
Binary file
|
@@ -10,4 +10,5 @@ require 'limelight/builtin/players/text_box'
|
|
10
10
|
require 'limelight/builtin/players/combo_box_popup_list_item'
|
11
11
|
require 'limelight/builtin/players/combo_box_popup_list'
|
12
12
|
require 'limelight/builtin/players/curtains'
|
13
|
-
require 'limelight/builtin/players/image'
|
13
|
+
require 'limelight/builtin/players/image'
|
14
|
+
require "limelight/builtin/players/password_box"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
|
+
|
4
|
+
module Limelight
|
5
|
+
module Builtin
|
6
|
+
module Players
|
7
|
+
|
8
|
+
# A Builtin Player that adds the look and behavior of a native password box. It may be applied in the PropBuilder DSL
|
9
|
+
# like so:
|
10
|
+
#
|
11
|
+
# my_password_box :players => "password_box"
|
12
|
+
#
|
13
|
+
# Props including this Player may implement any of the key and focus event hooks:
|
14
|
+
#
|
15
|
+
# key_pressed, key_typed, key_released, focus_gained, focus_lost
|
16
|
+
#
|
17
|
+
module PasswordBox
|
18
|
+
class << self
|
19
|
+
|
20
|
+
def extended(prop) #:nodoc:
|
21
|
+
password_box = Limelight::UI::Model::Inputs::PasswordBoxPanel.new
|
22
|
+
prop.panel.add(password_box)
|
23
|
+
prop.password_box = password_box.password_box
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_accessor :password_box #:nodoc:
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -38,7 +38,7 @@ module Limelight
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
def cast_player(prop, player_name)
|
41
|
+
def cast_player(prop, player_name)
|
42
42
|
recruiter = Recruiter.new(prop, player_name, @loader)
|
43
43
|
prop.include_player(recruiter.player) if recruiter.player_exists?
|
44
44
|
end
|
@@ -98,6 +98,7 @@ module Limelight
|
|
98
98
|
return nil
|
99
99
|
end
|
100
100
|
end
|
101
|
+
|
101
102
|
return player_filename
|
102
103
|
end
|
103
104
|
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
require 'uri'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module Limelight
|
6
|
+
module Client
|
7
|
+
|
8
|
+
class Playbills
|
9
|
+
|
10
|
+
def self.from_xml(xml, uri=nil)
|
11
|
+
playbills = []
|
12
|
+
doc = REXML::Document.new(xml)
|
13
|
+
doc.root.each_element do |playbill_element|
|
14
|
+
playbills << Playbill.from_element(playbill_element, uri)
|
15
|
+
end
|
16
|
+
return playbills
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.from_url(url)
|
20
|
+
uri = URI.parse(url)
|
21
|
+
response = Net::HTTP.get_response(uri)
|
22
|
+
return from_xml(response.body, uri)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
class Playbill
|
28
|
+
|
29
|
+
def self.from_element(element, uri=nil)
|
30
|
+
playbill = Playbill.new(uri)
|
31
|
+
playbill.populate_from_element(element)
|
32
|
+
return playbill
|
33
|
+
end
|
34
|
+
|
35
|
+
def populate_from_element(element)
|
36
|
+
element.each_element do |element|
|
37
|
+
name = element.name.gsub("-", "_")
|
38
|
+
setter_sym = "#{name}=".to_sym
|
39
|
+
self.send(setter_sym, coerce_value(element))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
attr_accessor :author, :created_at, :description, :id, :name, :size, :title, :updated_at, :version, :llp_path, :thumbnail_path
|
44
|
+
attr_reader :uri
|
45
|
+
|
46
|
+
def initialize(uri=nil)
|
47
|
+
@uri = uri
|
48
|
+
end
|
49
|
+
|
50
|
+
def thumbnail
|
51
|
+
return pull(thumbnail_path)
|
52
|
+
end
|
53
|
+
|
54
|
+
def llp
|
55
|
+
return pull(llp_path)
|
56
|
+
end
|
57
|
+
|
58
|
+
private #############################################
|
59
|
+
|
60
|
+
def coerce_value(element)
|
61
|
+
value = element.text
|
62
|
+
type_attribute = element.attribute("type")
|
63
|
+
return value if type_attribute.nil?
|
64
|
+
case type_attribute.value
|
65
|
+
when "datetime"
|
66
|
+
value = DateTime.parse(value)
|
67
|
+
when "integer"
|
68
|
+
value = value.to_i
|
69
|
+
end
|
70
|
+
return value
|
71
|
+
end
|
72
|
+
|
73
|
+
def pull(path)
|
74
|
+
new_uri = uri.dup
|
75
|
+
new_uri.path = path
|
76
|
+
response = Net::HTTP.get_response(new_uri)
|
77
|
+
return response.body
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
@@ -7,12 +7,12 @@ module Limelight
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
-
def [](name)
|
10
|
+
def [](name) #:nodoc:
|
11
11
|
load_listing if !@listing_loaded
|
12
12
|
return LISTING[name]
|
13
13
|
end
|
14
14
|
|
15
|
-
def load_listing
|
15
|
+
def load_listing #:nodoc:
|
16
16
|
Dir.entries(File.dirname(__FILE__)).each do |file|
|
17
17
|
if file != "." && file != ".."
|
18
18
|
require "limelight/commands/#{file.gsub('.rb', '')}"
|
@@ -21,6 +21,14 @@ module Limelight
|
|
21
21
|
@listing_loaded = true
|
22
22
|
end
|
23
23
|
|
24
|
+
def output=(value) #:nodoc:
|
25
|
+
@output = value
|
26
|
+
end
|
27
|
+
|
28
|
+
def output #:nodoc:
|
29
|
+
return @output || $stdout
|
30
|
+
end
|
31
|
+
|
24
32
|
end
|
25
33
|
|
26
34
|
# The base class for all limelight commands. The following is a list of them all.
|
@@ -90,6 +98,10 @@ module Limelight
|
|
90
98
|
|
91
99
|
protected ###########################################
|
92
100
|
|
101
|
+
def puts(*args) #:nodoc:
|
102
|
+
Commands.output.puts(*args)
|
103
|
+
end
|
104
|
+
|
93
105
|
# Prints an exception that occurs while parsing the arguments. The usages summary will follow.
|
94
106
|
#
|
95
107
|
def parse_error(exception = nil)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
|
+
|
4
|
+
require 'limelight/commands/command'
|
5
|
+
|
6
|
+
module Limelight
|
7
|
+
module Commands
|
8
|
+
|
9
|
+
# Prints limelight command help
|
10
|
+
#
|
11
|
+
class HelpCommand < Command
|
12
|
+
|
13
|
+
install_as "help"
|
14
|
+
|
15
|
+
def self.description #:nodoc:
|
16
|
+
return "Prints limelight command help"
|
17
|
+
end
|
18
|
+
|
19
|
+
protected ###########################################
|
20
|
+
|
21
|
+
def process #:nodoc:
|
22
|
+
@options = []
|
23
|
+
@commands = []
|
24
|
+
sort_commands
|
25
|
+
puts ""
|
26
|
+
puts "Usage: limelight #{@options.join(' ')} <command> [options] [params]"
|
27
|
+
puts " commands:"
|
28
|
+
@commands.each do |command|
|
29
|
+
puts command
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private #############################################
|
34
|
+
|
35
|
+
def sort_commands
|
36
|
+
Commands::LISTING.each_pair do |key, command|
|
37
|
+
if key[0...1] == "-"
|
38
|
+
@options << "[#{key}]"
|
39
|
+
else
|
40
|
+
@commands << "\t#{key}\t\t#{command.description}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
|
+
|
4
|
+
require 'limelight/commands/command'
|
5
|
+
|
6
|
+
module Limelight
|
7
|
+
module Commands
|
8
|
+
|
9
|
+
# See the following usage summary.
|
10
|
+
#
|
11
|
+
# Usage: limelight unpack <production_path>
|
12
|
+
# Unpack a limelight production into the tmp directory.
|
13
|
+
# options:
|
14
|
+
# -h, --help Prints this usage summary.
|
15
|
+
#
|
16
|
+
class UnpackCommand < Command
|
17
|
+
|
18
|
+
install_as "unpack"
|
19
|
+
|
20
|
+
def self.description #:nodoc:
|
21
|
+
return "Unpack a limelight production into the tmp directory."
|
22
|
+
end
|
23
|
+
|
24
|
+
protected ###########################################
|
25
|
+
|
26
|
+
def parameter_description #:nodoc:
|
27
|
+
return "<production_path>"
|
28
|
+
end
|
29
|
+
|
30
|
+
def parse_remainder(args) #:nodoc:
|
31
|
+
@production_path = args.shift
|
32
|
+
raise "Missing production path" if @production_path.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
def process #:nodoc:
|
36
|
+
Main.initialize_temp_directory
|
37
|
+
packer = Limelight::Util::Packer.new
|
38
|
+
location = packer.unpack(@production_path)
|
39
|
+
puts "Production was unpacked to: #{location}"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#- Copyright 2008 8th Light, Inc. All Rights Reserved.
|
2
|
+
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
|
+
|
4
|
+
require 'limelight/commands/command'
|
5
|
+
|
6
|
+
module Limelight
|
7
|
+
module Commands
|
8
|
+
|
9
|
+
# Prints the current Limelight version
|
10
|
+
#
|
11
|
+
class VersionCommand < Command
|
12
|
+
|
13
|
+
install_as "--version"
|
14
|
+
|
15
|
+
def self.description #:nodoc:
|
16
|
+
return "Prints the current Limelight version"
|
17
|
+
end
|
18
|
+
|
19
|
+
protected ###########################################
|
20
|
+
|
21
|
+
def process #:nodoc:
|
22
|
+
require 'limelight/version'
|
23
|
+
puts "Limelight, version #{VERSION::STRING}"
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Limelight
|
2
|
+
|
3
|
+
class Data
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def reset
|
8
|
+
@root = nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def root
|
12
|
+
@root = calculate_root if @root == nil
|
13
|
+
return @root
|
14
|
+
end
|
15
|
+
|
16
|
+
def downloads_dir
|
17
|
+
return File.join(root, "Downloads")
|
18
|
+
end
|
19
|
+
|
20
|
+
def productions_dir
|
21
|
+
return File.join(root, "Productions")
|
22
|
+
end
|
23
|
+
|
24
|
+
def establish_data_dirs
|
25
|
+
Dir.mkdir(root) if !File.exists?(root)
|
26
|
+
Dir.mkdir(downloads_dir) if !File.exists?(downloads_dir)
|
27
|
+
Dir.mkdir(productions_dir) if !File.exists?(productions_dir)
|
28
|
+
end
|
29
|
+
|
30
|
+
private #############################################
|
31
|
+
|
32
|
+
def calculate_root
|
33
|
+
case Context.instance.os
|
34
|
+
when "osx"
|
35
|
+
return File.expand_path(File.join("~/Library/Application Support/Limelight"))
|
36
|
+
when "windows"
|
37
|
+
return File.expand_path(File.join("~/Application Data/Limelight"))
|
38
|
+
else
|
39
|
+
raise "Unknown operating system: #{Context.os}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -38,6 +38,7 @@ module Limelight #:nodoc:
|
|
38
38
|
RadioButtonPanel = Java::limelight.ui.model.inputs.RadioButtonPanel
|
39
39
|
TextAreaPanel = Java::limelight.ui.model.inputs.TextAreaPanel
|
40
40
|
TextBoxPanel = Java::limelight.ui.model.inputs.TextBoxPanel
|
41
|
+
PasswordBoxPanel = Java::limelight.ui.model.inputs.PasswordBoxPanel
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -6,6 +6,19 @@ module Limelight
|
|
6
6
|
# Most exeception thrown by Limelight Ruby code will be of this type.
|
7
7
|
#
|
8
8
|
class LimelightException < Exception
|
9
|
+
|
10
|
+
def initialize(thing)
|
11
|
+
case thing
|
12
|
+
when String
|
13
|
+
super(thing)
|
14
|
+
when Exception
|
15
|
+
super("#{thing.class}: #{thing.message}")
|
16
|
+
set_backtrace(thing.backtrace)
|
17
|
+
else
|
18
|
+
raise "Can't build LimelightException out of #{thing}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
9
22
|
end
|
10
23
|
|
11
24
|
end
|
data/lib/limelight/main.rb
CHANGED
@@ -74,35 +74,33 @@ module Limelight
|
|
74
74
|
# See Limelight::Commands
|
75
75
|
#
|
76
76
|
class Main
|
77
|
+
|
78
|
+
# Instantiates a new instance of Main to process the command
|
79
|
+
#
|
80
|
+
def self.run(args)
|
81
|
+
new().run(args)
|
82
|
+
end
|
77
83
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
command
|
85
|
-
|
86
|
-
|
87
|
-
else
|
88
|
-
usage
|
89
|
-
end
|
84
|
+
# Executes behavior of limelight command.
|
85
|
+
#
|
86
|
+
def run(args)
|
87
|
+
command_name = args.shift
|
88
|
+
command = Commands[command_name]
|
89
|
+
if command
|
90
|
+
command.new.run(args)
|
91
|
+
else
|
92
|
+
usage
|
90
93
|
end
|
94
|
+
end
|
91
95
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
puts " commands:"
|
98
|
-
Commands::LISTING.keys.sort.each do |key|
|
99
|
-
command = Commands[key]
|
100
|
-
puts "\t#{key}\t\t#{command.description}"
|
101
|
-
end
|
102
|
-
exit -1
|
103
|
-
end
|
96
|
+
# Prints the usage of the limelight command.
|
97
|
+
#
|
98
|
+
def usage
|
99
|
+
Commands["help"].new.run([])
|
100
|
+
exit -1
|
104
101
|
end
|
105
102
|
|
103
|
+
private ###############################################
|
106
104
|
|
107
105
|
end
|
108
106
|
|