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.
Files changed (111) hide show
  1. data/bin/ll.bat +1 -1
  2. data/lib/i4jruntime.jar +0 -0
  3. data/lib/junit-4.4.jar +0 -0
  4. data/lib/limelight.jar +0 -0
  5. data/lib/limelight/animation.rb +3 -3
  6. data/lib/limelight/builtin/players.rb +2 -1
  7. data/lib/limelight/builtin/players/combo_box.rb +8 -2
  8. data/lib/limelight/builtin/players/image.rb +47 -0
  9. data/lib/limelight/builtin/styles.rb +1 -1
  10. data/lib/limelight/casting_director.rb +70 -39
  11. data/lib/limelight/commands/command.rb +150 -0
  12. data/lib/limelight/commands/create_command.rb +79 -0
  13. data/lib/limelight/commands/freeze_command.rb +113 -0
  14. data/lib/limelight/commands/open_command.rb +49 -0
  15. data/lib/limelight/commands/pack_command.rb +45 -0
  16. data/lib/limelight/dsl/build_exception.rb +51 -0
  17. data/lib/limelight/dsl/menu_bar.rb +71 -0
  18. data/lib/limelight/dsl/production_builder.rb +71 -0
  19. data/lib/limelight/dsl/prop_builder.rb +155 -0
  20. data/lib/limelight/dsl/stage_builder.rb +105 -0
  21. data/lib/limelight/dsl/styles_builder.rb +134 -0
  22. data/lib/limelight/file_loader.rb +46 -0
  23. data/lib/limelight/gems.rb +45 -0
  24. data/lib/limelight/java_couplings.rb +7 -2
  25. data/lib/limelight/java_util.rb +2 -15
  26. data/lib/limelight/main.rb +7 -5
  27. data/lib/limelight/producer.rb +87 -66
  28. data/lib/limelight/production.rb +42 -4
  29. data/lib/limelight/prop.rb +84 -70
  30. data/lib/limelight/scene.rb +75 -20
  31. data/lib/limelight/specs/spec_helper.rb +58 -0
  32. data/lib/limelight/stage.rb +11 -6
  33. data/lib/limelight/string.rb +35 -0
  34. data/lib/limelight/studio.rb +29 -0
  35. data/lib/limelight/templates/production_templater.rb +42 -0
  36. data/lib/limelight/templates/scene_templater.rb +41 -0
  37. data/lib/limelight/templates/sources/freezing/limelight_init.rb.template +5 -0
  38. data/lib/limelight/templates/sources/production/init.rb.template +15 -0
  39. data/lib/limelight/templates/sources/production/production.rb.template +9 -0
  40. data/lib/limelight/templates/sources/production/stages.rb.template +17 -0
  41. data/lib/limelight/templates/sources/production/styles.rb.template +12 -0
  42. data/lib/limelight/templates/sources/scene/props.rb.template +6 -0
  43. data/lib/limelight/templates/sources/scene/styles.rb.template +18 -0
  44. data/lib/limelight/templates/templater.rb +128 -0
  45. data/lib/limelight/templates/templater_logger.rb +36 -0
  46. data/lib/limelight/theater.rb +21 -7
  47. data/lib/limelight/util.rb +22 -6
  48. data/lib/limelight/version.rb +2 -2
  49. data/productions/examples/8thlight.com/styles.rb +1 -1
  50. data/productions/examples/langstons_ant/html_javascript/ant.html +1 -1
  51. data/productions/examples/langstons_ant/init.rb +1 -0
  52. data/productions/examples/langstons_ant/players/log.rb +2 -2
  53. data/productions/examples/langstons_ant/players/world.rb +0 -26
  54. data/productions/examples/sandbox.llp +0 -0
  55. data/productions/examples/sandbox/click_me/players/chromaton.rb +10 -4
  56. data/productions/examples/sandbox/floaters/players/floater.rb +4 -2
  57. data/productions/examples/sandbox/gradients/players/spinner.rb +5 -1
  58. data/productions/examples/sandbox/gradients/players/teaser.rb +2 -2
  59. data/productions/examples/sandbox/gradients/players/wave.rb +2 -2
  60. data/productions/examples/sandbox/gradients/players/waves.rb +2 -2
  61. data/productions/examples/sandbox/header.rb +1 -0
  62. data/productions/examples/sandbox/images/logo.png +0 -0
  63. data/productions/examples/sandbox/images_scene/props.rb +25 -0
  64. data/productions/examples/sandbox/images_scene/styles.rb +30 -0
  65. data/productions/examples/sandbox/inputs/styles.rb +1 -1
  66. data/productions/examples/sandbox/scrolling/props.rb +12 -12
  67. data/productions/examples/sandbox/teaser/players/fader.rb +2 -8
  68. data/productions/stage_composer/inspector/styles.rb +2 -2
  69. data/productions/startup/styles.rb +2 -2
  70. data/spec/builtin/players/button_spec.rb +0 -1
  71. data/spec/builtin/players/image_spec.rb +41 -0
  72. data/spec/casting_director_spec.rb +114 -44
  73. data/spec/commands/command_spec.rb +18 -0
  74. data/spec/commands/create_command_spec.rb +74 -0
  75. data/spec/commands/freeze_command_spec.rb +59 -0
  76. data/spec/commands/open_command_spec.rb +30 -0
  77. data/spec/commands/pack_command_spec.rb +23 -0
  78. data/spec/dsl/production_builder_spec.rb +46 -0
  79. data/spec/{prop_builder_spec.rb → dsl/prop_builder_spec.rb} +80 -24
  80. data/spec/{stage_builder_spec.rb → dsl/stage_builder_spec.rb} +4 -4
  81. data/spec/{styles_builder_spec.rb → dsl/styles_builder_spec.rb} +6 -6
  82. data/spec/{loaders/file_loader_spec.rb → file_loader_spec.rb} +4 -4
  83. data/spec/gems_spec.rb +83 -0
  84. data/spec/java_util_spec.rb +1 -17
  85. data/spec/main_spec.rb +17 -0
  86. data/spec/producer_spec.rb +89 -79
  87. data/spec/production_spec.rb +28 -3
  88. data/spec/prop_spec.rb +82 -16
  89. data/spec/scene_spec.rb +73 -3
  90. data/spec/spec_helper.rb +37 -1
  91. data/spec/stage_spec.rb +10 -1
  92. data/spec/string_spec.rb +35 -0
  93. data/spec/studio_spec.rb +14 -0
  94. data/spec/styles_spec.rb +14 -0
  95. data/spec/templates/production_templater_spec.rb +44 -0
  96. data/spec/templates/scene_templater_spec.rb +25 -0
  97. data/spec/templates/templater_logger_spec.rb +38 -0
  98. data/spec/templates/templater_spec.rb +104 -0
  99. data/spec/theater_spec.rb +12 -21
  100. metadata +75 -23
  101. data/bin/icons/splash.png +0 -0
  102. data/lib/limelight/build_exception.rb +0 -48
  103. data/lib/limelight/commands.rb +0 -52
  104. data/lib/limelight/loaders/file_scene_loader.rb +0 -49
  105. data/lib/limelight/menu_bar.rb +0 -68
  106. data/lib/limelight/production_builder.rb +0 -66
  107. data/lib/limelight/prop_builder.rb +0 -119
  108. data/lib/limelight/stage_builder.rb +0 -103
  109. data/lib/limelight/styles_builder.rb +0 -131
  110. data/spec/commands_spec.rb +0 -34
  111. data/spec/production_builder_spec.rb +0 -48
