BuildMaster 0.8.1 → 0.9.0
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/README +6 -29
- data/lib/buildmaster.rb +0 -2
- data/lib/buildmaster/ant_driver.rb +13 -12
- data/lib/buildmaster/build_number_file.rb +2 -12
- data/lib/buildmaster/buildnumber +1 -1
- data/lib/buildmaster/cotta.rb +4 -0
- data/lib/buildmaster/cotta/command_error.rb +5 -0
- data/lib/buildmaster/cotta/cotta.rb +35 -0
- data/lib/buildmaster/cotta/cotta_dir.rb +73 -0
- data/lib/buildmaster/cotta/cotta_file.rb +99 -0
- data/lib/buildmaster/cotta/file_not_found_error.rb +13 -0
- data/lib/buildmaster/cotta/in_memory_system.rb +160 -0
- data/lib/buildmaster/cotta/physical_system.rb +64 -0
- data/lib/buildmaster/cvs_driver.rb +5 -13
- data/lib/buildmaster/file_processor.rb +34 -33
- data/lib/buildmaster/java_manifest.rb +3 -3
- data/lib/buildmaster/site/site.rb +11 -22
- data/lib/buildmaster/site_spec.rb +15 -13
- data/lib/buildmaster/source_file_handler.rb +1 -1
- data/lib/buildmaster/svn_driver.rb +14 -20
- data/lib/buildmaster/{template_exception.rb → template_error.rb} +1 -1
- data/lib/buildmaster/template_runner.rb +2 -2
- data/lib/buildmaster/templatelets/attribute.rb +1 -1
- data/lib/buildmaster/templatelets/href.rb +1 -1
- data/lib/buildmaster/templatelets/text.rb +1 -1
- data/lib/buildmaster/templatelets/when.rb +1 -1
- data/lib/buildmaster/windows.rb +3 -0
- data/lib/buildmaster/windows/iis_driver.rb +33 -0
- data/lib/buildmaster/windows/sql_server_driver.rb +27 -0
- data/test/buildmaster/cotta/content.txt +3 -0
- data/test/buildmaster/cotta/cotta_specifications.rb +172 -0
- data/test/buildmaster/cotta/physical_system_stub.rb +85 -0
- data/test/buildmaster/cotta/system_file_specifications.rb +131 -0
- data/test/buildmaster/cotta/tc_cotta.rb +33 -0
- data/test/buildmaster/cotta/tc_cotta_dir_in_memory.rb +23 -0
- data/test/buildmaster/cotta/tc_cotta_dir_physical.rb +17 -0
- data/test/buildmaster/cotta/tc_cotta_file_in_memory.rb +20 -0
- data/test/buildmaster/cotta/tc_cotta_file_physical.rb +17 -0
- data/test/buildmaster/cotta/tc_in_memory_system.rb +25 -0
- data/test/buildmaster/cotta/tc_physical_system.rb +26 -0
- data/test/buildmaster/manifest.mf +1 -1
- data/test/buildmaster/site/tc_site.rb +58 -34
- data/test/buildmaster/site/tc_template_builder.rb +32 -31
- data/test/buildmaster/tc_ant_driver.rb +11 -13
- data/test/buildmaster/tc_build_number_file.rb +21 -16
- data/test/buildmaster/tc_cvs_driver.rb +35 -37
- data/test/buildmaster/tc_file_processor.rb +58 -34
- data/test/buildmaster/tc_java_manifest.rb +37 -9
- data/test/buildmaster/tc_site_spec.rb +20 -15
- data/test/buildmaster/tc_source_file_handler.rb +4 -4
- data/test/buildmaster/tc_svn_driver.rb +51 -38
- data/test/buildmaster/tc_template_runner.rb +19 -18
- data/test/buildmaster/tc_tree_to_object.rb +47 -46
- data/test/buildmaster/tc_xtemplate.rb +52 -38
- data/test/buildmaster/templatelets/common_templatelet_test.rb +9 -8
- data/test/buildmaster/templatelets/tc_attribute.rb +26 -23
- data/test/buildmaster/templatelets/tc_each.rb +27 -26
- data/test/buildmaster/templatelets/tc_href.rb +14 -13
- data/test/buildmaster/templatelets/tc_include.rb +11 -4
- data/test/buildmaster/templatelets/tc_link.rb +18 -12
- data/test/buildmaster/templatelets/tc_text.rb +12 -7
- data/test/buildmaster/templatelets/tc_when.rb +11 -5
- data/test/buildmaster/windows/tc_iis_driver.rb +29 -0
- data/test/buildmaster/windows/tc_sql_server_driver.rb +24 -0
- data/test/spec_runner.rb +27 -0
- data/test/ts_buildmaster.rb +2 -19
- metadata +34 -10
- data/lib/buildmaster/release_control.rb +0 -22
- data/lib/buildmaster/shell_command.rb +0 -39
- data/test/buildmaster/tc_release_control.rb +0 -27
- data/test/buildmaster/ts_site.rb +0 -4
- data/test/buildmaster/ts_templatelets.rb +0 -10
| @@ -1,31 +1,36 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), '..', '..', 'lib')
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'spec'
         | 
