BuildMaster 1.0.9 → 1.1.9

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.
Files changed (76) hide show
  1. data/lib/buildmaster/algorithms.rb +3 -0
  2. data/lib/buildmaster/algorithms/opn_compare.rb +108 -0
  3. data/lib/buildmaster/cotta/cotta_dir.rb +7 -4
  4. data/lib/buildmaster/cotta/cotta_file.rb +5 -2
  5. data/lib/buildmaster/cotta/in_memory_system.rb +28 -4
  6. data/lib/buildmaster/project/java.rb +4 -0
  7. data/lib/buildmaster/project/java/class_path.rb +0 -0
  8. data/lib/buildmaster/project/java/javac.rb +9 -0
  9. data/lib/buildmaster/project/mysql_served_driver.rb +15 -0
  10. data/lib/buildmaster/project/pscp_driver.rb +0 -1
  11. data/lib/buildmaster/project/svn_driver.rb +4 -4
  12. data/lib/buildmaster/project/svn_server_driver.rb +18 -0
  13. data/lib/buildmaster/project/svn_status_info.rb +45 -42
  14. data/lib/buildmaster/site/content_engine_repository.rb +9 -0
  15. data/lib/buildmaster/site/file_processor.rb +5 -1
  16. data/lib/buildmaster/site/site.rb +11 -4
  17. data/lib/buildmaster/site/site_server.rb +1 -1
  18. data/lib/buildmaster/site/templatelets/href.rb +1 -1
  19. data/lib/buildmaster/version +1 -1
  20. data/test/buildmaster/algorithms/tc_opn_compare.rb +44 -0
  21. data/test/buildmaster/common/tc_properties.rb +8 -8
  22. data/test/buildmaster/common/tc_tree_to_object.rb +8 -8
  23. data/test/buildmaster/cotta/cotta_dir_behaviors.rb +167 -0
  24. data/test/buildmaster/cotta/cotta_file_behaviors.rb +127 -0
  25. data/test/buildmaster/cotta/cotta_specifications.rb +20 -0
  26. data/test/buildmaster/cotta/file_system_behaviors.rb +167 -0
  27. data/test/buildmaster/cotta/tc_command_interface.rb +6 -6
  28. data/test/buildmaster/cotta/tc_command_runner.rb +5 -5
  29. data/test/buildmaster/cotta/tc_cotta.rb +12 -12
  30. data/test/buildmaster/cotta/tc_cotta_dir_in_memory.rb +17 -17
  31. data/test/buildmaster/cotta/tc_cotta_dir_physical.rb +5 -5
  32. data/test/buildmaster/cotta/tc_cotta_file_in_memory.rb +8 -9
  33. data/test/buildmaster/cotta/tc_cotta_file_physical.rb +11 -8
  34. data/test/buildmaster/cotta/tc_cotta_zip_support.rb +9 -9
  35. data/test/buildmaster/cotta/tc_in_memory_system.rb +7 -7
  36. data/test/buildmaster/cotta/tc_io_chain.rb +3 -3
  37. data/test/buildmaster/cotta/tc_pathname.rb +6 -6
  38. data/test/buildmaster/cotta/tc_physical_system.rb +7 -8
  39. data/test/buildmaster/project/tc_ant_driver.rb +8 -8
  40. data/test/buildmaster/project/tc_build_number_file.rb +5 -5
  41. data/test/buildmaster/project/tc_cvs_driver.rb +9 -9
  42. data/test/buildmaster/project/tc_java_manifest.rb +9 -11
  43. data/test/buildmaster/project/tc_release.rb +12 -12
  44. data/test/buildmaster/project/tc_server_manager.rb +8 -8
  45. data/test/buildmaster/project/tc_svn_driver.rb +18 -13
  46. data/test/buildmaster/project/tc_svn_status_info.rb +8 -8
  47. data/test/buildmaster/project/tc_version_number_file.rb +6 -6
  48. data/test/buildmaster/project/windows/tc_iis_driver.rb +4 -4
  49. data/test/buildmaster/project/windows/tc_sql_server_driver.rb +2 -2
  50. data/test/buildmaster/site/content/tc_content_engine_repository.rb +5 -5
  51. data/test/buildmaster/site/tc_element_processor_by_name.rb +4 -4
  52. data/test/buildmaster/site/tc_file_processor.rb +8 -9
  53. data/test/buildmaster/site/tc_site.rb +23 -7
  54. data/test/buildmaster/site/tc_site_server.rb +2 -2
  55. data/test/buildmaster/site/tc_site_spec.rb +5 -5
  56. data/test/buildmaster/site/tc_source_file_handler.rb +2 -2
  57. data/test/buildmaster/site/tc_template_builder.rb +22 -11
  58. data/test/buildmaster/site/tc_template_error.rb +2 -2
  59. data/test/buildmaster/site/tc_template_runner.rb +4 -4
  60. data/test/buildmaster/site/tc_templatelets.rb +4 -4
  61. data/test/buildmaster/site/tc_xtemplate.rb +5 -5
  62. data/test/buildmaster/site/templatelets/tc_attribute.rb +6 -6
  63. data/test/buildmaster/site/templatelets/tc_code.rb +10 -10
  64. data/test/buildmaster/site/templatelets/tc_each.rb +3 -3
  65. data/test/buildmaster/site/templatelets/tc_href.rb +7 -7
  66. data/test/buildmaster/site/templatelets/tc_include.rb +3 -3
  67. data/test/buildmaster/site/templatelets/tc_link.rb +6 -6
  68. data/test/buildmaster/site/templatelets/tc_text.rb +4 -4
  69. data/test/buildmaster/site/templatelets/tc_when.rb +4 -4
  70. data/test/tmp/svn_test/repository/db/revprops/0 +1 -1
  71. data/test/tmp/svn_test/repository/db/revprops/1 +1 -1
  72. data/test/tmp/svn_test/repository/db/revprops/2 +1 -1
  73. data/test/tmp/svn_test/repository/db/revprops/3 +1 -1
  74. data/test/tmp/svn_test/repository/db/revprops/4 +1 -1
  75. data/test/tmp/svn_test/repository/db/uuid +1 -1
  76. metadata +60 -46