data/spec/scene_spec.rb CHANGED
@@ -10,8 +10,9 @@ describe Limelight::Scene do
10
10
  @casting_director = make_mock("casting_director", :fill_cast => nil)
11
11
  @scene = Limelight::Scene.new(:casting_director => @casting_director)
12
12
  end
13
-
13
+
14
14
  it "should have a styles hash" do
15
+ @scene.illuminate
15
16
  @scene.styles.should_not == nil
16
17
  @scene.styles.size.should == 0
17
18
  end
@@ -20,10 +21,11 @@ describe Limelight::Scene do
20
21
  @scene.button_groups.should_not == nil
21
22
  @scene.button_groups.class.should == Limelight::UI::ButtonGroupCache
22
23
  end
23
-
24
+
24
25
  it "should pullout sytles and casting_director from options" do
25
26
  scene = Limelight::Scene.new(:styles => "styles", :casting_director => @casting_director)
26
-
27
+ scene.illuminate
28
+
27
29
  scene.styles.should == "styles"
28
30
  scene.casting_director.should == @casting_director
29
31
  end
@@ -31,4 +33,72 @@ describe Limelight::Scene do
31
33
  it "should have opened event" do
32
34
  @scene.should respond_to(:scene_opened)
33
35
  end
36
+
37
+ it "should have a cast" do
38
+ @scene.cast.should_not == nil
39
+ @scene.cast.is_a?(Module).should == true
40
+ end
41
+
42
+ it "should have a cast" do
43
+ @scene.cast.should_not == nil
44
+ @scene.cast.is_a?(Module).should == true
45
+ end
46
+
47
+ it "should have an acceptible path when none is provided" do
48
+ Limelight::Scene.new().path.should == File.expand_path("")
49
+ end
50
+
51
+ describe Limelight::Scene, "paths" do
52
+
53
+ before(:each) do
54
+ @scene = Limelight::Scene.new(:path => "/tmp")
55
+ end
56
+
57
+ it "should know it's props file" do
58
+ @scene.props_file.should == "/tmp/props.rb"
59
+ end
60
+
61
+ it "should know it's styles file" do
62
+ @scene.styles_file.should == "/tmp/styles.rb"
63
+ end
64
+
65
+ end
66
+
67
+ describe Limelight::Scene, "Prop Indexing" do
68
+
69
+ before(:each) do
70
+ @scene.illuminate
71
+ end
72
+
73
+ it "should index props" do
74
+ prop = Limelight::Prop.new(:id => "some_id")
75
+ @scene << prop
76
+
77
+ @scene.find("some_id").should == prop
78
+ end
79
+
80
+ it "should raise error if indexing prop with duplicate id" do
81
+ prop1 = Limelight::Prop.new(:id => "some_id")
82
+ prop2 = Limelight::Prop.new(:id => "some_id")
83
+ @scene << prop1
84
+
85
+ lambda { @scene << prop2 }.should raise_error(Limelight::LimelightException, "Duplicate id: some_id")
86
+ end
87
+
88
+ it "should unindex prop" do
89
+ prop = Limelight::Prop.new(:id => "some_id")
90
+ @scene << prop
91
+ @scene.unindex_prop(prop)
92
+
93
+ @scene.find("some_id").should == nil
94
+ end
95
+
96
+ it "should convert ids to string when finding" do
97
+ prop = Limelight::Prop.new(:id => 123)
98
+ @scene << prop
99
+
100
+ @scene.find(123).should == prop
101
+ end
102
+ end
103
+
34
104
  end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/init")
