limelight 0.2.1-java → 0.3.0-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/bin/ll.bat +1 -1
- data/lib/i4jruntime.jar +0 -0
- data/lib/junit-4.4.jar +0 -0
- data/lib/limelight.jar +0 -0
- data/lib/limelight/animation.rb +3 -3
- data/lib/limelight/builtin/players.rb +2 -1
- data/lib/limelight/builtin/players/combo_box.rb +8 -2
- data/lib/limelight/builtin/players/image.rb +47 -0
- data/lib/limelight/builtin/styles.rb +1 -1
- data/lib/limelight/casting_director.rb +70 -39
- data/lib/limelight/commands/command.rb +150 -0
- data/lib/limelight/commands/create_command.rb +79 -0
- data/lib/limelight/commands/freeze_command.rb +113 -0
- data/lib/limelight/commands/open_command.rb +49 -0
- data/lib/limelight/commands/pack_command.rb +45 -0
- data/lib/limelight/dsl/build_exception.rb +51 -0
- data/lib/limelight/dsl/menu_bar.rb +71 -0
- data/lib/limelight/dsl/production_builder.rb +71 -0
- data/lib/limelight/dsl/prop_builder.rb +155 -0
- data/lib/limelight/dsl/stage_builder.rb +105 -0
- data/lib/limelight/dsl/styles_builder.rb +134 -0
- data/lib/limelight/file_loader.rb +46 -0
- data/lib/limelight/gems.rb +45 -0
- data/lib/limelight/java_couplings.rb +7 -2
- data/lib/limelight/java_util.rb +2 -15
- data/lib/limelight/main.rb +7 -5
- data/lib/limelight/producer.rb +87 -66
- data/lib/limelight/production.rb +42 -4
- data/lib/limelight/prop.rb +84 -70
- data/lib/limelight/scene.rb +75 -20
- data/lib/limelight/specs/spec_helper.rb +58 -0
- data/lib/limelight/stage.rb +11 -6
- data/lib/limelight/string.rb +35 -0
- data/lib/limelight/studio.rb +29 -0
- data/lib/limelight/templates/production_templater.rb +42 -0
- data/lib/limelight/templates/scene_templater.rb +41 -0
- data/lib/limelight/templates/sources/freezing/limelight_init.rb.template +5 -0
- data/lib/limelight/templates/sources/production/init.rb.template +15 -0
- data/lib/limelight/templates/sources/production/production.rb.template +9 -0
- data/lib/limelight/templates/sources/production/stages.rb.template +17 -0
- data/lib/limelight/templates/sources/production/styles.rb.template +12 -0
- data/lib/limelight/templates/sources/scene/props.rb.template +6 -0
- data/lib/limelight/templates/sources/scene/styles.rb.template +18 -0
- data/lib/limelight/templates/templater.rb +128 -0
- data/lib/limelight/templates/templater_logger.rb +36 -0
- data/lib/limelight/theater.rb +21 -7
- data/lib/limelight/util.rb +22 -6
- data/lib/limelight/version.rb +2 -2
- data/productions/examples/8thlight.com/styles.rb +1 -1
- data/productions/examples/langstons_ant/html_javascript/ant.html +1 -1
- data/productions/examples/langstons_ant/init.rb +1 -0
- data/productions/examples/langstons_ant/players/log.rb +2 -2
- data/productions/examples/langstons_ant/players/world.rb +0 -26
- data/productions/examples/sandbox.llp +0 -0
- data/productions/examples/sandbox/click_me/players/chromaton.rb +10 -4
- data/productions/examples/sandbox/floaters/players/floater.rb +4 -2
- data/productions/examples/sandbox/gradients/players/spinner.rb +5 -1
- data/productions/examples/sandbox/gradients/players/teaser.rb +2 -2
- data/productions/examples/sandbox/gradients/players/wave.rb +2 -2
- data/productions/examples/sandbox/gradients/players/waves.rb +2 -2
- data/productions/examples/sandbox/header.rb +1 -0
- data/productions/examples/sandbox/images/logo.png +0 -0
- data/productions/examples/sandbox/images_scene/props.rb +25 -0
- data/productions/examples/sandbox/images_scene/styles.rb +30 -0
- data/productions/examples/sandbox/inputs/styles.rb +1 -1
- data/productions/examples/sandbox/scrolling/props.rb +12 -12
- data/productions/examples/sandbox/teaser/players/fader.rb +2 -8
- data/productions/stage_composer/inspector/styles.rb +2 -2
- data/productions/startup/styles.rb +2 -2
- data/spec/builtin/players/button_spec.rb +0 -1
- data/spec/builtin/players/image_spec.rb +41 -0
- data/spec/casting_director_spec.rb +114 -44
- data/spec/commands/command_spec.rb +18 -0
- data/spec/commands/create_command_spec.rb +74 -0
- data/spec/commands/freeze_command_spec.rb +59 -0
- data/spec/commands/open_command_spec.rb +30 -0
- data/spec/commands/pack_command_spec.rb +23 -0
- data/spec/dsl/production_builder_spec.rb +46 -0
- data/spec/{prop_builder_spec.rb → dsl/prop_builder_spec.rb} +80 -24
- data/spec/{stage_builder_spec.rb → dsl/stage_builder_spec.rb} +4 -4
- data/spec/{styles_builder_spec.rb → dsl/styles_builder_spec.rb} +6 -6
- data/spec/{loaders/file_loader_spec.rb → file_loader_spec.rb} +4 -4
- data/spec/gems_spec.rb +83 -0
- data/spec/java_util_spec.rb +1 -17
- data/spec/main_spec.rb +17 -0
- data/spec/producer_spec.rb +89 -79
- data/spec/production_spec.rb +28 -3
- data/spec/prop_spec.rb +82 -16
- data/spec/scene_spec.rb +73 -3
- data/spec/spec_helper.rb +37 -1
- data/spec/stage_spec.rb +10 -1
- data/spec/string_spec.rb +35 -0
- data/spec/studio_spec.rb +14 -0
- data/spec/styles_spec.rb +14 -0
- data/spec/templates/production_templater_spec.rb +44 -0
- data/spec/templates/scene_templater_spec.rb +25 -0
- data/spec/templates/templater_logger_spec.rb +38 -0
- data/spec/templates/templater_spec.rb +104 -0
- data/spec/theater_spec.rb +12 -21
- metadata +75 -23
- data/bin/icons/splash.png +0 -0
- data/lib/limelight/build_exception.rb +0 -48
- data/lib/limelight/commands.rb +0 -52
- data/lib/limelight/loaders/file_scene_loader.rb +0 -49
- data/lib/limelight/menu_bar.rb +0 -68
- data/lib/limelight/production_builder.rb +0 -66
- data/lib/limelight/prop_builder.rb +0 -119
- data/lib/limelight/stage_builder.rb +0 -103
- data/lib/limelight/styles_builder.rb +0 -131
- data/spec/commands_spec.rb +0 -34
- data/spec/production_builder_spec.rb +0 -48
|
@@ -1,66 +0,0 @@
|
|
|
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/production'
|
|
5
|
-
require 'limelight/limelight_exception'
|
|
6
|
-
|
|
7
|
-
module Limelight
|
|
8
|
-
|
|
9
|
-
# A trigger to configure Production objects using the ProductionBuilder DSL.
|
|
10
|
-
#
|
|
11
|
-
# See Limelight::ProductionBuilder
|
|
12
|
-
#
|
|
13
|
-
def self.build_production(producer, theater, &block)
|
|
14
|
-
builder = ProductionBuilder.new(producer, theater)
|
|
15
|
-
builder.instance_eval(&block) if block
|
|
16
|
-
return builder.__production__
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# The basis of the DSL for building Style objects.
|
|
20
|
-
#
|
|
21
|
-
# name "Stage Composer"
|
|
22
|
-
# attribute :controller
|
|
23
|
-
# attribute :inspector
|
|
24
|
-
#
|
|
25
|
-
# The above example names the Production 'Stage Composer' and creates two attributes on the Production: 'controller'
|
|
26
|
-
# and 'inspector'
|
|
27
|
-
#
|
|
28
|
-
class ProductionBuilder
|
|
29
|
-
|
|
30
|
-
class << self
|
|
31
|
-
|
|
32
|
-
attr_accessor :current_attribute
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
attr_reader :__production__
|
|
37
|
-
|
|
38
|
-
def initialize(producer, theater)
|
|
39
|
-
@__production__ = Production.new(producer, theater)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def method_missing(sym, value) #:nodoc:
|
|
43
|
-
setter_sym = "#{sym}=".to_s
|
|
44
|
-
raise ProductionBuilderException.new(sym) if !@__production__.respond_to?(setter_sym)
|
|
45
|
-
@__production__.send(setter_sym, value)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
# Creates an attribute on the Production
|
|
49
|
-
#
|
|
50
|
-
def attribute(sym)
|
|
51
|
-
ProductionBuilder.current_attribute = sym
|
|
52
|
-
class << @__production__
|
|
53
|
-
attr_accessor ProductionBuilder.current_attribute
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Thrown if there is an error in the ProductionBuilder DSL
|
|
59
|
-
#
|
|
60
|
-
class ProductionBuilderException < LimelightException
|
|
61
|
-
def initialize(name)
|
|
62
|
-
super("'#{name}' is not a valid production property")
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
@@ -1,119 +0,0 @@
|
|
|
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/prop'
|
|
5
|
-
require 'limelight/scene'
|
|
6
|
-
require 'limelight/build_exception'
|
|
7
|
-
require 'limelight/util'
|
|
8
|
-
|
|
9
|
-
module Limelight
|
|
10
|
-
|
|
11
|
-
# A trigger to build a Limelight::Scene using the PropBuilder DSL.
|
|
12
|
-
#
|
|
13
|
-
# See Limelight::PropBuilder
|
|
14
|
-
#
|
|
15
|
-
def self.build_scene(options={}, &block)
|
|
16
|
-
loader = options.delete(:build_loader)
|
|
17
|
-
builder = SceneBuilder.new(options)
|
|
18
|
-
builder.__loader__ = loader
|
|
19
|
-
builder.instance_eval(&block) if block
|
|
20
|
-
return builder.__prop__
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# The basis of the DSL for building Limelight::Prop objects.
|
|
24
|
-
#
|
|
25
|
-
# Sample usage:
|
|
26
|
-
#
|
|
27
|
-
# builder = Limelight::PropBuilder.new(a_prop)
|
|
28
|
-
# builder.instance_eval(&block)
|
|
29
|
-
#
|
|
30
|
-
# The prop passed into the constructor will be the root of the contructed Prop tree.
|
|
31
|
-
# The block passed into instance_eval contains the DSL for building props.
|
|
32
|
-
#
|
|
33
|
-
# Example block/DSL:
|
|
34
|
-
#
|
|
35
|
-
# parent :id => "the_parent" do
|
|
36
|
-
# child_one do
|
|
37
|
-
# grand_child_one :id => "gc_1", :styles => "grand_child"
|
|
38
|
-
# grand_child_two :id => "gc_2", :styles => "grand_child"
|
|
39
|
-
# end
|
|
40
|
-
# child_two
|
|
41
|
-
# end
|
|
42
|
-
#
|
|
43
|
-
# The above example will create a Limelight::Prop named 'parent' and add it to the root prop passed into the builder.
|
|
44
|
-
# The 'parent' prop will contain two props named 'child_one' and 'child_two'. 'child_one' will contain two props named
|
|
45
|
-
# 'grand_child_one' and 'grand_child_two'. 'child_two' has no child props nor do 'grand_child_one' or 'grand_child_two'.
|
|
46
|
-
#
|
|
47
|
-
# An options Hash may be passed into each prop. The key, value pairs in the hash will be used to set properties on the prop
|
|
48
|
-
# when it is added to a Limelight::Scene.
|
|
49
|
-
#
|
|
50
|
-
# See Limelight::Prop
|
|
51
|
-
#
|
|
52
|
-
class PropBuilder
|
|
53
|
-
|
|
54
|
-
Limelight::Util.lobotomize(self)
|
|
55
|
-
|
|
56
|
-
# Returns the root prop either passed in or created by this builder.
|
|
57
|
-
#
|
|
58
|
-
attr_reader :__prop__
|
|
59
|
-
attr_accessor :__loader__
|
|
60
|
-
|
|
61
|
-
# Creates a new builder. If a prop is passed it, it will be the root on which props are created.
|
|
62
|
-
# If the paramter is a Hash, the Hash will be used to construct a prop that will be used as the root.
|
|
63
|
-
#
|
|
64
|
-
def initialize(options)
|
|
65
|
-
if options.is_a?(Prop)
|
|
66
|
-
@__prop__ = options
|
|
67
|
-
else
|
|
68
|
-
@__prop__ = Prop.new(options)
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
# Add extra initialization options to the prop currently under construction.
|
|
73
|
-
#
|
|
74
|
-
# tree :id => "stump" do
|
|
75
|
-
# __ :height => "100%", :width => "30", :background_color => :brown
|
|
76
|
-
# branch :height => "100", :width => "20"
|
|
77
|
-
# branch do
|
|
78
|
-
# __ :height => "100", :width => "20"
|
|
79
|
-
# end
|
|
80
|
-
# end
|
|
81
|
-
#
|
|
82
|
-
# In the above example, the 'tree' prop has the following initialization options: id, height, width, background_color.
|
|
83
|
-
# The two 'branch' child props are identical.
|
|
84
|
-
#
|
|
85
|
-
def __(options)
|
|
86
|
-
@__prop__.add_options(options)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
# Installs props from another file using the prop DSL. The path will be relative to the
|
|
90
|
-
# root directory of the current production.
|
|
91
|
-
#
|
|
92
|
-
def __install(file)
|
|
93
|
-
raise "Cannot install external props because no loader was provided" if @__loader__.nil?
|
|
94
|
-
raise "External prop file: '#{file}' doesn't exist" if !@__loader__.exists?(file)
|
|
95
|
-
content = @__loader__.load(file)
|
|
96
|
-
begin
|
|
97
|
-
self.instance_eval(content)
|
|
98
|
-
rescue Exception => e
|
|
99
|
-
raise BuildException.new(file, content, e)
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def method_missing(sym, options={}, &prop) # :nodoc:
|
|
105
|
-
options[:name] ||= sym.to_s
|
|
106
|
-
builder = PropBuilder.new(options)
|
|
107
|
-
builder.__loader__ = @__loader__
|
|
108
|
-
builder.instance_eval(&prop) if prop
|
|
109
|
-
@__prop__.add(builder.__prop__)
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
class SceneBuilder < PropBuilder # :nodoc:
|
|
114
|
-
def initialize(options)
|
|
115
|
-
@__prop__ = Scene.new(options)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
end
|
|
@@ -1,103 +0,0 @@
|
|
|
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/stage'
|
|
5
|
-
require 'limelight/limelight_exception'
|
|
6
|
-
|
|
7
|
-
module Limelight
|
|
8
|
-
|
|
9
|
-
# A trigger to build/configure Stage objects using the StageBuilder DSL.
|
|
10
|
-
#
|
|
11
|
-
# See Limelight::Stagesbuilder, Limelight::Stagebuilder
|
|
12
|
-
#
|
|
13
|
-
def self.build_stages(theater, &block)
|
|
14
|
-
builder = StagesBuilder.new(theater)
|
|
15
|
-
builder.instance_eval(&block) if block
|
|
16
|
-
return builder.__stages__
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# The basis of the DSL for building Stage objects.
|
|
20
|
-
#
|
|
21
|
-
# stage "inspector" do
|
|
22
|
-
# default_scene "inspector"
|
|
23
|
-
# title "Limelight Composer Inspector"
|
|
24
|
-
# location [0, 0]
|
|
25
|
-
# size [300, 800]
|
|
26
|
-
# end
|
|
27
|
-
#
|
|
28
|
-
# stage "viewer" do
|
|
29
|
-
# title "Limelight Composer Viewer"
|
|
30
|
-
# location [350, 0]
|
|
31
|
-
# size [800, 800]
|
|
32
|
-
# end
|
|
33
|
-
#
|
|
34
|
-
# In this example above, two stages are created for the production. One is named 'inspector' and the other is named
|
|
35
|
-
# 'viewer'. 'inspector' has a default scene that will be loaded on startup. 'viewer' will not contain any scene
|
|
36
|
-
# on startup. Using the DSL, each stage can be configured to set the title, location, size, or any other attribute
|
|
37
|
-
# of a stage.
|
|
38
|
-
#
|
|
39
|
-
# See Limelight::Stage
|
|
40
|
-
#
|
|
41
|
-
class StagesBuilder
|
|
42
|
-
|
|
43
|
-
Limelight::Util.lobotomize(self)
|
|
44
|
-
|
|
45
|
-
attr_reader :__stages__
|
|
46
|
-
|
|
47
|
-
# Constructs a new StagesBuilder. A Theater object is required as a parameter. Each stages created will belong
|
|
48
|
-
# to the Theater passed in.
|
|
49
|
-
#
|
|
50
|
-
def initialize(theater)
|
|
51
|
-
@__theater__ = theater
|
|
52
|
-
@__stages__ = []
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Creates a new stage with the provided name. The block will contain StageBuilder DSL to configure the stage.
|
|
56
|
-
#
|
|
57
|
-
def stage(name, &block)
|
|
58
|
-
stage_builder = StageBuilder.new(@__theater__, name)
|
|
59
|
-
stage_builder.instance_eval(&block) if block
|
|
60
|
-
@__stages__ << stage_builder.__stage__
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# The basis of the DSL for configuring a Stage object.
|
|
66
|
-
#
|
|
67
|
-
class StageBuilder
|
|
68
|
-
|
|
69
|
-
Limelight::Util.lobotomize(self)
|
|
70
|
-
|
|
71
|
-
attr_reader :__stage__
|
|
72
|
-
|
|
73
|
-
def initialize(theater, name) #:nodoc:
|
|
74
|
-
if theater[name]
|
|
75
|
-
@__stage__ = theater[name]
|
|
76
|
-
else
|
|
77
|
-
@__stage__ = Stage.new(theater, name)
|
|
78
|
-
theater.add_stage(@__stage__)
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Specifies the scene that will be displayed on the stage upon opening of the production.
|
|
83
|
-
#
|
|
84
|
-
def default_scene(scene_name)
|
|
85
|
-
@__stage__.default_scene = scene_name
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def method_missing(sym, value) #:nodoc:
|
|
89
|
-
setter_sym = "#{sym}=".to_s
|
|
90
|
-
raise StageBuilderException.new(sym) if !@__stage__.respond_to?(setter_sym)
|
|
91
|
-
@__stage__.send(setter_sym, value)
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# Exception thrown by StageBuilder in the event of an invalid configuration.
|
|
96
|
-
#
|
|
97
|
-
class StageBuilderException < LimelightException
|
|
98
|
-
def initialize(name)
|
|
99
|
-
super("'#{name}' is not a valid stage property")
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
end
|
|
@@ -1,131 +0,0 @@
|
|
|
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
|
-
require 'limelight/util'
|
|
4
|
-
|
|
5
|
-
module Limelight
|
|
6
|
-
|
|
7
|
-
# A trigger to define Style objects using the StyleBuilder DSL.
|
|
8
|
-
#
|
|
9
|
-
# See Limelight::Stylesbuilder, Limelight::Stylebuilder
|
|
10
|
-
#
|
|
11
|
-
def self.build_styles(style_hash = nil, &block)
|
|
12
|
-
builder = StylesBuilder.new(style_hash)
|
|
13
|
-
builder.instance_eval(&block) if block
|
|
14
|
-
return builder.__styles__
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# The basis of the DSL for building Style objects.
|
|
18
|
-
#
|
|
19
|
-
# Sample StyleBuilder DSL
|
|
20
|
-
#
|
|
21
|
-
# sandbox {
|
|
22
|
-
# width "100%"
|
|
23
|
-
# height "100%"
|
|
24
|
-
# vertical_alignment :top
|
|
25
|
-
# }
|
|
26
|
-
#
|
|
27
|
-
# sample {
|
|
28
|
-
# width 320
|
|
29
|
-
# height 320
|
|
30
|
-
# gradient :on
|
|
31
|
-
# }
|
|
32
|
-
#
|
|
33
|
-
# spinner {
|
|
34
|
-
# extends :sample
|
|
35
|
-
# background_color :green
|
|
36
|
-
# secondary_background_color :blue
|
|
37
|
-
# gradient_angle 0
|
|
38
|
-
# gradient_penetration 100
|
|
39
|
-
# }
|
|
40
|
-
#
|
|
41
|
-
# This exmple builds three styles: sandbox, sample, spinner. Within each style block, the individual attributes of
|
|
42
|
-
# the style may be set.
|
|
43
|
-
#
|
|
44
|
-
# See Limelight::Styles
|
|
45
|
-
#
|
|
46
|
-
class StylesBuilder
|
|
47
|
-
|
|
48
|
-
Limelight::Util.lobotomize(self)
|
|
49
|
-
|
|
50
|
-
attr_reader :__styles__
|
|
51
|
-
|
|
52
|
-
def initialize(style_hash = nil)
|
|
53
|
-
@__styles__ = style_hash || {}
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def method_missing(sym, &block) #:nodoc:
|
|
57
|
-
__add_style__(sym.to_s, &block)
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def __add_style__(name, &block) #:nodoc:
|
|
61
|
-
builder = StyleBuilder.new(name, self)
|
|
62
|
-
builder.instance_eval(&block) if block
|
|
63
|
-
@__styles__[name] = builder.__style__
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# The basis of the DSL for defining a Style object.
|
|
68
|
-
#
|
|
69
|
-
class StyleBuilder
|
|
70
|
-
|
|
71
|
-
Limelight::Util.lobotomize(self)
|
|
72
|
-
|
|
73
|
-
attr_reader :__style__ #:nodoc:
|
|
74
|
-
|
|
75
|
-
def initialize(name, styles_builder, options = {}) #:nodoc:
|
|
76
|
-
@__name = name
|
|
77
|
-
@__styles_builder = styles_builder
|
|
78
|
-
@__style__ = @__styles_builder.__styles__[name] || Styles::RichStyle.new
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
# Used to define a hover style. Hover styles are appiled when the mouse passed over a prop using the specified style.
|
|
82
|
-
#
|
|
83
|
-
# spinner {
|
|
84
|
-
# width 50
|
|
85
|
-
# height 50
|
|
86
|
-
# hover {
|
|
87
|
-
# text_color :white
|
|
88
|
-
# }
|
|
89
|
-
# }
|
|
90
|
-
#
|
|
91
|
-
# The text color of props using the 'spinner' style will become white when the mouse hovers over them.
|
|
92
|
-
#
|
|
93
|
-
def hover(&block)
|
|
94
|
-
@__styles_builder.__add_style__("#{@__name}.hover", &block)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# Styles may extend other styles.
|
|
98
|
-
#
|
|
99
|
-
# base {
|
|
100
|
-
# background_color :red
|
|
101
|
-
# }
|
|
102
|
-
#
|
|
103
|
-
# cell {
|
|
104
|
-
# extends :base
|
|
105
|
-
# text_color :black
|
|
106
|
-
# }
|
|
107
|
-
#
|
|
108
|
-
# The 'cell' style now has all attributes defined in 'base'. Therefore any prop using the 'cell' style
|
|
109
|
-
# will have a red background. Styles may override attributes aquired through extension.
|
|
110
|
-
#
|
|
111
|
-
def extends(*style_names)
|
|
112
|
-
style_names.each do |style_name|
|
|
113
|
-
extension = @__styles_builder.__styles__[style_name.to_s]
|
|
114
|
-
raise StyleBuilderException.new("Can't extend missing style: '#{style_name}'") if extension.nil?
|
|
115
|
-
@__style__.add_extension(extension)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def method_missing(sym, value) #:nodoc:
|
|
120
|
-
setter_sym = "#{sym}=".to_s
|
|
121
|
-
raise StyleBuilderException.new("'#{sym}' is not a valid style") if !@__style__.respond_to?(setter_sym)
|
|
122
|
-
@__style__.send(setter_sym, value.to_s)
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
# Exception thrown by StyleBuilder when an error is encountered.
|
|
127
|
-
#
|
|
128
|
-
class StyleBuilderException < Exception
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
end
|
data/spec/commands_spec.rb
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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 File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
|
5
|
-
require 'limelight/commands'
|
|
6
|
-
require 'limelight/producer'
|
|
7
|
-
require 'limelight/main'
|
|
8
|
-
|
|
9
|
-
describe Limelight::Commands do
|
|
10
|
-
|
|
11
|
-
before(:each) do
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "should open a production" do
|
|
15
|
-
args = ["open", "production_name"]
|
|
16
|
-
Limelight::Producer.should_receive(:open).with("production_name")
|
|
17
|
-
Limelight::Main.run(args)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should open the default production" do
|
|
21
|
-
args = ["open"]
|
|
22
|
-
Limelight::Producer.should_receive(:open).with(Limelight::DEFAULT_PRODUCTION)
|
|
23
|
-
Limelight::Main.run(args)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "should pack a production" do
|
|
27
|
-
mock_packer = make_mock("packer")
|
|
28
|
-
Limelight::Util::Packer.should_receive(:new).and_return(mock_packer)
|
|
29
|
-
mock_packer.should_receive(:pack).with("production_to_pack")
|
|
30
|
-
|
|
31
|
-
Limelight::Main.run(["pack", "production_to_pack"])
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|