@@ -6,12 +6,12 @@ require 'cotta'
6
6
  require 'cotta/in_memory_system'
7
7
 
8
8
  module BuildMaster
9
- context 'zip support in cotta' do
10
- setup do
9
+ describe Cotta, 'zip support' do
10
+ before do
11
11
  @cotta = Cotta.new(InMemorySystem.new)
12
12
  end
13
13
 
14
- specify 'extract from a tar file' do
14
+ it 'extract from a tar file' do
15
15
  tar_file = Cotta.parent_of(__FILE__).file('tar_test.tar')
16
16
  dir = @cotta.dir('dir/extract')
17
17
  tar_file.extract(dir)
@@ -21,7 +21,7 @@ context 'zip support in cotta' do
21
21
  dir.file('three.txt').load.should == 'three'
22
22
  end
23
23
 
24
- specify 'archive files in the directory to a file' do
24
+ it 'should archive files in the directory to a file' do
25
25
  source = @cotta.dir('dir/source')
26
26
  source.file('one.txt').save('one')
27
27
  source.file('two.txt').save('two')
@@ -31,13 +31,13 @@ context 'zip support in cotta' do
31
31
 
32
32
  target_dir = @cotta.dir('target')
33
33
  tar_file.extract(target_dir)
34
- target_dir.should_have(3).list
35
34
  target_dir.file('one.txt').load.should == 'one'
36
35
  target_dir.file('two.txt').load.should == 'two'
37
36
  target_dir.file('three.txt').load.should == 'three'
37
+ target_dir.should have(3).list
38
38
  end
39
39
 
