limelight 0.2.1-java → 0.3.0-java
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -3,21 +3,15 @@
|
|
3
3
|
|
4
4
|
module Fader
|
5
5
|
|
6
|
-
def self.extended(extended_block)
|
7
|
-
puts "#{self}.extended by #{extended_block}"
|
8
|
-
end
|
9
|
-
|
10
6
|
def mouse_entered(e)
|
11
7
|
@color = style.background_color
|
12
|
-
@base_alpha =
|
8
|
+
@base_alpha = @color[7..-1].hex
|
13
9
|
|
14
10
|
@step = (255 - @base_alpha) / 50
|
15
11
|
@step = 1 if @step == 0
|
16
12
|
@current_alpha = @base_alpha
|
17
|
-
|
13
|
+
|
18
14
|
@animation = animate(:updates_per_second => 25) do
|
19
|
-
puts "last update delay: #{Time.now - @lastUpdate}"
|
20
|
-
@lastUpdate = Time.now
|
21
15
|
@current_alpha += @step
|
22
16
|
if @current_alpha < @base_alpha
|
23
17
|
@current_alpha = @base_alpha
|
@@ -30,7 +30,7 @@ intro {
|
|
30
30
|
width "100%"
|
31
31
|
text_color :white
|
32
32
|
font_face "Arial Rounded MT Bold"
|
33
|
-
font_style "
|
33
|
+
font_style "italic"
|
34
34
|
font_size 25
|
35
35
|
}
|
36
36
|
|
@@ -73,7 +73,7 @@ browse_button {
|
|
73
73
|
width "100%"
|
74
74
|
text_color :white
|
75
75
|
font_face "Arial Rounded MT Bold"
|
76
|
-
font_style "
|
76
|
+
font_style "italic"
|
77
77
|
font_size 25
|
78
78
|
hover {
|
79
79
|
text_color "#67b313"
|
@@ -9,7 +9,6 @@ require 'limelight/builtin/players/button'
|
|
9
9
|
describe Limelight::Builtin::Players::Button do
|
10
10
|
|
11
11
|
before(:each) do
|
12
|
-
@scene = Limelight::Scene.new(:casting_director => make_mock("caster", :fill_cast => nil))
|
13
12
|
@prop = Limelight::Prop.new
|
14
13
|
@prop.include_player(Limelight::Builtin::Players::Button)
|
15
14
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
require 'limelight/builtin/players/image'
|
3
|
+
require 'limelight/prop'
|
4
|
+
|
5
|
+
describe Limelight::Builtin::Players::Image do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
# @scene = Limelight::Scene.new(:casting_director => make_mock("caster", :fill_cast => nil))
|
9
|
+
@prop = Limelight::Prop.new
|
10
|
+
@prop.include_player(Limelight::Builtin::Players::Image)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have a ImagePanel" do
|
14
|
+
image_panel = @prop.panel.children[0]
|
15
|
+
image_panel.class.should == Limelight::UI::Model::ImagePanel
|
16
|
+
@prop.image_panel.should be(image_panel)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have an image" do
|
20
|
+
@prop.image = "some/path_to/image.png"
|
21
|
+
@prop.panel.children[0].imageFile.should == "some/path_to/image.png";
|
22
|
+
@prop.image.should == "some/path_to/image.png";
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have rotation" do
|
26
|
+
@prop.rotation = 180
|
27
|
+
@prop.rotation.should == 180
|
28
|
+
@prop.image_panel.rotation.should == 180
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should have scaled" do
|
32
|
+
@prop.scaled?.should == true
|
33
|
+
@prop.image_panel.scaled.should == true
|
34
|
+
|
35
|
+
@prop.scaled = false;
|
36
|
+
|
37
|
+
@prop.scaled?.should == false
|
38
|
+
@prop.image_panel.scaled.should == false
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -3,13 +3,19 @@
|
|
3
3
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
5
5
|
require 'limelight/casting_director'
|
6
|
-
require 'limelight/prop_builder'
|
6
|
+
require 'limelight/dsl/prop_builder'
|
7
|
+
require 'limelight/production'
|
8
|
+
require 'limelight/file_loader'
|
7
9
|
|
8
10
|
describe Limelight::CastingDirector do
|
9
11
|
|
10
12
|
before(:each) do
|
11
|
-
|
12
|
-
|
13
|
+
TestDir.clean
|
14
|
+
$casted_props = []
|
15
|
+
$casted_players = []
|
16
|
+
@scene = Limelight::Scene.new(:casting_director => make_mock("casting_director", :fill_cast => nil), :path => TestDir.path("scene_path"))
|
17
|
+
@scene.illuminate
|
18
|
+
@loader = Limelight::FileLoader.for_root(TestDir.root)
|
13
19
|
@casting_director = Limelight::CastingDirector.new(@loader)
|
14
20
|
end
|
15
21
|
|
@@ -17,78 +23,142 @@ describe Limelight::CastingDirector do
|
|
17
23
|
@root = Limelight::Prop.new(options)
|
18
24
|
@scene << @root
|
19
25
|
end
|
26
|
+
|
27
|
+
def prepare_player(location, name, src = nil)
|
28
|
+
if src == nil
|
29
|
+
src = "module #{name.camalized}; def self.extended(prop); $casted_props << prop; $casted_players << self; end; end;"
|
30
|
+
end
|
31
|
+
TestDir.create_file("#{location}/players/#{name}.rb", src)
|
32
|
+
end
|
20
33
|
|
21
34
|
it "should include default players" do
|
22
|
-
|
35
|
+
prepare_player("scene_path", "root")
|
23
36
|
make_root(:name => "root")
|
24
37
|
|
25
|
-
@root.should_receive(:include_player).with("root module")
|
26
|
-
|
27
38
|
@casting_director.fill_cast(@root)
|
39
|
+
|
40
|
+
$casted_props.length.should == 1
|
41
|
+
$casted_props[0].should == @root
|
42
|
+
$casted_players[0].name.should include("Root")
|
43
|
+
@root.is_a?($casted_players[0]).should == true
|
28
44
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
45
|
+
|
46
|
+
it "should not creat the player in the scene's cast and not currupt the global namespace" do
|
47
|
+
prepare_player("scene_path", "root")
|
48
|
+
make_root(:name => "root")
|
49
|
+
|
50
|
+
@casting_director.fill_cast(@root)
|
51
|
+
|
52
|
+
Object.const_defined?("Root").should == false
|
53
|
+
@scene.cast.const_defined?("Root").should == true
|
36
54
|
end
|
37
55
|
|
38
56
|
it "should not load any default players if they don't exist" do
|
39
57
|
make_root(:name => "root")
|
40
|
-
@loader.stub!(:exists?).and_return false
|
41
|
-
|
42
58
|
@root.should_not_receive(:include_player)
|
43
|
-
@child.should_not_receive(:include_player)
|
44
|
-
@grandchild.should_not_receive(:include_player)
|
45
59
|
|
46
60
|
@casting_director.fill_cast(@root)
|
61
|
+
|
62
|
+
$casted_props.length.should == 0
|
63
|
+
$casted_players.length.should == 0
|
47
64
|
end
|
48
65
|
|
49
66
|
it "should not load any players if they don't define a module with the right name" do
|
50
67
|
make_root(:name => "root")
|
51
|
-
|
52
|
-
@loader.stub!(:path_to).and_return("blah")
|
53
|
-
Kernel.stub!(:load).and_return(true)
|
54
|
-
Object.stub!(:const_defined?).and_return(false)
|
55
|
-
|
68
|
+
prepare_player("scene_path", "root", "# empty file")
|
56
69
|
@root.should_not_receive(:include_player)
|
57
|
-
|
70
|
+
|
58
71
|
@casting_director.fill_cast(@root)
|
72
|
+
|
73
|
+
$casted_props.length.should == 0
|
74
|
+
$casted_players.length.should == 0
|
59
75
|
end
|
60
|
-
|
76
|
+
|
61
77
|
it "should load builtin players" do
|
62
|
-
@loader.stub!(:exists?).and_return(false)
|
63
78
|
make_root(:name => "root", :players => "button")
|
64
|
-
|
79
|
+
|
65
80
|
@casting_director.fill_cast(@root)
|
66
|
-
|
81
|
+
|
67
82
|
@root.is_a?(Limelight::Builtin::Players::Button).should == true
|
68
83
|
end
|
69
|
-
|
84
|
+
|
70
85
|
it "should load custom players" do
|
71
|
-
|
72
|
-
prepare_fake_player("custom_player")
|
86
|
+
prepare_player("scene_path", "custom_player")
|
73
87
|
make_root(:name => "root", :players => "custom_player")
|
74
|
-
|
75
|
-
@root.should_receive(:include_player).with("custom_player module")
|
76
|
-
|
88
|
+
|
77
89
|
@casting_director.fill_cast(@root)
|
78
|
-
|
79
|
-
|
90
|
+
|
91
|
+
$casted_props[0].should == @root
|
92
|
+
$casted_players[0].name.should include("CustomPlayer");
|
93
|
+
@root.is_a?($casted_players[0]).should == true
|
94
|
+
end
|
95
|
+
|
80
96
|
it "should handle multiple players" do
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
97
|
+
prepare_player("scene_path", "root")
|
98
|
+
prepare_player("scene_path", "custom_player")
|
99
|
+
|
85
100
|
make_root(:name => "root", :players => "custom_player button")
|
86
|
-
|
87
|
-
@
|
88
|
-
|
89
|
-
@root
|
90
|
-
|
101
|
+
|
102
|
+
@casting_director.fill_cast(@root)
|
103
|
+
|
104
|
+
$casted_props[0].should == @root
|
105
|
+
$casted_players[0].name.should include("Root");
|
106
|
+
@root.is_a?($casted_players[0]).should == true
|
107
|
+
@root.is_a?(Limelight::Builtin::Players::Button).should == true
|
108
|
+
$casted_players[1].name.should include("CustomPlayer");
|
109
|
+
@root.is_a?($casted_players[1]).should == true
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should load shared custom players" do
|
113
|
+
production = Limelight::Production.new(TestDir.root)
|
114
|
+
@scene.production = production
|
115
|
+
|
116
|
+
prepare_player("scene_path", "root")
|
117
|
+
prepare_player(".", "shared_player")
|
118
|
+
make_root(:name => "root", :players => "shared_player")
|
119
|
+
|
120
|
+
@casting_director.fill_cast(@root)
|
121
|
+
|
122
|
+
$casted_props[0].should == @root
|
123
|
+
$casted_players[0].name.should include("Root");
|
124
|
+
$casted_players[1].name.should include("SharedPlayer");
|
125
|
+
@root.is_a?($casted_players[0]).should == true
|
126
|
+
@root.is_a?($casted_players[1]).should == true
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should not allow casting without a scene" do
|
130
|
+
lambda { @casting_director.fill_cast(Limelight::Prop.new) }.should raise_error(Limelight::LimelightException, "Cannot cast a Prop without a Scene.")
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should not reload known players in a scene" do
|
134
|
+
prepare_player("scene_path", "root")
|
135
|
+
|
136
|
+
make_root(:name => "root")
|
137
|
+
@casting_director.fill_cast(@root)
|
138
|
+
first_root_player = $casted_players[0]
|
139
|
+
|
140
|
+
prepare_player("scene_path", "root", "module Root; def foo; end; end;")
|
141
|
+
make_root(:name => "root")
|
142
|
+
@casting_director.fill_cast(@root)
|
143
|
+
|
144
|
+
@root.should_not respond_to(:foo)
|
145
|
+
@root.is_a?(first_root_player).should == true
|
146
|
+
end
|
147
|
+
|
148
|
+
it "should not reload known players in a scene even with a new casting director" do
|
149
|
+
prepare_player("scene_path", "root")
|
150
|
+
|
151
|
+
make_root(:name => "root")
|
152
|
+
@casting_director.fill_cast(@root)
|
153
|
+
first_root_player = $casted_players[0]
|
154
|
+
|
155
|
+
@casting_director = Limelight::CastingDirector.new(@loader)
|
156
|
+
prepare_player("scene_path", "root", "module Root; def foo; end; end;")
|
157
|
+
make_root(:name => "root")
|
91
158
|
@casting_director.fill_cast(@root)
|
159
|
+
|
160
|
+
@root.should_not respond_to(:foo)
|
161
|
+
@root.is_a?(first_root_player).should == true
|
92
162
|
end
|
93
163
|
|
94
164
|
end
|
@@ -0,0 +1,18 @@
|
|
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/command'
|
6
|
+
|
7
|
+
describe Limelight::Commands::Command do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should allow subclassed to be installed" do
|
13
|
+
myclass = class MyClass < Limelight::Commands::Command; install_as "mine"; end;
|
14
|
+
|
15
|
+
Limelight::Commands::LISTING["mine"].should == myclass
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
require 'limelight/commands/create_command'
|
3
|
+
require 'limelight/templates/production_templater'
|
4
|
+
require 'limelight/templates/scene_templater'
|
5
|
+
|
6
|
+
|
7
|
+
describe Limelight::Commands::CreateCommand do
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@command_class = Limelight::Commands::CreateCommand
|
11
|
+
end
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
@command = @command_class.new
|
15
|
+
@command.instance_eval("def parse_error(e=nil); raise 'Usage called! ' + e + e.backtrace.inspect; end;")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be listed" do
|
19
|
+
Limelight::Commands::LISTING["create"].should == @command_class
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should create a production" do
|
23
|
+
production_templater = make_mock("production_templater")
|
24
|
+
Limelight::Templates::ProductionTemplater.should_receive(:new).with("blah", "default_scene").and_return(production_templater)
|
25
|
+
scene_templater = make_mock("scene_templater")
|
26
|
+
Limelight::Templates::SceneTemplater.should_receive(:new).with("blah/default_scene").and_return(scene_templater)
|
27
|
+
production_templater.should_receive(:generate)
|
28
|
+
scene_templater.should_receive(:generate)
|
29
|
+
|
30
|
+
@command.run(["production", "blah"])
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should create a scene" do
|
34
|
+
Limelight::Templates::ProductionTemplater.should_not_receive(:new)
|
35
|
+
scene_templater = make_mock("scene_templater")
|
36
|
+
Limelight::Templates::SceneTemplater.should_receive(:new).with("prod/some_scene").and_return(scene_templater)
|
37
|
+
scene_templater.should_receive(:generate)
|
38
|
+
|
39
|
+
@command.run(["scene", "prod/some_scene"])
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should print useage on invalid template type" do
|
43
|
+
@command.should_receive(:parse_error).at_least(:once)
|
44
|
+
|
45
|
+
@command.run(["blah"])
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should print useage on missing paths" do
|
49
|
+
@command.should_receive(:parse_error).at_least(:once)
|
50
|
+
|
51
|
+
@command.run(["production"])
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have a default scene name" do
|
55
|
+
@command.parse ["production", "blah"]
|
56
|
+
|
57
|
+
@command.default_scene_name.should == "default_scene"
|
58
|
+
@command.template_type.should == "production"
|
59
|
+
@command.path.should == "blah"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should parse a scene option" do
|
63
|
+
@command.parse ["-s", "scene_name", "production", "blah"]
|
64
|
+
@command.default_scene_name.should == "scene_name"
|
65
|
+
@command.template_type.should == "production"
|
66
|
+
@command.path.should == "blah"
|
67
|
+
|
68
|
+
@command.parse ["--scene=another_scene", "production", "blah"]
|
69
|
+
@command.default_scene_name.should == "another_scene"
|
70
|
+
@command.template_type.should == "production"
|
71
|
+
@command.path.should == "blah"
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
require 'limelight/commands/freeze_command'
|
3
|
+
|
4
|
+
describe Limelight::Commands::FreezeCommand do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
@command_class = Limelight::Commands::FreezeCommand
|
8
|
+
@command = @command_class.new
|
9
|
+
end
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
@command = @command_class.new
|
13
|
+
@command.instance_eval("def usage(e=nil); raise 'Usage called! ' + e; end;")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should be listed" do
|
17
|
+
Limelight::Commands::LISTING["freeze"].should == @command_class
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should parse no options" do
|
21
|
+
@command.parse ["some_gem"]
|
22
|
+
|
23
|
+
@command.gem_name.should == "some_gem"
|
24
|
+
@command.production_path.should == "."
|
25
|
+
@command.gem_version.should == nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should parse production path option" do
|
29
|
+
@command.parse ["-p", "prod/path", "some_gem"]
|
30
|
+
@command.gem_name.should == "some_gem"
|
31
|
+
@command.production_path.should == "prod/path"
|
32
|
+
|
33
|
+
@command.parse ["--production=prod/path2", "some_gem"]
|
34
|
+
@command.gem_name.should == "some_gem"
|
35
|
+
@command.production_path.should == "prod/path2"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should parse version option" do
|
39
|
+
@command.parse ["-v", "1.2.3", "some_gem"]
|
40
|
+
@command.gem_name.should == "some_gem"
|
41
|
+
@command.gem_version.should == "1.2.3"
|
42
|
+
|
43
|
+
@command.parse ["--version=3.2.1", "some_gem"]
|
44
|
+
@command.gem_name.should == "some_gem"
|
45
|
+
@command.gem_version.should == "3.2.1"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should check if it's a gem file" do
|
49
|
+
@command.is_gem_file?("some.gem").should == true
|
50
|
+
@command.is_gem_file?("some-java_0.2.1.gem").should == true
|
51
|
+
@command.is_gem_file?("/some.gem").should == true
|
52
|
+
@command.is_gem_file?("/dir/dir2/some.gem").should == true
|
53
|
+
@command.is_gem_file?("../dir/dir2/some.gem").should == true
|
54
|
+
|
55
|
+
@command.is_gem_file?("some_gem").should == false
|
56
|
+
@command.is_gem_file?("some_gem-java.0.3.1").should == false
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|