| 4 4 |  | 
| 5 5 | 
             
            require 'buildmaster/build_number_file'
         | 
| 6 | 
            +
            require 'buildmaster/cotta'
         | 
| 7 | 
            +
            require 'buildmaster/cotta/in_memory_system'
         | 
| 6 8 |  | 
| 7 9 | 
             
            module BuildMaster
         | 
| 8 | 
            -
             | 
| 9 | 
            -
               | 
| 10 | 
            -
                 | 
| 10 | 
            +
            context 'BuildNumberFileTest' do
         | 
| 11 | 
            +
              setup do
         | 
| 12 | 
            +
                @cotta = Cotta.new(InMemorySystem.new)
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
              
         | 
| 15 | 
            +
              teardown do
         | 
| 16 | 
            +
                @cotta = nil
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
              
         | 
| 19 | 
            +
              specify 'load_file' do
         | 
| 20 | 
            +
                path = @cotta.file('tmp/buildnumber')
         | 
| 21 | 
            +
                path.save(2)
         | 
| 11 22 | 
             
                build_number = BuildNumberFile.new(path)
         | 
| 12 | 
            -
                 | 
| 23 | 
            +
                build_number.number.should_equal 2
         | 
| 13 24 | 
             
              end
         | 
| 14 25 |  | 
| 15 | 
            -
               | 
| 16 | 
            -
                path =  | 
| 26 | 
            +
              specify 'increase_build' do
         | 
| 27 | 
            +
                path = @cotta.file('tmp/buildnumber')
         | 
| 28 | 
            +
                path.save(3)
         | 
| 17 29 | 
             
                build_number = BuildNumberFile.new(path)
         | 
| 18 30 | 
             
                build_number.increase_build
         | 
| 19 | 
            -
                 | 
| 31 | 
            +
                build_number.number.should_equal 4
         | 
| 20 32 | 
             
                reloaded = BuildNumberFile.new(path)
         | 
| 21 | 
            -
                 | 
| 22 | 
            -
              end
         | 
| 23 | 
            -
              
         | 
| 24 | 
            -
              private
         | 
| 25 | 
            -
              def tmp_file(build_number)
         | 
| 26 | 
            -
                path = File.join(File.dirname(__FILE__), '..', '..', 'tmp', 'buildnumber')
         | 
| 27 | 
            -
                File.open(path, "w") {|file| file.puts build_number}
         | 
| 28 | 
            -
                return path
         | 
| 33 | 
            +
                reloaded.number.should_equal 4
         | 
| 29 34 | 
             
              end
         | 
| 30 35 | 
             
            end
         | 
| 31 36 | 
             
            end
         | 
| @@ -1,64 +1,62 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'spec'
         | 
| 4 4 | 
             
            require 'buildmaster'
         | 
| 5 | 
            +
            require 'buildmaster/cotta'
         | 
| 6 | 
            +
            require 'buildmaster/cotta/in_memory_system'
         | 
| 5 7 |  | 
| 6 8 | 
             
            module BuildMaster
         | 
| 7 9 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
               | 
| 11 | 
            -
                 | 
| 10 | 
            +
            context 'CvsDriverTest' do
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              setup do
         | 
| 13 | 
            +
                @system = InMemorySystem.new
         | 
| 14 | 
            +
                @cotta = Cotta.new(@system)
         | 
| 15 | 
            +
                @working = @cotta.dir('working')
         | 
| 12 16 | 
             
              end
         | 
| 13 17 |  | 
| 14 | 
            -
               | 
| 15 | 
            -
             | 
| 16 | 
            -
                 | 
| 17 | 
            -
             | 
| 18 | 
            -
                end
         | 