40
- specify 'archive subdirectories' do
40
+ it 'archive subdirectories' do
41
41
  source = @cotta.dir('dir/source')
42
42
  sub = source.dir('sub')
43
43
  sub.file('one.txt').save('one')
@@ -47,9 +47,9 @@ context 'zip support in cotta' do
47
47
 
48
48
  target_dir = @cotta.dir('target')
49
49
  tar_file.extract(target_dir)
50
- target_dir.should_have(1).list
51
- target_dir.dir('sub').should_exists
52
- target_dir.dir('sub').should_have(2).list
50
+ target_dir.should have(1).list
51
+ target_dir.dir('sub').should be_exists
52
+ target_dir.dir('sub').should have(2).list
53
53
  target_dir.file('sub/one.txt').load.should == 'one'
54
54
  target_dir.file('sub/two.txt').load.should == 'two'
55
55
  end
@@ -1,6 +1,6 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
- require 'system_file_specifications'
3
+ require 'file_system_behaviors'
4
4
 
5
5
  $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'buildmaster')
6
6
 
@@ -9,19 +9,19 @@ require 'spec'
9
9
 
10
10
  module BuildMaster
11
11
 
12
- context 'In memory system' do
13
- setup do
12
+ describe InMemorySystem do
13
+ it_should_behave_like 'FileSystemBehaviors'
14
+
15
+ def create_system
14
16
  @system = InMemorySystem.new
15
17
  @ios = Array.new
16
18
  end
17
19
 
18
- teardown do
20
+ after do
19
21
  @ios.each {|io| io.close unless io.closed?}
20
22
  end
21
23
 
22
- register_system_file_specifications
23
-
24
- specify 'root directory always exists' do
24
+ it 'root directory always exists' do
25
25
  @system.dir_exists?(Pathname.new('/')).should == true
26
26
  @system.dir_exists?(Pathname.new('D:/')).should == true
27
27
  end
@@ -10,13 +10,13 @@ require 'physical_system_stub'
10
10
 
11
11
  module BuildMaster
12
12
  module IoChain
13
- context 'io chain' do
13
+ describe IoChain do
14
14
  include IoChain
15
- setup do
15
+ before do
16
16
  @cotta = Cotta.new(PhysicalSystemStub.new)
17
17
  end
18
18
 
19
- specify 'copy binary io' do
19
+ it 'copy binary io' do
20
20
  file = Cotta.parent_of(__FILE__).file('logo.gif')
21
21
  target = @cotta.file('target.gif')
22
22
  file.read_binary do |input|
@@ -3,18 +3,18 @@ require 'spec'
3
3
 
4
4
  require 'cotta'
5
5
 
6
- context 'pathname methods for cotta' do
7
- specify 'parent check for unix path' do
6
+ describe Pathname do
7
+ it 'parent check for unix path' do
8
8
  pathname = Pathname.new('/')
9
- pathname.cotta_parent.should_be nil
9
+ pathname.cotta_parent.should be_nil
10
10
  end
11
11
 
12
- specify 'parent check for windows path' do
12
+ it 'parent check for windows path' do
13
13
  pathname = Pathname.new('D:/')
14
- pathname.cotta_parent.should_be nil
14
+ pathname.cotta_parent.should be_nil
15
15
  end
16
16
 
17
- specify 'parent check for normal ppl' do
17
+ it 'parent check for normal ppl' do
18
18
  pathname = Pathname.new('/test')
19
19
  pathname.cotta_parent.should == Pathname.new('/')
20
20
  end
@@ -1,6 +1,6 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
- require 'system_file_specifications'
3
+ require 'file_system_behaviors'
4
4
  require 'physical_system_stub'
5
5
 
6
6
  $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'buildmaster')
@@ -10,25 +10,24 @@ require 'spec'
10
10
 
11
11
  module BuildMaster
12
12
 
