BuildMaster 1.0.9 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/buildmaster/algorithms.rb +3 -0
- data/lib/buildmaster/algorithms/opn_compare.rb +108 -0
- data/lib/buildmaster/cotta/cotta_dir.rb +7 -4
- data/lib/buildmaster/cotta/cotta_file.rb +5 -2
- data/lib/buildmaster/cotta/in_memory_system.rb +28 -4
- data/lib/buildmaster/project/java.rb +4 -0
- data/lib/buildmaster/project/java/class_path.rb +0 -0
- data/lib/buildmaster/project/java/javac.rb +9 -0
- data/lib/buildmaster/project/mysql_served_driver.rb +15 -0
- data/lib/buildmaster/project/pscp_driver.rb +0 -1
- data/lib/buildmaster/project/svn_driver.rb +4 -4
- data/lib/buildmaster/project/svn_server_driver.rb +18 -0
- data/lib/buildmaster/project/svn_status_info.rb +45 -42
- data/lib/buildmaster/site/content_engine_repository.rb +9 -0
- data/lib/buildmaster/site/file_processor.rb +5 -1
- data/lib/buildmaster/site/site.rb +11 -4
- data/lib/buildmaster/site/site_server.rb +1 -1
- data/lib/buildmaster/site/templatelets/href.rb +1 -1
- data/lib/buildmaster/version +1 -1
- data/test/buildmaster/algorithms/tc_opn_compare.rb +44 -0
- data/test/buildmaster/common/tc_properties.rb +8 -8
- data/test/buildmaster/common/tc_tree_to_object.rb +8 -8
- data/test/buildmaster/cotta/cotta_dir_behaviors.rb +167 -0
- data/test/buildmaster/cotta/cotta_file_behaviors.rb +127 -0
- data/test/buildmaster/cotta/cotta_specifications.rb +20 -0
- data/test/buildmaster/cotta/file_system_behaviors.rb +167 -0
- data/test/buildmaster/cotta/tc_command_interface.rb +6 -6
- data/test/buildmaster/cotta/tc_command_runner.rb +5 -5
- data/test/buildmaster/cotta/tc_cotta.rb +12 -12
- data/test/buildmaster/cotta/tc_cotta_dir_in_memory.rb +17 -17
- data/test/buildmaster/cotta/tc_cotta_dir_physical.rb +5 -5
- data/test/buildmaster/cotta/tc_cotta_file_in_memory.rb +8 -9
- data/test/buildmaster/cotta/tc_cotta_file_physical.rb +11 -8
- data/test/buildmaster/cotta/tc_cotta_zip_support.rb +9 -9
- data/test/buildmaster/cotta/tc_in_memory_system.rb +7 -7
- data/test/buildmaster/cotta/tc_io_chain.rb +3 -3
- data/test/buildmaster/cotta/tc_pathname.rb +6 -6
- data/test/buildmaster/cotta/tc_physical_system.rb +7 -8
- data/test/buildmaster/project/tc_ant_driver.rb +8 -8
- data/test/buildmaster/project/tc_build_number_file.rb +5 -5
- data/test/buildmaster/project/tc_cvs_driver.rb +9 -9
- data/test/buildmaster/project/tc_java_manifest.rb +9 -11
- data/test/buildmaster/project/tc_release.rb +12 -12
- data/test/buildmaster/project/tc_server_manager.rb +8 -8
- data/test/buildmaster/project/tc_svn_driver.rb +18 -13
- data/test/buildmaster/project/tc_svn_status_info.rb +8 -8
- data/test/buildmaster/project/tc_version_number_file.rb +6 -6
- data/test/buildmaster/project/windows/tc_iis_driver.rb +4 -4
- data/test/buildmaster/project/windows/tc_sql_server_driver.rb +2 -2
- data/test/buildmaster/site/content/tc_content_engine_repository.rb +5 -5
- data/test/buildmaster/site/tc_element_processor_by_name.rb +4 -4
- data/test/buildmaster/site/tc_file_processor.rb +8 -9
- data/test/buildmaster/site/tc_site.rb +23 -7
- data/test/buildmaster/site/tc_site_server.rb +2 -2
- data/test/buildmaster/site/tc_site_spec.rb +5 -5
- data/test/buildmaster/site/tc_source_file_handler.rb +2 -2
- data/test/buildmaster/site/tc_template_builder.rb +22 -11
- data/test/buildmaster/site/tc_template_error.rb +2 -2
- data/test/buildmaster/site/tc_template_runner.rb +4 -4
- data/test/buildmaster/site/tc_templatelets.rb +4 -4
- data/test/buildmaster/site/tc_xtemplate.rb +5 -5
- data/test/buildmaster/site/templatelets/tc_attribute.rb +6 -6
- data/test/buildmaster/site/templatelets/tc_code.rb +10 -10
- data/test/buildmaster/site/templatelets/tc_each.rb +3 -3
- data/test/buildmaster/site/templatelets/tc_href.rb +7 -7
- data/test/buildmaster/site/templatelets/tc_include.rb +3 -3
- data/test/buildmaster/site/templatelets/tc_link.rb +6 -6
- data/test/buildmaster/site/templatelets/tc_text.rb +4 -4
- data/test/buildmaster/site/templatelets/tc_when.rb +4 -4
- data/test/tmp/svn_test/repository/db/revprops/0 +1 -1
- data/test/tmp/svn_test/repository/db/revprops/1 +1 -1
- data/test/tmp/svn_test/repository/db/revprops/2 +1 -1
- data/test/tmp/svn_test/repository/db/revprops/3 +1 -1
- data/test/tmp/svn_test/repository/db/revprops/4 +1 -1
- data/test/tmp/svn_test/repository/db/uuid +1 -1
- metadata +60 -46
@@ -3,8 +3,8 @@ $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'buildmast
|
|
3
3
|
require 'site/template_error'
|
4
4
|
require 'spec'
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
describe 'template error' do
|
7
|
+
it 'format of exception' do
|
8
8
|
begin
|
9
9
|
raise BuildMaster::TemplateError.new('test'), 'message'
|
10
10
|
fail('error should have been raised')
|
@@ -20,12 +20,12 @@ class NameTemplatelet
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
describe 'TemplateRunnerTest' do
|
24
|
+
before do
|
25
25
|
@templatelets = Hash.new
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
it 'process_element_in_document' do
|
29
29
|
target_content = <<END
|
30
30
|
<html>
|
31
31
|
<h1/>
|
@@ -57,7 +57,7 @@ END
|
|
57
57
|
REXML::XPath.first(REXML::Document.new(target_xml.to_s), '/html/h1/text()').value.strip.should == 'Name One'
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
it 'should_use_templatelet_based_on_name' do
|
61
61
|
output = REXML::Document.new
|
62
62
|
template_content = <<END
|
63
63
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
@@ -9,10 +9,10 @@ require 'spec'
|
|
9
9
|
|
10
10
|
module BuildMaster
|
11
11
|
|
12
|
-
|
12
|
+
describe 'element class alternation' do
|
13
13
|
include HelperMethods
|
14
14
|
|
15
|
-
|
15
|
+
it 'get attribute value' do
|
16
16
|
content = <<CONTENT
|
17
17
|
<root>
|
18
18
|
<element name="value"/>
|
@@ -22,14 +22,14 @@ CONTENT
|
|
22
22
|
element.attribute_value('name').should == 'value'
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
it 'raise template error if value is not there' do
|
26
26
|
content = <<CONTENT
|
27
27
|
<root>
|
28
28
|
<element/>
|
29
29
|
</root>
|
30
30
|
CONTENT
|
31
31
|
element = create_template_element(content, 'root/element')
|
32
|
-
Proc.new{element.attribute_value!('name')}.
|
32
|
+
Proc.new{element.attribute_value!('name')}.should raise_error(TemplateError)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -8,12 +8,12 @@ require 'cotta/in_memory_system'
|
|
8
8
|
|
9
9
|
module BuildMaster
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
describe 'XTemplate' do
|
12
|
+
before do
|
13
13
|
@cotta = Cotta.new(InMemorySystem.new)
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
it 'should_initialize_with_io' do
|
17
17
|
template_file = @cotta.file('template.xhtml')
|
18
18
|
template_file.save <<CONTENT
|
19
19
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
@@ -30,7 +30,7 @@ CONTENT
|
|
30
30
|
template = BuildMaster::XTemplate.new(REXML::Document.new(template_file.load), Hash.new)
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
it 'should_initialize_with_content' do
|
34
34
|
template_content = <<CONTENT
|
35
35
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
36
36
|
xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
|
@@ -45,7 +45,7 @@ CONTENT
|
|
45
45
|
REXML::XPath.first(xml_output, '/html/body').text.should == 'Body'
|
46
46
|
end
|
47
47
|
|
48
|
-
|
48
|
+
it 'should_hook_up_templatelets' do
|
49
49
|
template_content = <<INCLUDE_CONTENT
|
50
50
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
51
51
|
xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
|
@@ -15,14 +15,14 @@ class AttributeForTest
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
describe Attribute do
|
19
19
|
include HelperMethods
|
20
20
|
|
21
|
-
|
21
|
+
before do
|
22
22
|
setup_spec
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
it 'should_set_attribute_based_on_evaluation' do
|
26
26
|
templatelet = Attribute.new(AttributeForTest.new(self))
|
27
27
|
target = create_element('a')
|
28
28
|
template_element = create_attribute_element('attr-name', 'expression')
|
@@ -33,15 +33,15 @@ context 'AttributeTest' do
|
|
33
33
|
@path_logged.path.should == expected_pathname
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
it 'should_check_for_expression_responder' do
|
37
37
|
target = create_element('a')
|
38
38
|
template_element = create_attribute_element('name', 'eval')
|
39
39
|
source_path = SourceContent.new(Pathname.new('./'), create_element('name'), nil)
|
40
40
|
attribute = Attribute.new(self)
|
41
|
-
Proc.new {attribute.process(target, template_element, source_path)}.
|
41
|
+
Proc.new {attribute.process(target, template_element, source_path)}.should raise_error(TemplateError)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
it 'shoul check properties as a backup' do
|
45
45
|
target = create_element('a')
|
46
46
|
template_element = create_attribute_element('name', 'property')
|
47
47
|
source_path = SourceContent.new(Pathname.new('./'), create_element('name'), nil)
|
@@ -3,14 +3,14 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
require 'common_templatelet_test'
|
4
4
|
|
5
5
|
module BuildMaster
|
6
|
-
|
6
|
+
describe 'code template processsing' do
|
7
7
|
include HelperMethods
|
8
8
|
|
9
|
-
|
9
|
+
before do
|
10
10
|
@cotta = Cotta.new(InMemorySystem.new)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
it 'generate <pre> tag with code class by default' do
|
14
14
|
template_content = <<CONTENT
|
15
15
|
<html>
|
16
16
|
<code source="samples/sample.rb" tag="sample"/>
|
@@ -43,7 +43,7 @@ root = cotta.file(__FILE__).parent
|
|
43
43
|
CONTENT
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
it 'handle the case of only blank lines' do
|
47
47
|
template_content = <<CONTENT
|
48
48
|
<html>
|
49
49
|
<code source="samples/sample.rb" tag="sample"/>
|
@@ -69,7 +69,7 @@ CONTENT
|
|
69
69
|
end
|
70
70
|
|
71
71
|
|
72
|
-
|
72
|
+
it 'generate error if none found' do
|
73
73
|
template_content = <<CONTENT
|
74
74
|
<html>
|
75
75
|
<code source="samples/sample.rb" tag="sample"/>
|
@@ -82,10 +82,10 @@ CONTENT
|
|
82
82
|
site_spec = SiteSpec.new('/root', @cotta);
|
83
83
|
code_processor = Code.new(site_spec)
|
84
84
|
source = SourceContent.new('doc/doc.html', nil, @cotta.file(content_path))
|
85
|
-
Proc.new {code_processor.process(target, template, source)}.
|
85
|
+
Proc.new {code_processor.process(target, template, source)}.should raise_error(TemplateError)
|
86
86
|
end
|
87
87
|
|
88
|
-
|
88
|
+
it 'use PCDATA if no source specified' do
|
89
89
|
template_content = <<CONTENT
|
90
90
|
<html>
|
91
91
|
<code tag="sample">
|
@@ -114,7 +114,7 @@ end
|
|
114
114
|
CONTENT
|
115
115
|
end
|
116
116
|
|
117
|
-
|
117
|
+
it 'raise error if no source and no pcdata' do
|
118
118
|
template_content = <<CONTENT
|
119
119
|
<html>
|
120
120
|
<code tag="sample">
|
@@ -127,10 +127,10 @@ CONTENT
|
|
127
127
|
site_spec = SiteSpec.new('/root', @cotta);
|
128
128
|
code_processor = Code.new(site_spec)
|
129
129
|
source = SourceContent.new('doc/doc.html', nil, @cotta.file(content_path))
|
130
|
-
Proc.new{code_processor.process(target, template, source)}.
|
130
|
+
Proc.new{code_processor.process(target, template, source)}.should raise_error(TemplateError)
|
131
131
|
end
|
132
132
|
|
133
|
-
|
133
|
+
it 'generate syntax support' do
|
134
134
|
template_content = <<CONTENT
|
135
135
|
<html>
|
136
136
|
<code source="samples/sample.rb" tag="sample" syntax="ruby"/>
|
@@ -23,9 +23,9 @@ CONTENT
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
describe 'EachTest' do
|
27
27
|
include HelperMethods
|
28
|
-
|
28
|
+
it 'should_iteration_through_selected_elements' do
|
29
29
|
template_content = <<CONTENT
|
30
30
|
<each source="rss" select="/rss/item" count="2">
|
31
31
|
<div class="NewsItem">
|
@@ -43,7 +43,7 @@ CONTENT
|
|
43
43
|
REXML::XPath.match(target, 'div').size.should == 2
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
it 'handles the case where there are not enough items' do
|
47
47
|
template_content = <<CONTENT
|
48
48
|
<each source="rss" select="/rss/item" count="4">
|
49
49
|
<div class="NewsItem">
|
@@ -3,9 +3,9 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
require 'common_templatelet_test'
|
4
4
|
|
5
5
|
module BuildMaster
|
6
|
-
|
6
|
+
describe 'HrefTest' do
|
7
7
|
include HelperMethods
|
8
|
-
|
8
|
+
before do
|
9
9
|
setup_spec
|
10
10
|
@template_element = create_element('href')
|
11
11
|
@target_element = create_element('a')
|
@@ -16,34 +16,34 @@ context 'HrefTest' do
|
|
16
16
|
SourceContent.new(Pathname.new(path), nil, nil)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it 'should_populate_href_attribute_with_full_url' do
|
20
20
|
expected_url = 'http://www.rubyforge.org'
|
21
21
|
@template_element.attributes['url']=expected_url
|
22
22
|
@href.process(@target_element, @template_element, source('index.html'))
|
23
23
|
@target_element.attributes['href'].should == expected_url
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
it 'should_populate_href_attribute_with_relative_path' do
|
27
27
|
@template_element.attributes['url']='doc/doc.html'
|
28
28
|
@href.process(@target_element, @template_element, source('download/index.html'))
|
29
29
|
@target_element.attributes['href'].should == '../doc/doc.html'
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
it 'should_support_image_tag_by_generating_src_attribute' do
|
33
33
|
@template_element.attributes['url']='doc/doc.gif'
|
34
34
|
@target_element = create_element('img')
|
35
35
|
@href.process(@target_element, @template_element, source('download/download.html'))
|
36
36
|
@target_element.attributes['src'].should == '../doc/doc.gif'
|
37
37
|
end
|
38
38
|
|
39
|
-
|
39
|
+
it 'should_handle_external_links' do
|
40
40
|
@template_element.attributes['url'] = 'http://www.google.com'
|
41
41
|
@target_element = create_element('img')
|
42
42
|
@href.process(@target_element, @template_element, source('download/download.html'))
|
43
43
|
@target_element.attributes['src'].should == 'http://www.google.com'
|
44
44
|
end
|
45
45
|
|
46
|
-
|
46
|
+
it 'should_handle_absolute_path' do
|
47
47
|
@template_element.attributes['url'] = '/doc.html'
|
48
48
|
@target_element = create_element('img')
|
49
49
|
@href.process(@target_element, @template_element, source('download/download.html'))
|
@@ -3,14 +3,14 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
require 'common_templatelet_test'
|
4
4
|
module BuildMaster
|
5
5
|
|
6
|
-
|
6
|
+
describe 'IncludeTest' do
|
7
7
|
include HelperMethods
|
8
8
|
|
9
|
-
|
9
|
+
before do
|
10
10
|
setup_spec
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
it 'should_include_the_source' do
|
14
14
|
target = create_element('target')
|
15
15
|
template = create_element('include')
|
16
16
|
template.attributes['elements'] = '/item/*'
|
@@ -3,14 +3,14 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
require 'common_templatelet_test'
|
4
4
|
|
5
5
|
module BuildMaster
|
6
|
-
|
6
|
+
describe 'LinkTest' do
|
7
7
|
include HelperMethods
|
8
8
|
|
9
|
-
|
9
|
+
before do
|
10
10
|
setup_spec
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
it 'should_generate_link_with_relative_path' do
|
14
14
|
target = create_element('div')
|
15
15
|
template_content = <<CONTENT
|
16
16
|
<?xml ?>
|
@@ -28,7 +28,7 @@ CONTENT
|
|
28
28
|
actual.text.should == 'text'
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
it 'should_copy_all_attributes' do
|
32
32
|
target = create_element('div')
|
33
33
|
template = create_element('link')
|
34
34
|
template.attributes['href'] = 'content/path.html'
|
@@ -42,7 +42,7 @@ CONTENT
|
|
42
42
|
actual.attributes['attribute2'].should == 'value2'
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
it 'should_handle_absolute_path' do
|
46
46
|
target = create_element('div')
|
47
47
|
template = create_element('link')
|
48
48
|
template.attributes['href'] = '/content/path.html'
|
@@ -53,7 +53,7 @@ CONTENT
|
|
53
53
|
actual.attributes['href'].should == '../../content/path.html'
|
54
54
|
end
|
55
55
|
|
56
|
-
|
56
|
+
it 'should_generate_div_with_current_class_attribute_if_link_is_on_current_page' do
|
57
57
|
target = create_element('div')
|
58
58
|
template = create_element('link')
|
59
59
|
template.attributes['href'] = '/content/path.html'
|
@@ -3,13 +3,13 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
require 'common_templatelet_test'
|
4
4
|
|
5
5
|
module BuildMaster
|
6
|
-
|
6
|
+
describe 'TextTest' do
|
7
7
|
include HelperMethods
|
8
|
-
|
8
|
+
before do
|
9
9
|
setup_spec
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
it 'should_generate_text_based_on_property' do
|
13
13
|
target = create_element('target')
|
14
14
|
template = create_element('text')
|
15
15
|
template.attributes['property'] = 'property'
|
@@ -18,7 +18,7 @@ context 'TextTest' do
|
|
18
18
|
target.text.should == 'text'
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
it 'should_throw_exception_if_property_not_set' do
|
22
22
|
target = create_element('target')
|
23
23
|
template = create_element('text')
|
24
24
|
template.attributes['property'] = 'one'
|
@@ -3,14 +3,14 @@ $:.unshift File.dirname(__FILE__)
|
|
3
3
|
require 'common_templatelet_test'
|
4
4
|
|
5
5
|
module BuildMaster
|
6
|
-
|
6
|
+
describe 'WhenTest' do
|
7
7
|
include HelperMethods
|
8
8
|
|
9
|
-
|
9
|
+
before do
|
10
10
|
setup_spec
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
it 'should_process_child_when_evaluated_true' do
|
14
14
|
target = create_element('target')
|
15
15
|
template_content = <<CONTENT
|
16
16
|
<when test='expression_for_true'>
|
@@ -27,7 +27,7 @@ CONTENT
|
|
27
27
|
actual.text.should == 'Header'
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
it 'should_not_process_child_when_evaluated_false' do
|
31
31
|
target = create_element('target')
|
32
32
|
template_content = <<CONTENT
|
33
33
|
<when test='expression_for_false'>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
f2c2fdcb-b41e-ac41-a4e3-be7ce5ecf444
|