| 18 | 
            +
              teardown do
         | 
| 19 | 
            +
                @system = nil
         | 
| 20 | 
            +
                @cotta = nil
         | 
| 21 | 
            +
                @working = nil
         | 
| 19 22 | 
             
              end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
               | 
| 22 | 
            -
             | 
| 23 | 
            -
                folder | 
| 24 | 
            -
                ensure_folder_exists(folder);
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              specify 'load_CvsInfo' do
         | 
| 25 | 
            +
                folder = @cotta.dir('tmp')
         | 
| 26 | 
            +
                folder.mkdirs
         | 
| 25 27 | 
             
                root = ':ext:wolfdancer@cvsserver.com:/cvs/root'
         | 
| 26 28 | 
             
                repository = 'xpe'
         | 
| 27 | 
            -
                 | 
| 28 | 
            -
                 | 
| 29 | 
            +
                folder.file('ROOT').save(root)
         | 
| 30 | 
            +
                folder.file('Repository').save(repository)
         | 
| 29 31 | 
             
                cvs = CvsInfo.load(folder)
         | 
| 30 | 
            -
                 | 
| 31 | 
            -
                 | 
| 32 | 
            +
                cvs.root.should_equal root
         | 
| 33 | 
            +
                cvs.repository.should_equal repository
         | 
| 32 34 | 
             
              end
         | 
| 33 35 |  | 
| 34 | 
            -
               | 
| 35 | 
            -
                 | 
| 36 | 
            -
                client = CvsDriver.new(CvsInfo.new('root', 'module'), 'working') {|command| log = command}
         | 
| 36 | 
            +
              specify 'checkout' do
         | 
| 37 | 
            +
                client = CvsDriver.new(CvsInfo.new('root', 'module'), @working)
         | 
| 37 38 | 
             
                client.checkout
         | 
| 38 | 
            -
                 | 
| 39 | 
            +
                @system.executed_commands.size.should_equal 1
         | 
| 40 | 
            +
                @system.executed_commands[0].should_equal 'cvs -d root co -d working module'
         | 
| 39 41 | 
             
              end
         | 
| 40 42 |  | 
| 41 | 
            -
               | 
| 43 | 
            +
              specify 'update' do
         | 
| 42 44 | 
             
                log = ''
         | 