6
6
  require 'spec'
7
7
 
8
8
  context = Limelight::Context.instance
9
- context.frameManager = Java::limelight.ui.model.FrameManager.new
9
+ context.frameManager = Java::limelight.ui.model.AlertFrameManager.new
10
10
 
11
11
  def make_mock(name, stubs = {})
12
12
  the_mock = mock(name)
@@ -19,3 +19,39 @@ class Object
19
19
  stubs.each_pair { |key, value| self.stub!(key).and_return(value) }
20
20
  end
21
21
  end
22
+
23
+
24
+ require 'fileutils'
25
+ class TestDir
26
+
27
+ class << self
28
+
29
+ def root
30
+ @root = File.expand_path(File.dirname(__FILE__) + "/../etc/tmp") if @filename.nil?
31
+ return @root
32
+ end
33
+
34
+ def path(path)
35
+ return File.join(root, path)
36
+ end
37
+
38
+ def clean
39
+ Dir.entries(root).each do |file|
40
+ FileUtils.rm_r(File.join(root, file), :force => true) unless (file == '.' || file == '..')
41
+ end
42
+ end
43
+
44
+ def create_file(path, content)
45
+ filename = self.path(path)
46
+ establish_dir(File.dirname(filename))
47
+ File.open(filename, 'w') { |file| file.write content }
48
+ end
49
+
50
+ def establish_dir(path)
51
+ if !File.exists?(path)
52
+ establish_dir(File.dirname(path))
53
+ Dir.mkdir(path)
54
+ end
55
+ end
56
+ end
57
+ end
data/spec/stage_spec.rb CHANGED
@@ -46,7 +46,7 @@ describe Limelight::Stage do
46
46
  end
47
47
 
