BuildMaster 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 9
1
+ 15
@@ -54,7 +54,6 @@ class Releases
54
54
  def initialize
55
55
  @pre_release_version = 'n/a'
56
56
  @snap_shot_version = 'n/a'
57
- @download_link = 'download.html'
58
57
  @versioning_link = 'versioning.html'
59
58
  end
60
59
  end
@@ -12,22 +12,19 @@ class SvnInfo
12
12
  end
13
13
 
14
14
  def analyze_entry_file(path)
15
- content = load_content(path)
16
- xml = REXML::Document.new(content)
17
- xml.root.each_element_with_attribute('name', '', 1) do |element|
18
- @repository_root = element.attributes['repos']
15
+ File.open(path, 'r') do |file|
16
+ parse_xml_load_repository_root(file)
19
17
  end
20
18
  end
21
19
 
22
- def load_content(path)
23
- buffer = StringIO.new
24
- File.open(path, 'r') do |file|
25
- while (line = file.gets)
26
- buffer.puts(line)
27
- end
20
+ private
21
+ def parse_xml_load_repository_root(file)
22
+ xml = REXML::Document.new(file)
23
+ xml.root.each_element_with_attribute('name', '', 1) do |element|
24
+ @repository_root = element.attributes['repos']
28
25
  end
29
- return buffer.string
30
26
  end
27
+
31
28
  end
32
29
 
33
30
  class SvnDriver
@@ -22,7 +22,11 @@ class Href
22
22
  def construct_href(url, current_path)
23
23
  href = url
24
24
  if (URI.parse(url).scheme.nil?)
25
- href = Pathname.new(url).relative_path_from(current_path.parent)
25
+ path = Pathname.new(url)
26
+ if (not path.relative?)
27
+ path = path.relative_path_from(Pathname.new('/'))
28
+ end
29
+ href = path.relative_path_from(current_path.parent)
26
30
  end
27
31
  return href
28
32
  end
@@ -36,4 +40,4 @@ class Href
36
40
  end
37
41
  end
38
42
  end
39
- end
43
+ end
@@ -1,5 +1,5 @@
1
1
  Implementation-Version: 2.3.3
2
- Implementation-Build: 1114
2
+ Implementation-Build: 1132
3
3
 
4
4
  Implementation-Vendor: Vendor
5
5
  Implementation-Number: Number
@@ -77,7 +77,15 @@ class TemplateBuilderTest < Test::Unit::TestCase
77
77
  releases.snap_shot_version = 'n/a'
78
78
  releases.download_link = 'download.html'
79
79
  releases.versioning_link = 'versioning.html'
80
- builder.generate
80
+ document = builder.generate
81
+ assert_equal('Latest Versions', REXML::XPath.first(document, '/html/body/template:when/div[@class="right"]/div/h1').text)
82
+ end
83
+
84
+ def test_should_have_no_release_info_if_not_assigned
85
+ builder = TemplateBuilder.new
86
+ builder.releases.download_link = nil
87
+ document = builder.generate
88
+ assert_equal(0, REXML::XPath.match(document, '/html/body/template:when/div/*').size)
81
89
  end
82
90
 
83
91
  def test_should_read_from_yaml
@@ -11,7 +11,7 @@ class SourceFileHandlerTest < Test::Unit::TestCase
11
11
  attr_reader :path_info
12
12
 
13
13
  def test_should_be_able_to_find_source
14
- server = WEBrick::HTTPServer.new
14
+ server = WEBrick::HTTPServer.new(:Port => 2000)
15
15
  dir = File.dirname(__FILE__)
16
16
  spec = SiteSpec.new
17
17
  spec.template =<<TEMPLATE
@@ -43,6 +43,13 @@ class HrefTest < CommonTemplateletTest
43
43
  @href.process(@target_element, @template_element, source('download/download.html'))
44
44
  assert_equal('http://www.google.com', @target_element.attributes['src'])
45
45
  end
46
+
47
+ def test_should_handle_absolute_path
48
+ @template_element.attributes['url'] = '/doc.html'
49
+ @target_element = create_element('img')
50
+ @href.process(@target_element, @template_element, source('download/download.html'))
51
+ assert_equal('../doc.html', @target_element.attributes['src'])
52
+ end
46
53
 
47
54
  end
48
- end
55
+ end
@@ -45,15 +45,15 @@ CONTENT
45
45
  end
46
46
 
47
47
  def expression_for_true(path)
48
- return true
48
+ return 'word two' =~ /word/
49
49
  end
50
50
 
51
51
  def expression_for_false(path)
52
- return false
52
+ return 'one word two' =~ /nomatch/
53
53
  end
54
54
 
55
55
  def load_templatelets
56
56
  return Hash.new
57
57
  end
58
58
  end
59
- end
59
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: BuildMaster
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.0
7
- date: 2006-08-08 00:00:00 -07:00
6
+ version: 0.8.1
7
+ date: 2006-08-31 00:00:00 -06:00
8
8
  summary: A project that hosts a series of scripts to be used in project building, project releasing, and site building.
9
9
  require_paths:
10
10
  - lib