limelight 0.3.0-java → 0.3.1-java
Sign up to get free protection for your applications and to get access to all the features.
- 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/limelight/producer.rb
CHANGED
@@ -12,6 +12,7 @@ require 'limelight/dsl/build_exception'
|
|
12
12
|
require 'limelight/theater'
|
13
13
|
require 'limelight/production'
|
14
14
|
require 'limelight/gems'
|
15
|
+
require 'limelight/util/downloader'
|
15
16
|
|
16
17
|
module Limelight
|
17
18
|
|
@@ -38,7 +39,7 @@ module Limelight
|
|
38
39
|
def initialize(root_path, theater=nil, production=nil)
|
39
40
|
if (root_path[-4..-1] == ".lll")
|
40
41
|
url = IO.read(root_path).strip
|
41
|
-
root_path =
|
42
|
+
root_path = Util::Downloader.download(url)
|
42
43
|
end
|
43
44
|
if (root_path[-4..-1] == ".llp")
|
44
45
|
root_path = unpack_production(root_path)
|
@@ -59,7 +60,7 @@ module Limelight
|
|
59
60
|
#
|
60
61
|
def load(options = {})
|
61
62
|
establish_production
|
62
|
-
Gems.install_gems_in_production(@production)
|
63
|
+
Gems.install_gems_in_production(@production)
|
63
64
|
Kernel.load(@production.init_file) if ( !options[:ignore_init] && File.exists?(@production.init_file) )
|
64
65
|
load_stages if File.exists?(@production.stages_file)
|
65
66
|
end
|
data/lib/limelight/prop.rb
CHANGED
@@ -80,9 +80,10 @@ module Limelight
|
|
80
80
|
# child2
|
81
81
|
# end
|
82
82
|
#
|
83
|
-
def build(&block)
|
83
|
+
def build(options = {}, &block)
|
84
84
|
require 'limelight/dsl/prop_builder'
|
85
85
|
builder = Limelight::DSL::PropBuilder.new(self)
|
86
|
+
builder.__install_instance_variables(options)
|
86
87
|
builder.__loader__ = scene.loader
|
87
88
|
builder.instance_eval(&block)
|
88
89
|
end
|
data/lib/limelight/scene.rb
CHANGED
@@ -111,7 +111,14 @@ module Limelight
|
|
111
111
|
|
112
112
|
# Removed the Prop from the index.
|
113
113
|
#
|
114
|
-
def unindex_prop(prop)
|
114
|
+
def unindex_prop(prop)
|
115
|
+
prop.children.each do |child|
|
116
|
+
if child.children.empty?
|
117
|
+
@prop_index.delete(child.id)
|
118
|
+
else
|
119
|
+
unindex_prop(child)
|
120
|
+
end
|
121
|
+
end
|
115
122
|
@prop_index.delete(prop.id) if prop.id
|
116
123
|
end
|
117
124
|
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'limelight/data'
|
2
|
+
require 'limelight/limelight_exception'
|
3
|
+
require 'uri'
|
4
|
+
require 'ftools'
|
5
|
+
require 'net/http'
|
6
|
+
require 'net/https'
|
7
|
+
|
8
|
+
module Limelight
|
9
|
+
module Util
|
10
|
+
|
11
|
+
class Downloader
|
12
|
+
|
13
|
+
def self.download(resource)
|
14
|
+
puts "resource: #{resource}"
|
15
|
+
new.download(resource)
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
Data.establish_data_dirs
|
20
|
+
end
|
21
|
+
|
22
|
+
def download(resource)
|
23
|
+
uri = URI.parse(resource)
|
24
|
+
case uri.scheme
|
25
|
+
when nil, "file"
|
26
|
+
download_file(uri)
|
27
|
+
when 'http', 'https'
|
28
|
+
download_http(uri)
|
29
|
+
else
|
30
|
+
raise LimelightException.new("Download failed. Unhandled URI scheme: #{uri.scheme}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def download_file(uri)
|
35
|
+
raise LimelightException.new("Download failed. Not found: #{uri.path}") if !File.exists?(uri.path)
|
36
|
+
filename = File.basename(uri.path)
|
37
|
+
destination = find_unused_downloads_filename(filename)
|
38
|
+
File.copy(uri.path, destination)
|
39
|
+
return destination
|
40
|
+
end
|
41
|
+
|
42
|
+
def download_http(uri)
|
43
|
+
saved_filename = nil
|
44
|
+
|
45
|
+
begin
|
46
|
+
saved_filename = attempt_http_download(uri)
|
47
|
+
rescue Exception => e
|
48
|
+
raise LimelightException.new(e)
|
49
|
+
end
|
50
|
+
|
51
|
+
return saved_filename
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
private #############################################
|
56
|
+
|
57
|
+
def find_unused_downloads_filename(filename)
|
58
|
+
default = File.join(Data.downloads_dir, filename)
|
59
|
+
extension = File.extname(default)
|
60
|
+
filename_without_extension = default[0...(-1 * extension.length)]
|
61
|
+
attempt = default
|
62
|
+
postfix = 2
|
63
|
+
while (File.exists?(attempt))
|
64
|
+
attempt = "#{filename_without_extension}_#{postfix}#{extension}"
|
65
|
+
postfix += 1
|
66
|
+
end
|
67
|
+
return attempt
|
68
|
+
end
|
69
|
+
|
70
|
+
def calculate_filename(uri, response)
|
71
|
+
content_disposition = response['content-disposition']
|
72
|
+
if content_disposition
|
73
|
+
match = /filename="(.*)"/.match(content_disposition)
|
74
|
+
return match[1] if match
|
75
|
+
end
|
76
|
+
return File.basename(uri.path)
|
77
|
+
end
|
78
|
+
|
79
|
+
def save_to_file(uri, response)
|
80
|
+
filename = calculate_filename(uri, response)
|
81
|
+
destination = find_unused_downloads_filename(filename)
|
82
|
+
file = File.open(destination, 'w')
|
83
|
+
|
84
|
+
begin
|
85
|
+
response.read_body do |segment|
|
86
|
+
file.write(segment)
|
87
|
+
end
|
88
|
+
ensure
|
89
|
+
file.close
|
90
|
+
end
|
91
|
+
|
92
|
+
return destination
|
93
|
+
end
|
94
|
+
|
95
|
+
def attempt_http_download(uri, attempts = 5)
|
96
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
97
|
+
http.use_ssl = true if uri.port.to_s == "443"
|
98
|
+
http.request_get(uri.path) do |response|
|
99
|
+
case response
|
100
|
+
when Net::HTTPSuccess
|
101
|
+
return save_to_file(uri, response)
|
102
|
+
when Net::HTTPRedirection
|
103
|
+
return attempt_http_download(URI.parse(response['location']), attempts - 1)
|
104
|
+
else
|
105
|
+
raise LimelightException.new("Download failed. #{response.code}: #{response.message}")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
data/lib/limelight/version.rb
CHANGED
@@ -2,211 +2,209 @@
|
|
2
2
|
#- Limelight and all included source files are distributed under terms of the GNU LGPL.
|
3
3
|
|
4
4
|
page {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
width "100%"
|
6
|
+
height "100%"
|
7
|
+
horizontal_alignment "center"
|
8
|
+
background_image "images/bg.jpg"
|
9
9
|
vertical_scrollbar :on
|
10
10
|
}
|
11
|
-
|
11
|
+
|
12
12
|
main_column {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
border_width 0
|
14
|
+
background_image "images/canvas_bg.jpg"
|
15
|
+
width 823
|
16
|
+
height :auto
|
17
|
+
horizontal_alignment "center"
|
18
18
|
}
|
19
|
-
|
19
|
+
|
20
20
|
header {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
height 200
|
22
|
+
background_image "images/header.jpg"
|
23
|
+
width 823
|
24
|
+
horizontal_alignment "center"
|
25
25
|
}
|
26
26
|
|
27
27
|
menu {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
height 67
|
29
|
+
top_border_width 1
|
30
|
+
bottom_border_width 1
|
31
|
+
border_color "#333333"
|
32
|
+
width 823
|
33
|
+
horizontal_alignment :right
|
34
|
+
right_margin 25
|
35
|
+
left_margin 25
|
36
|
+
bottom_margin 15
|
37
37
|
}
|
38
38
|
|
39
39
|
link {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
40
|
+
width 80
|
41
|
+
height 50
|
42
|
+
text_color "#0049F4"
|
43
|
+
font_face "Arial"
|
44
|
+
font_size 13
|
45
|
+
alignment :center
|
46
|
+
hover {
|
47
|
+
text_color "#ffffff"
|
48
|
+
background_image "images/button_bg.jpg"
|
49
|
+
}
|
51
50
|
}
|
52
51
|
|
53
52
|
tag_line {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
}
|
67
|
-
|
53
|
+
width 823
|
54
|
+
height 70
|
55
|
+
background_image "images/anvil.jpg"
|
56
|
+
right_margin 25
|
57
|
+
left_margin 25
|
58
|
+
horizontal_alignment :left
|
59
|
+
font_style "italic"
|
60
|
+
text_color "white"
|
61
|
+
font_size 18
|
62
|
+
top_padding 10
|
63
|
+
left_padding 10
|
64
|
+
right_padding 375
|
65
|
+
}
|
66
|
+
|
68
67
|
services_tagline {
|
69
68
|
extends :tag_line
|
70
69
|
background_image "images/botticelli.jpg"
|
71
|
-
|
70
|
+
horizontal_alignment "right"
|
72
71
|
}
|
73
|
-
|
72
|
+
|
74
73
|
about_tagline {
|
75
74
|
extends :tag_line
|
76
|
-
|
77
|
-
|
75
|
+
background_image "images/moses.jpg"
|
76
|
+
horizontal_alignment "right"
|
78
77
|
}
|
79
|
-
|
78
|
+
|
80
79
|
section_title {
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
80
|
+
width 823
|
81
|
+
height 50
|
82
|
+
top_margin 20
|
83
|
+
left_margin 50
|
84
|
+
right_margin 50
|
85
|
+
bottom_border_width 1
|
86
|
+
border_color "#0049F4"
|
87
|
+
text_color "white"
|
88
|
+
font_size 20
|
89
|
+
font_style "bold"
|
91
90
|
}
|
92
91
|
|
93
92
|
sub_title {
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
text_color "#0049F4"
|
94
|
+
font_size 32
|
95
|
+
font_face "Courier"
|
97
96
|
}
|
98
|
-
|
97
|
+
|
99
98
|
section_body {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
99
|
+
width 823
|
100
|
+
height :auto
|
101
|
+
left_margin 50
|
102
|
+
right_margin 50
|
103
|
+
text_color "white"
|
104
|
+
font_size 14
|
106
105
|
}
|
107
106
|
|
108
107
|
spot_light {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
width 412
|
109
|
+
height 300
|
110
|
+
top_margin 20
|
111
|
+
left_margin 50
|
112
|
+
right_margin 50
|
114
113
|
}
|
115
|
-
|
114
|
+
|
116
115
|
spot_light_title {
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
116
|
+
width 312
|
117
|
+
height 45
|
118
|
+
bottom_border_width 1
|
119
|
+
border_color "#0049F4"
|
120
|
+
font_size 20
|
121
|
+
text_color "white"
|
123
122
|
}
|
124
123
|
|
125
124
|
book_news {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
height 75
|
126
|
+
width "100%"
|
127
|
+
bottom_border_width 1
|
128
|
+
border_color "#333333"
|
129
|
+
top_margin 10
|
131
130
|
}
|
132
|
-
|
131
|
+
|
133
132
|
book_news_img {
|
134
|
-
|
135
|
-
|
136
|
-
|
133
|
+
background_image "images/thumbnail_book.jpg"
|
134
|
+
width 59
|
135
|
+
height 58
|
137
136
|
}
|
138
|
-
|
137
|
+
|
139
138
|
book_news_text {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
139
|
+
width 253
|
140
|
+
height 58
|
141
|
+
left_margin 10
|
142
|
+
font_size 15
|
143
|
+
font_face "Helvetica"
|
144
|
+
text_color "#919191"
|
146
145
|
}
|
147
146
|
|
148
147
|
sm_news {
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
148
|
+
height 75
|
149
|
+
width "100%"
|
150
|
+
bottom_border_width 1
|
151
|
+
border_color "#333333"
|
152
|
+
top_margin 10
|
154
153
|
}
|
155
|
-
|
154
|
+
|
156
155
|
sm_news_img {
|
157
|
-
|
158
|
-
|
159
|
-
|
156
|
+
background_image "images/statemachine_thumbnail.png"
|
157
|
+
width 59
|
158
|
+
height 58
|
160
159
|
}
|
161
|
-
|
160
|
+
|
162
161
|
sm_news_text {
|
163
162
|
extends :book_news_text
|
164
163
|
}
|
165
164
|
|
166
165
|
news {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
166
|
+
width 411
|
167
|
+
height 320
|
168
|
+
top_margin 20
|
169
|
+
left_margin 30
|
170
|
+
right_margin 50
|
172
171
|
}
|
173
|
-
|
172
|
+
|
174
173
|
news_title {
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
174
|
+
width 311
|
175
|
+
height 45
|
176
|
+
bottom_border_width 1
|
177
|
+
border_color "#0049F4"
|
178
|
+
font_size 20
|
179
|
+
text_color "white"
|
181
180
|
}
|
182
181
|
|
183
182
|
new_item {
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
}
|
198
|
-
|
183
|
+
text_color "#919191"
|
184
|
+
font_size 12
|
185
|
+
font_face "Helvetica"
|
186
|
+
height 50
|
187
|
+
width "100%"
|
188
|
+
bottom_border_width 1
|
189
|
+
border_color "#333333"
|
190
|
+
top_margin 10
|
191
|
+
background_color "black"
|
192
|
+
hover {
|
193
|
+
text_color "white"
|
194
|
+
background_color "black"
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
199
198
|
footer {
|
200
|
-
|
201
|
-
|
202
|
-
|
199
|
+
background_image "images/footer_bg.jpg"
|
200
|
+
height 80
|
201
|
+
width 823
|
203
202
|
}
|
204
|
-
|
203
|
+
|
205
204
|
copyright {
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
height 80
|
205
|
+
top_margin 40
|
206
|
+
alignment :center
|
207
|
+
text_color "#666"
|
208
|
+
width 823
|
209
|
+
height 80
|
212
210
|
}
|