48
48
  it "should call scene.scene_opened at the end of opening a scene" do
49
- scene = make_mock("scene", :visible= => nil)
49
+ scene = make_mock("scene", :visible= => nil, :illuminate => nil)
50
50
  scene.should_receive(:scene_opened)
51
51
 
52
52
  @__stage__.frame.stub!(:open)
@@ -54,4 +54,13 @@ describe Limelight::Stage do
54
54
  @__stage__.open(scene)
55
55
  end
56
56
 
57
+ it "should illuminate the scene when opening it" do
58
+ scene = make_mock("scene", :visible= => nil, :scene_opened => nil)
59
+ scene.should_receive(:illuminate)
60
+
61
+ @__stage__.frame.stub!(:open)
62
+ @__stage__.stub!(:load_scene)
63
+ @__stage__.open(scene)
64
+ end
65
+
57
66
  end
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
+ require 'limelight/string'
3
+
4
+ describe String do
5
+
6
+ it "should convert into camel case" do
7
+ "class_name".camalized.should == "ClassName"
8
+ "once_upon_a_time".camalized.should == "OnceUponATime"
9
+ "AbC_eFg_hiJ".camalized.should == "AbcEfgHij"
10
+ "with spaces".camalized.should == "WithSpaces"
11
+ end
12
+
13
+ it "should convert into camel case" do
14
+ "class_name".camalized(:lower).should == "className"
15
+ "once_upon_a_time".camalized(:lower).should == "onceUponATime"
16
+ "AbC_eFg_hiJ".camalized(:lower).should == "abcEfgHij"
17
+ "with spaces".camalized(:lower).should == "withSpaces"
18
+ end
19
+
20
+ it "should underscore a name" do
21
+ "ClassName".underscored.should == "class_name"
22
+ "OneTwoThree".underscored.should == "one_two_three"
23
+ "One".underscored.should == "one"
24
+ end
25
+
26
+ it "should convert a string to title" do
27
+ "class_name".titleized.should == "Class Name"
28
+ "once_upon_a_time".titleized.should == "Once Upon A Time"
29
+ "AbC_eFg_hiJ".titleized.should == "Ab C E Fg Hi J"
30
+ "with spaces".titleized.should == "With Spaces"
31
+ "Some Title".titleized.should == "Some Title"
32
+ "SomeTitle".titleized.should == "Some Title"
33
+ end
34
+
35
+ end
@@ -0,0 +1,14 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
+ require 'limelight/studio'
3
+
4
+ describe Limelight::Studio do
5
+
6
+ it "should install itsself" do
7
+ Limelight::Studio.install
8
+
9
+ studio = Limelight::Studio.instance
10
+ Limelight::Context.instance.studio.should == studio
11
+ end
12
+
13
+
14
+ end
data/spec/styles_spec.rb CHANGED
@@ -32,5 +32,19 @@ describe Limelight::Styles do
32
32
  # end
33
33
  # end
34
34
 
35
+ # it "should generate code" do
36
+ # Limelight::Styles::Style::STYLE_LIST.each do |descriptor|
37
+ # const_name = const_format(descriptor.name)
38
+ # method_name = method_format(descriptor.name)
39
+ # spaces = 40 - const_name.length
40
+ # puts "<tr>"
41
+ # puts "\t<td>'''#{method_name}'''</td>"
42
+ # puts "\t<td></td>"
43
+ # puts "\t<td>#{descriptor.defaultValue}</td>"
44
+ # puts "\t<td></td>"
45
+ # puts "</tr>"
46
+ # end
47
+ # end
48
+
35
49
 
36
50
  end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/templates/production_templater'