| 43 | 
            -
                client = CvsDriver.new(CvsInfo.new('root', 'module'),  | 
| 45 | 
            +
                client = CvsDriver.new(CvsInfo.new('root', 'module'), @working)
         | 
| 44 46 | 
             
                client.update
         | 
| 45 | 
            -
                 | 
| 47 | 
            +
                @system.executed_commands.size.should_equal 1
         | 
| 48 | 
            +
                @system.executed_commands[0].should_equal 'cvs -d root update working'
         | 
| 46 49 | 
             
                client.update('-PAd')
         | 
| 47 | 
            -
                 | 
| 50 | 
            +
                @system.executed_commands.size.should_equal 2
         | 
| 51 | 
            +
                @system.executed_commands[1].should_equal 'cvs -d root update -PAd working'
         | 
| 48 52 | 
             
              end
         | 
| 49 53 |  | 
| 50 | 
            -
               | 
| 54 | 
            +
              specify 'command' do
         | 
| 51 55 | 
             
                log = ''
         | 
| 52 | 
            -
                client = CvsDriver.new(CvsInfo.new('root', 'module'),  | 
| 56 | 
            +
                client = CvsDriver.new(CvsInfo.new('root', 'module'), @working)
         | 
| 53 57 | 
             
                client.command('command -option argument')
         | 
| 54 | 
            -
                 | 
| 55 | 
            -
             | 
| 56 | 
            -
              
         | 
| 57 | 
            -
              private 
         | 
| 58 | 
            -
              def write(fileName, content)
         | 
| 59 | 
            -
                File.open(fileName, "w") do |file|
         | 
| 60 | 
            -
                  file.puts content
         | 
| 61 | 
            -
                end
         | 
| 58 | 
            +
                @system.executed_commands.size.should_equal 1
         | 
| 59 | 
            +
                @system.executed_commands[0].should_equal 'cvs -d root command -option argument working'
         | 
| 62 60 | 
             
              end
         | 
| 63 61 |  | 
| 64 62 | 
             
            end
         | 
| @@ -1,76 +1,100 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'spec'
         | 
| 4 4 | 
             
            require 'rexml/document'
         | 
| 5 5 | 
             
            require 'pathname'
         | 
| 6 6 | 
             
            require 'buildmaster/file_processor'
         | 
| 7 7 | 
             
            require 'buildmaster/xtemplate'
         | 
| 8 | 
            +
            require 'buildmaster/cotta'
         | 
| 9 | 
            +
            require 'buildmaster/cotta/in_memory_system'
         | 
| 10 | 
            +
             | 
| 8 11 |  | 
| 9 12 | 
             
            module BuildMaster
         | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 13 | 
            +
             | 
| 14 | 
            +
            context 'File Processor' do
         | 
| 15 | 
            +
              setup do
         | 
| 16 | 
            +
                @cotta = Cotta.new(InMemorySystem.new)
         | 
| 17 | 
            +
                @cotta.file('content').save(<<CONTENT
         | 
| 18 | 
            +
            line one
         | 
| 19 | 
            +
            line two
         | 
| 20 | 
            +
            line three
         | 
| 21 | 
            +
            CONTENT
         | 
| 22 | 
            +
            )
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
              
         | 
| 25 | 
            +
              teardown do
         | 
| 26 | 
            +
                @cotta = nil
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              specify 'should know content and target' do
         | 
| 12 30 | 
             
                  template = XTemplate.new(<<CONTENT
         | 
| 13 31 | 
             
            <html xmlns="http://www.w3.org/1999/xhtml"
         | 
| 14 32 | 
             
                    xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
         | 
| 15 33 | 
             
            </html>
         | 
| 16 34 | 
             
            CONTENT
         | 
| 17 35 | 
             
            )
         | 
| 18 | 
            -
                  site_spec = SiteSpec.new
         | 
| 19 | 
            -
                   | 
| 20 | 
            -
                  site_spec. | 
| 21 | 
            -
                   | 
| 22 | 
            -
                  processor | 
| 23 | 
            -
                   | 
| 24 | 
            -
                  assert_equal(true, processor.is_html?)
         | 
| 36 | 
            +
                  site_spec = SiteSpec.new('file.txt', @cotta)
         | 
| 37 | 
            +
                  site_spec.content_dir = 'content'
         | 
| 38 | 
            +
                  site_spec.output_dir = 'output'
         | 
| 39 | 
            +
                  processor = FileProcessor.new(template, @cotta.file('content/index.html'), site_spec)
         | 
| 40 | 
            +
                  processor.content_file.path.should_equal(Pathname.new('content/index.html'))
         | 
| 41 | 
            +
                  processor.is_html?.should_equal(true)
         | 
| 25 42 | 
             
              end
         | 
| 26 43 |  | 
| 27 | 
            -
               | 
| 44 | 
            +
              specify 'should know HTML target file' do
         | 
| 28 45 | 
             
                  template = XTemplate.new(<<CONTENT
         | 
| 29 46 | 
             
            <html xmlns="http://www.w3.org/1999/xhtml"
         | 
| 30 47 | 
             
                    xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
         | 
| 31 48 | 
             
            </html>
         | 
| 32 49 | 
             
            CONTENT
         | 
| 33 50 | 
             
            )
         | 
| 34 | 
            -
                  site_spec = SiteSpec.new
         | 
| 35 | 
            -
                  current_dir =  | 
| 36 | 
            -
                  site_spec.content_dir =  | 
| 37 | 
            -
                  site_spec.output_dir =  | 
| 38 | 
            -
                  processor = FileProcessor.new(template,  | 
| 39 | 
            -
                   | 
| 40 | 
            -
                   | 
| 41 | 
            -
                   | 
| 51 | 
            +
                  site_spec = SiteSpec.new(nil, @cotta)
         | 
| 52 | 
            +
                  current_dir = @cotta.dir('root')
         | 
| 53 | 
            +
                  site_spec.content_dir = 'root/content'
         | 
| 54 | 
            +
                  site_spec.output_dir = 'root/output'
         | 
| 55 | 
            +
                  processor = FileProcessor.new(template, current_dir.dir('content').file('index.gif'), site_spec)
         | 
| 56 | 
            +
                  processor.content_file.path.should_equal current_dir.dir('content').file('index.gif').path
         | 
| 57 | 
            +
                  processor.is_html?.should_equal false
         | 
| 58 | 
            +
                  processor.generate_document.should_equal nil
         | 
| 42 59 | 
             
              end
         | 
| 43 60 |  | 
| 44 | 
            -
               | 
| 61 | 
            +
              specify 'should load from target file' do
         | 
| 45 62 | 
             
                  template_content = <<CONTENT
         | 
| 46 63 | 
             
            <html xmlns="http://www.w3.org/1999/xhtml"
         | 
| 47 64 | 
             
                    xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
         | 
| 48 65 | 
             
            </html>
         | 
| 49 66 | 
             
            CONTENT
         | 
| 50 | 
            -
                  site_spec = SiteSpec.new
         | 
| 51 | 
            -
                  current_dir = File.dirname(__FILE__)
         | 
| 67 | 
            +
                  site_spec = SiteSpec.new(__FILE__, @cotta)
         | 
| 68 | 
            +
                  current_dir = @cotta.dir(File.dirname(__FILE__))
         | 
| 69 | 
            +
                  current_dir.dir('site').dir('content').file('index.html').save
         | 
| 70 | 
            +
                  current_dir.dir('site').dir('content').file('index.gif').save
         | 
| 71 | 
            +
                  current_dir.dir('site').dir('content').file('textile.textile').save
         | 
| 72 | 
            +
                  current_dir.dir('site').dir('content').file('markdown.markdown').save
         | 
| 52 73 | 
             
                  site_spec.template = template_content
         | 
| 53 | 
            -
                  site_spec.content_dir =  | 
| 54 | 
            -
                  site_spec.output_dir =  | 
| 74 | 
            +
                  site_spec.content_dir = 'site/content'
         | 
| 75 | 
            +
                  site_spec.output_dir = 'output'
         | 
| 55 76 | 
             
                  processor = FileProcessor.for_request_path('/index.html', site_spec)
         | 
| 56 | 
            -
                   | 
| 77 | 
            +
                  processor.content_file.should_equal site_spec.content_dir.file('index.html')
         | 
| 78 | 
            +
                  
         | 
| 57 79 | 
             
                  processor = FileProcessor.for_request_path('/index.gif', site_spec)
         | 
| 58 | 
            -
                   | 
| 80 | 
            +
                  processor.content_file.should_equal site_spec.content_dir.file('index.gif')
         | 
| 81 | 
            +
             | 
| 59 82 | 
             
                  processor = FileProcessor.for_request_path('/textile.html', site_spec)
         | 
| 60 | 
            -
                   | 
| 83 | 
            +
                  processor.content_file.should_equal site_spec.content_dir.file('textile.textile')
         | 
| 84 | 
            +
             | 
| 61 85 | 
             
                  processor = FileProcessor.for_request_path('/markdown.html', site_spec)
         | 
| 62 | 
            -
                   | 
| 86 | 
            +
                  processor.content_file.should_equal site_spec.content_dir.file('markdown.markdown')
         | 
| 63 87 | 
             
              end
         | 
| 64 88 |  | 
| 65 89 | 
             
              def output_dir
         | 
| 66 | 
            -
                return 'tmp'
         | 
| 90 | 
            +
                return @cotta.dir('tmp')
         | 
| 67 91 | 
             
              end
         | 
| 68 92 |  | 
| 69 93 | 
             
              def relative_to_root(path)
         | 
| 70 94 | 
             
                return Pathname.new('tmp')
         | 
| 71 95 | 
             
              end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
               | 
| 96 | 
            +
             | 
| 97 | 
            +
              specify 'should have support for markdown content' do
         | 
| 74 98 | 
             
                template_content = <<CONTENT
         | 
| 75 99 | 
             
            <html xmlns="http://www.w3.org/1999/xhtml"
         | 
| 76 100 | 
             
                    xmlns:template="http://buildmaster.rubyforge.org/xtemplate/1.0">
         | 
| @@ -83,7 +107,7 @@ CONTENT | |
| 83 107 | 
             
                hash = {'include' => Include.new(self)}
         | 
| 84 108 | 
             
                template = XTemplate.new(template_content, hash)
         | 
| 85 109 |  | 
| 86 | 
            -
                processor = FileProcessor.new(template,  | 
| 110 | 
            +
                processor = FileProcessor.new(template, @cotta.file('content_path'), self)
         | 
| 87 111 | 
             
                markdown_content = <<CONTENT
         | 
| 88 112 | 
             
            --------------------------------------------
         | 
| 89 113 | 
             
            Title Here
         | 
| @@ -93,8 +117,8 @@ Header | |
| 93 117 | 
             
            CONTENT
         | 
| 94 118 | 
             
                document = processor.process_markdown(markdown_content)
         | 
| 95 119 | 
             
                document = REXML::Document.new(document.to_s)
         | 
| 96 | 
            -
                 | 
| 97 | 
            -
                 | 
| 120 | 
            +
                REXML::XPath.first(document, '/html/head/title').text.should_equal 'Title Here'
         | 
| 121 | 
            +
                REXML::XPath.first(document, '/html/body/h1').text.should_equal 'Header'
         | 
| 98 122 | 
             
              end
         | 
| 99 123 |  | 
| 100 124 | 
             
            end
         | 
| @@ -1,23 +1,51 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'spec'
         | 
| 4 4 | 
             
            require 'buildmaster'
         | 
| 5 | 
            +
            require 'buildmaster/cotta'
         | 
| 6 | 
            +
            require 'buildmaster/cotta/in_memory_system'
         | 
| 5 7 |  | 
| 6 8 | 
             
            module BuildMaster
         | 
| 7 9 |  | 
| 8 | 
            -
             | 
| 9 | 
            -
               | 
| 10 | 
            -
                 | 
| 10 | 
            +
            context 'JavaManifestTest' do
         | 
| 11 | 
            +
              setup do
         | 
| 12 | 
            +
                @cotta = Cotta.new(InMemorySystem.new)
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
              
         | 
| 15 | 
            +
              teardown do
         | 
| 16 | 
            +
                @cotta = nil
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              specify 'loading_manifest' do
         | 
| 20 | 
            +
                file = @cotta.file('dir/manifest.mf')
         | 
| 21 | 
            +
                file.save(<<CONTENT
         | 
| 22 | 
            +
            Implementation-Version: 2.3.3
         | 
| 23 | 
            +
            Implementation-Build: 1139
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            Implementation-Vendor: Vendor
         | 
| 26 | 
            +
            Implementation-Number: Number
         | 
| 27 | 
            +
            CONTENT
         | 
| 28 | 
            +
            )
         | 
| 29 | 
            +
                manifest = JavaManifest.new(file)
         | 
| 11 30 | 
             
                version = manifest.version
         | 
| 12 | 
            -
                 | 
| 31 | 
            +
                "2.3.3".should_equal version.number
         | 
| 13 32 | 
             
              end
         | 
| 14 33 |  | 
| 15 | 
            -
               | 
| 16 | 
            -
                 | 
| 34 | 
            +
              specify 'increase_build' do
         | 
| 35 | 
            +
                file = @cotta.file('dir/manifest.mf')
         | 
| 36 | 
            +
                file.save(<<CONTENT
         | 
| 37 | 
            +
            Implementation-Version: 2.3.3
         | 
| 38 | 
            +
            Implementation-Build: 1139
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            Implementation-Vendor: Vendor
         | 
| 41 | 
            +
            Implementation-Number: Number
         | 
| 42 | 
            +
            CONTENT
         | 
| 43 | 
            +
            )    
         | 
| 44 | 
            +
                manifest = JavaManifest.new(file)
         | 
| 17 45 | 
             
                build_number = manifest.version.build
         | 
| 18 46 | 
             
                version = manifest.increase_build
         | 
| 19 | 
            -
                 | 
| 20 | 
            -
                 | 
| 47 | 
            +
                (build_number + 1).should_equal version.build
         | 
| 48 | 
            +
                manifest.version.build.should_equal version.build
         | 
| 21 49 | 
             
              end
         | 
| 22 50 | 
             
            end
         | 
| 23 51 | 
             
            end
         | 
| @@ -1,26 +1,31 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'spec'
         | 
| 4 4 | 
             
            require 'buildmaster'
         | 
| 5 | 
            +
            require 'buildmaster/cotta'
         | 
| 6 | 
            +
            require 'buildmaster/cotta/in_memory_system'
         | 
| 5 7 |  | 
| 6 8 | 
             
            module BuildMaster
         | 
| 7 9 |  | 
| 8 | 
            -
             | 
| 10 | 
            +
            context 'Site Specification' do
         | 
| 11 | 
            +
              setup do
         | 
| 12 | 
            +
                @cotta = Cotta.new(InMemorySystem.new)
         | 
| 13 | 
            +
              end
         | 
| 9 14 |  | 
| 10 | 
            -
               | 
| 11 | 
            -
                spec = SiteSpec.new()
         | 
| 15 | 
            +
              specify 'get relative path' do
         | 
| 16 | 
            +
                spec = SiteSpec.new(nil, @cotta)
         | 
| 12 17 | 
             
                spec.content_dir = '/one/two/content'
         | 
| 13 | 
            -
                 | 
| 18 | 
            +
                spec.relative_to_root(@cotta.file('/one/two/content/images/logo.gif')).to_s.should_equal('images/logo.gif')
         | 
| 14 19 | 
             
              end
         | 
| 15 20 |  | 
| 16 | 
            -
               | 
| 17 | 
            -
                spec = SiteSpec.new()
         | 
| 18 | 
            -
                spec.content_dir =  | 
| 19 | 
            -
                 | 
| 21 | 
            +
              specify 'supports windows path' do
         | 
| 22 | 
            +
                spec = SiteSpec.new(nil, @cotta)
         | 
| 23 | 
            +
                spec.content_dir = 'C:\Work\project\content'
         | 
| 24 | 
            +
                spec.relative_to_root(@cotta.file('C:\Work\project\content\images\logo.gif')).to_s.should_equal('images/logo.gif')
         | 
| 20 25 | 
             
              end
         | 
| 21 26 |  | 
| 22 | 
            -
               | 
| 23 | 
            -
                spec = SiteSpec.new(__FILE__) do |sitespec|
         | 
| 27 | 
            +
              specify 'initialization with block' do
         | 
| 28 | 
            +
                spec = SiteSpec.new(__FILE__, @cotta) do |sitespec|
         | 
| 24 29 | 
             
                  sitespec.content_dir = 'content'
         | 
| 25 30 | 
             
                  sitespec.output_dir = 'output'
         | 
| 26 31 | 
             
                  sitespec.page_layout = <<CONTENT
         | 
| @@ -39,10 +44,10 @@ menu_groups: | |
| 39 44 | 
             
            - title: second menu group
         | 
| 40 45 | 
             
            CONTENT
         | 
| 41 46 | 
             
                end
         | 
| 42 | 
            -
                root =  | 
| 43 | 
            -
                 | 
| 44 | 
            -
                 | 
| 45 | 
            -
                 | 
| 47 | 
            +
                root = @cotta.dir(__FILE__).parent
         | 
| 48 | 
            +
                spec.content_dir.should_equal(root.dir('content'))
         | 
| 49 | 
            +
                spec.output_dir.should_equal(root.dir('output'))
         | 
| 50 | 
            +
                spec.load_template_source.to_s.include?('first menu group').should_equal true
         | 
| 46 51 | 
             
              end
         | 
| 47 52 |  | 
| 48 53 | 
             
            end
         | 
| @@ -1,16 +1,16 @@ | |
| 1 1 | 
             
            $:.unshift File.join(File.dirname(__FILE__), "..", "..", "lib")
         | 
| 2 2 |  | 
| 3 | 
            -
            require ' | 
| 3 | 
            +
            require 'spec'
         | 
| 4 4 | 
             
            require 'buildmaster'
         | 
| 5 5 | 
             
            require 'webrick'
         | 
| 6 6 | 
             
            require 'source_file_handler'
         | 
| 7 7 |  | 
| 8 8 | 
             
            module BuildMaster
         | 
| 9 9 |  | 
| 10 | 
            -
             | 
| 10 | 
            +
            context 'SourceFileHandler' do
         | 
| 11 11 | 
             
              attr_reader :path_info
         | 
| 12 12 |  | 
| 13 | 
            -
               | 
| 13 | 
            +
              specify 'should_be_able_to_find_source' do
         | 
| 14 14 | 
             
                server = WEBrick::HTTPServer.new(:Port => 2000)
         | 
| 15 15 | 
             
                dir = File.dirname(__FILE__)
         | 
| 16 16 | 
             
                spec = SiteSpec.new
         | 
| @@ -30,7 +30,7 @@ TEMPLATE | |
| 30 30 | 
             
                @path_info = '/markdown.html'
         | 
| 31 31 | 
             
                file_handler.service(self, self)
         | 
| 32 32 | 
             
                document = REXML::Document.new(self['body'])
         | 
| 33 | 
            -
                 | 
| 33 | 
            +
                REXML::XPath.first(document, '/html/head/title').text.should_equal 'Title'
         | 
| 34 34 | 
             
              end
         | 
| 35 35 |  | 
| 36 36 | 
             
              def []=(name, value)
         |