13
- context 'Physical System' do
14
- setup do
13
+ describe PhysicalSystem do
14
+ it_should_behave_like "FileSystemBehaviors"
15
+ def create_system
15
16
  @system = PhysicalSystemStub.new
16
17
  @ios = Array.new
17
18
  end
18
19
 
19
- teardown do
20
+ after do
20
21
  @ios.each {|io| io.close unless io.closed?}
21
22
  end
22
23
 
23
- register_system_file_specifications
24
-
25
- specify 'root directory always exists' do
24
+ it 'root directory always exists' do
26
25
  @system = PhysicalSystem.new
27
26
  @system.dir_exists?(Pathname.new('/')).should == true
28
27
  @system.dir_exists?(Pathname.new('D:/')).should == true
29
28
  end
30
29
 
31
- specify 'shell command should return output' do
30
+ it 'shell command should return output' do
32
31
  @system = PhysicalSystem.new
33
32
  @system.shell('ruby --version')[0..3].should == 'ruby'
34
33
  end
@@ -1,4 +1,4 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib", "buildmaster")
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "..", '..', "lib", "buildmaster")
2
2
 
3
3
  require 'spec'
4
4
  require 'project'
@@ -6,27 +6,27 @@ require 'cotta'
6
6
 
7
7
  module BuildMaster
8
8
 
9
- context 'AntTest' do
10
- setup do
9
+ describe AntDriver do
10
+ before do
11
11
  cotta = Cotta.new()
12
12
  build_file = cotta.file(__FILE__).parent.file('build.xml')
13
13
  @ant = AntDriver.from_file(build_file)
14
14
  end
15
15
 
16
- specify 'run' do
16
+ it 'run' do
17
17
  @ant.project_help
18
18
  end
19
19
 
20
- specify 'pass' do
20
+ it 'pass' do
21
21
  @ant.target('passing')
22
22
  end
23
23
 
24
- specify 'dynamic_method' do
24
+ it 'dynamic_method' do
25
25
  @ant.passing
26
26
  end
27
27
 
28
- specify 'fail' do
29
- lambda {@ant.target('failing')}.should_raise CommandError
28
+ it 'fail' do
29
+ lambda {@ant.target('failing')}.should raise_error(CommandError)
30
30
  end
31
31
  end
32
32
 
@@ -7,23 +7,23 @@ require 'cotta'
7
7
  require 'cotta/in_memory_system'
8
8
 
9
9
  module BuildMaster
10
- context 'BuildNumberFileTest' do
11
- setup do
10
+ describe BuildNumberFile do
11
+ before do
12
12
  @cotta = Cotta.new(InMemorySystem.new)
13
13
  end
14
14
 
15
- teardown do
15
+ after do
16
16
  @cotta = nil
17
17
  end
18
18
 
19
- specify 'load_file' do
19
+ it 'load_file' do
20
20
  path = @cotta.file('tmp/buildnumber')
21
21
  path.save(2)
22
22
  build_number = BuildNumberFile.new(path)
23
23
  build_number.number.should == 2
24
24
  end
25
25
 
26
- specify 'increase_build' do
26
+ it 'increase_build' do
27
27
  path = @cotta.file('tmp/buildnumber')
28
28
  path.save(3)
29
29
  build_number = BuildNumberFile.new(path)
@@ -1,27 +1,27 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib", 'buildmaster')
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "..", '..', "lib", 'buildmaster')
2
2
 
3
3
  require 'spec'
4
4
  require 'cotta'
5
5
  require 'cotta/in_memory_system'
6
- require 'cvs_driver'
6
+ require 'project/cvs_driver'
7
7
 
8
8
  module BuildMaster
9
9
 
10
- context 'CvsDriverTest' do
10
+ describe CvsDriver do
11
11
 
12
- setup do
12
+ before do
13
13
  @system = InMemorySystem.new
14
14
  @cotta = Cotta.new(@system)
15
15
  @working = @cotta.dir('working')
16
16
  end
17
17
 