3
+
4
+ describe Limelight::Templates::ProductionTemplater do
5
+
6
+ it "should initialize settings" do
7
+ templater = Limelight::Templates::ProductionTemplater.new("some_production", "default_scene")
8
+
9
+ templater.target_root.should == "."
10
+ templater.source_root.should == Limelight::Templates::Templater.source_dir
11
+ templater.tokens[:PRODUCTION_NAME].should == "Some Production"
12
+ templater.tokens[:DEFAULT_SCENE_NAME].should == "default_scene"
13
+ end
14
+
15
+ it "should initialize settings for deep dir name" do
16
+ templater = Limelight::Templates::ProductionTemplater.new("dir1/dir2/some_production", "default_scene")
17
+
18
+ templater.target_root.should == "./dir1/dir2"
19
+ templater.source_root.should == Limelight::Templates::Templater.source_dir
20
+ templater.tokens[:PRODUCTION_NAME].should == "Some Production"
21
+ templater.tokens[:DEFAULT_SCENE_NAME].should == "default_scene"
22
+ end
23
+
24
+ it "should initialize settings for root path" do
25
+ templater = Limelight::Templates::ProductionTemplater.new("/some_production", "default_scene")
26
+
27
+ templater.target_root.should == "/"
28
+ templater.source_root.should == Limelight::Templates::Templater.source_dir
29
+ templater.tokens[:PRODUCTION_NAME].should == "Some Production"
30
+ templater.tokens[:DEFAULT_SCENE_NAME].should == "default_scene"
31
+ end
32
+
33
+ it "should generate files" do
34
+ templater = Limelight::Templates::ProductionTemplater.new("some_production", "default_scene")
35
+
36
+ templater.should_receive(:file).with("some_production/production.rb", "production/production.rb.template", templater.tokens)
37
+ templater.should_receive(:file).with("some_production/init.rb", "production/init.rb.template", templater.tokens)
38
+ templater.should_receive(:file).with("some_production/stages.rb", "production/stages.rb.template", templater.tokens)
39
+ templater.should_receive(:file).with("some_production/styles.rb", "production/styles.rb.template", templater.tokens)
40
+
41
+ templater.generate
42
+ end
43
+
44
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/templates/scene_templater'
3
+
4
+ describe Limelight::Templates::SceneTemplater do
5
+
6
+ it "should initialize" do
7
+ templater = Limelight::Templates::SceneTemplater.new("prod/some_scene")
8
+
9
+ templater.target_root.should == "./prod"
10
+ templater.source_root.should == Limelight::Templates::Templater.source_dir
11
+ templater.tokens[:SCENE_NAME].should == "some_scene"
12
+ templater.tokens[:SCENE_TITLE].should == "Some Scene"
13
+ end
14
+
15
+ it "should generate files" do
16
+ templater = Limelight::Templates::SceneTemplater.new("prod/some_scene")
17
+
18
+ templater.should_receive(:file).with("some_scene/props.rb", "scene/props.rb.template", templater.tokens)
19
+ templater.should_receive(:file).with("some_scene/styles.rb", "scene/styles.rb.template", templater.tokens)
20
+ templater.should_receive(:directory).with("some_scene/players")
21
+
22
+ templater.generate
23
+ end
24
+
25
+ end
@@ -0,0 +1,38 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/templates/templater_logger'
3
+
4
+ describe Limelight::Templates::TemplaterLogger do
5
+
6
+ before(:each) do
7
+ @logger = Limelight::Templates::TemplaterLogger.new
8
+ @in, @out = IO.pipe
9
+ @logger.output = @out
10
+ end
11
+
12
+ it "should have standard out as output" do
13
+ @logger = Limelight::Templates::TemplaterLogger.new
14
+ @logger.output.should == STDOUT
15
+ end
16
+
17
+ it "should handle creating directories" do
18
+ @logger.creating_directory("dir1")
19
+
20
+ result = @in.readline
21
+ result.strip.should == "creating directory: dir1"
22
+ end
23
+
24
+ it "should handle creating files" do
25
+ @logger.creating_file("file1")
26
+
27
+ result = @in.readline
28
+ result.strip.should == "creating file: file1"
29
+ end
30
+
31
+ it "should handle file already exists" do
32
+ @logger.file_already_exists("file1")
33
+
34
+ result = @in.readline
35
+ result.strip.should == "file already exists: file1"
36
+ end
37
+
38
+ end
@@ -0,0 +1,104 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require 'limelight/templates/templater'
3
+
4
+ describe Limelight::Templates::Templater do
5
+
6
+ before(:each) do
7
+ TestDir.clean
8
+ @src_dir = File.join(TestDir.root, "src")
9
+ @logger = make_mock("logger")
10
+ @templater = Limelight::Templates::Templater.new(TestDir.root, @src_dir)
11
+ @templater.logger = @logger
12
+ end
13
+
14
+ it "should have a templater logger" do
15
+ @templater = Limelight::Templates::Templater.new(TestDir.root, @src_dir)
16
+ @templater.logger.should_not == nil
17
+ @templater.logger.class.should == Limelight::Templates::TemplaterLogger
18
+ end
19
+
20
+ it "should have a target root and source root directory" do
21
+ @templater.target_root.should == TestDir.root
22
+ @templater.source_root.should == @src_dir
23
+ end
24
+
25
+ it "should prefix target root with dot if not absolute" do
26
+ Limelight::Templates::Templater.clarify("blah").should == "./blah"
27
+ Limelight::Templates::Templater.clarify("one/two").should == "./one/two"
28
+ Limelight::Templates::Templater.clarify("/root").should == "/root"
29
+ Limelight::Templates::Templater.clarify("./blah").should == "./blah"
30
+ Limelight::Templates::Templater.clarify("../blah").should == "../blah"
31
+ end
32
+
33
+ it "should create a directory" do
34
+ @logger.should_receive(:creating_directory).with("#{TestDir.root}/blah")
35
+
36
+ @templater.directory "blah"
37
+
38
+ File.exists?(File.join(TestDir.root, "blah")).should == true
39
+ end
40
+
41
+ it "should create nested directories" do
42
+ @logger.should_receive(:creating_directory).with("#{TestDir.root}/dir1")
43
+ @logger.should_receive(:creating_directory).with("#{TestDir.root}/dir1/dir2")
44
+
45
+ @templater.directory "dir1/dir2"
46
+
47
+ File.exists?(File.join(TestDir.root, "dir1/dir2")).should == true
48
+ end
49
+
50
+ it "should create files from source" do
51
+ TestDir.create_file("src/file1.txt", "blah")
52
+ @logger.should_receive(:creating_file).with("#{TestDir.root}/f1.txt")
53
+
54
+ @templater.file "f1.txt", "file1.txt"
55
+
56
+ File.exists?(File.join(TestDir.root, "f1.txt")).should == true
57
+ IO.read(File.join(TestDir.root, "f1.txt")).should == "blah"
58
+ end
59
+
60
+ it "should create files nested in directories" do
61
+ TestDir.create_file("src/file1.txt", "blah")
62
+
63
+ @logger.should_receive(:creating_directory).with("#{TestDir.root}/dir1")
64
+ @logger.should_receive(:creating_file).with("#{TestDir.root}/dir1/f1.txt")
65
+
66
+ @templater.file "dir1/f1.txt", "file1.txt"
67
+
68
+ path = File.join(TestDir.root, "dir1", "f1.txt")
69
+ File.exists?(path).should == true
70
+ IO.read(path).should == "blah"
71
+ end
72
+
73
+ it "should skip files that already exist" do
74
+ TestDir.create_file("src/file1.txt", "blah")
75
+ TestDir.create_file("f1.txt", "existing content")
76
+
77
+ @logger.should_receive(:file_already_exists).with("#{TestDir.root}/f1.txt")
78
+
79
+ @templater.file "f1.txt", "file1.txt"
80
+
81
+ IO.read(File.join(TestDir.root, "f1.txt")).should == "existing content"
82
+ end
83
+
84
+ it "should replace one token in files" do
85
+ TestDir.create_file("src/file1.txt", "abc !-TOKEN1-! 123")
86
+ @logger.should_receive(:creating_file).with("#{TestDir.root}/f1.txt")
87
+
88
+ @templater.file "f1.txt", "file1.txt", :TOKEN1 => "you know me"
89
+
90
+ File.exists?(File.join(TestDir.root, "f1.txt")).should == true
91
+ IO.read(File.join(TestDir.root, "f1.txt")).should == "abc you know me 123"
92
+ end
93
+
94
+ it "should replace multiple tokens in files" do
95
+ TestDir.create_file("src/file1.txt", "!-TOKEN0-! !-TOKEN1-! !-TOKEN2-!")
96
+ @logger.should_receive(:creating_file).with("#{TestDir.root}/f1.txt")
97
+
98
+ @templater.file "f1.txt", "file1.txt", :TOKEN0 => "1", :TOKEN1 => "2", :TOKEN2 => "3"
99
+
100
+ File.exists?(File.join(TestDir.root, "f1.txt")).should == true
101
+ IO.read(File.join(TestDir.root, "f1.txt")).should == "1 2 3"
102
+ end
103
+
104
+ end