18
- teardown do
18
+ after do
19
19
  @system = nil
20
20
  @cotta = nil
21
21
  @working = nil
22
22
  end
23
23
 
24
- specify 'load_CvsInfo' do
24
+ it 'load_CvsInfo' do
25
25
  folder = @cotta.dir('tmp')
26
26
  folder.mkdirs
27
27
  root = ':ext:wolfdancer@cvsserver.com:/cvs/root'
@@ -33,14 +33,14 @@ context 'CvsDriverTest' do
33
33
  cvs.repository.should == repository
34
34
  end
35
35
 
36
- specify 'checkout' do
36
+ it 'checkout' do
37
37
  @system.output_for_command 'cvs -d root co -d working module', ''
38
38
  client = CvsDriver.new(CvsInfo.new('root', 'module'), @working)
39
39
  client.checkout
40
40
  @system.executed_commands.size.should == 1
41
41
  end
42
42
 
43
- specify 'update' do
43
+ it 'update' do
44
44
  @system.output_for_command 'cvs -d root update working', ''
45
45
  @system.output_for_command 'cvs -d root update -PAd working', ''
46
46
  log = ''
@@ -51,7 +51,7 @@ context 'CvsDriverTest' do
51
51
  @system.executed_commands.size.should == 2
52
52
  end
53
53
 
54
- specify 'command' do
54
+ it 'command' do
55
55
  @system.output_for_command 'cvs -d root command -option argument working', ''
56
56
  log = ''
57
57
  client = CvsDriver.new(CvsInfo.new('root', 'module'), @working)
@@ -1,46 +1,44 @@
1
- $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib", 'buildmaster')
1
+ $:.unshift File.join(File.dirname(__FILE__), "..", "..", '..', "lib", 'buildmaster')
2
2
 
3
3
  require 'spec'
4
4
  require 'cotta'
5
5
  require 'cotta/in_memory_system'
6
- require 'java_manifest'
6
+ require 'project/java_manifest'
7
7
 
8
8
  module BuildMaster
9
9
 
10
- context 'JavaManifestTest' do
11
- setup do
10
+ describe JavaManifest do
11
+ before do
12
12
  @cotta = Cotta.new(InMemorySystem.new)
13
13
  end
14
14
 
15
- teardown do
15
+ after do
16
16
  @cotta = nil
17
17
  end
18
18
 
19
- specify 'loading_manifest' do
19
+ it 'loading_manifest' do
20
20
  file = @cotta.file('dir/manifest.mf')
21
- file.save(<<CONTENT
21
+ file.save <<CONTENT
22
22
  Implementation-Version: 2.3.3
23
23
  Implementation-Build: 1139
24
24
 
25
25
  Implementation-Vendor: Vendor
26
26
  Implementation-Number: Number
27
27
  CONTENT
28
- )
29
28
  manifest = JavaManifest.new(file)
30
29
  version = manifest.version
31
30
  "2.3.3".should == version.number
32
31
  end
33
32
 
34
- specify 'increase_build' do
33
+ it 'increase_build' do
35
34
  file = @cotta.file('dir/manifest.mf')
36
- file.save(<<CONTENT
35
+ file.save <<CONTENT
37
36
  Implementation-Version: 2.3.3
38
37
  Implementation-Build: 1139
39
38
 
40
39
  Implementation-Vendor: Vendor
41
40
  Implementation-Number: Number
42
41
  CONTENT
43
- )
44
42
  manifest = JavaManifest.new(file)
45
43
  build_number = manifest.version.build
46
44
  version = manifest.increase_build
@@ -1,12 +1,12 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'buildmaster', 'build')
1
+ $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'buildmaster')
2
2
 
3
- require 'release'
3
+ require 'project/release'
4
4
  require 'spec'
5
5
 
6
6
  module BuildMaster
7
7
 
8
- context 'release management' do
9
- specify 'run tasks in order' do
8
+ describe Release do
9
+ it 'run tasks in order' do
10
10
  mock = mock('tasks')
11
11
  mock.should_receive(:one).once.ordered
12
12
  mock.should_receive(:two).once.ordered
@@ -16,7 +16,7 @@ context 'release management' do
16
16
  release.execute
17
17
  end
18
18
 
19
- specify 'run task from specified step in order' do
19
+ it 'run task from specified step in order' do
20
20
  mock = mock('tasks')
21
21
  mock.should_receive(:two).once.ordered
22
22
  mock.should_receive(:three).once.ordered
@@ -27,7 +27,7 @@ context 'release management' do
27
27
  release.execute('two')
28
28
  end
29
29
 
30
- specify 'run tasks between two' do
30
+ it 'run tasks between two' do
31
31
  mock = mock('tasks')
32
32
  mock.should_receive(:two).once.ordered
33
33
  mock.should_receive(:three).once.ordered
@@ -39,21 +39,21 @@ context 'release management' do
39
39
  release.execute('two', 'three')
40
40
  end
41
41
 
42
- specify 'don\'t allow duplicate tasks' do
42
+ it 'don\'t allow duplicate tasks' do
43
43
  release = Release.new
44
44
  release.task('one') {}
45
- Proc.new {release.task('one')}.should_raise RuntimeError
45
+ Proc.new {release.task('one')}.should raise_error(RuntimeError)
46
46
  end
47
47
 
48
- specify 'raise error for task not found' do
48
+ it 'raise error for task not found' do
49
49
  release = Release.new
50
50
  release.task('two') {}
51
- Proc.new {release.execute('one')}.should_raise RuntimeError
51
+ Proc.new {release.execute('one')}.should raise_error(RuntimeError)
52
52
  end
53
53
 
54
- specify 'raise error for empty task' do
54
+ it 'raise error for empty task' do
55
55
  release = Release.new
56
- Proc.new {release.execute}.should_raise RuntimeError
56
+ Proc.new {release.execute}.should raise_error(RuntimeError)
57
57
  end
58
58
 
59
59
  end
@@ -1,8 +1,8 @@
1
- require 'spec'
2
-
3
1
  $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'buildmaster')
4
2
 
5
3
  require 'project/server_manager'
4
+ require 'spec'
5
+
6
6
 
7
7
  module BuildMaster
8
8
  class StubServer
@@ -26,12 +26,12 @@ class StubServer
26
26
  end
27
27
  end
28
28
 
29
- context 'server manager' do
30
- specify 'server manager default to stopped status' do
29
+ describe ServerManager do
30
+ it 'server manager default to stopped status' do
31
31
  ServerManager.new(mock('server')).status.should == 'stopped'
32
32
  end
33
33
 
34
- specify 'launch server' do
34
+ it 'launch server' do
35
35
  server = mock('server')
36
36
  server.should_receive(:start)
37
37
  server.should_receive(:running?).and_return(true)
@@ -40,20 +40,20 @@ context 'server manager' do
40
40
  manager.status.should == 'started'
41
41
  end
42
42
 
43
- specify 'keep checking server to see if it is running' do
43
+ it 'keep checking server to see if it is running' do
44
44
  manager = ServerManager.new(StubServer.new)
45
45
  manager.start
46
46
  manager.status.should == 'started'
47
47
  end
48
48
 
49
- specify 'stop and wait until it is not runnig anymore' do
49
+ it 'stop and wait until it is not runnig anymore' do
50
50
  manager = ServerManager.new(StubServer.new)
51
51
  manager.start
52
52
  manager.stop
53
53
  manager.status.should == 'stopped'
54
54
  end
55
55
 
56
- specify 'raise error if start failed' do
56
+ it 'raise error if start failed' do
57
57
  server = mock('server that fails on start')
58
58
  server.should_receive(:start).and_raise 'error'
59
59
  server.should_receive(:running?).any_number_of_times.and_return(false)