rbook-onix 0.5.1 → 0.5.2

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/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/testtask'
6
6
  require "rake/gempackagetask"
7
7
  require 'spec/rake/spectask'
8
8
 
9
- PKG_VERSION = "0.5.1"
9
+ PKG_VERSION = "0.5.2"
10
10
  PKG_NAME = "rbook-onix"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  RUBYFORGE_PROJECT = 'rbook'
@@ -24,7 +24,14 @@ task :cruise => [ :spec, :spec_report, :doc ]
24
24
  desc "Run all rspec files"
25
25
  Spec::Rake::SpecTask.new("spec") do |t|
26
26
  t.spec_files = FileList['specs/**/*.rb']
27
- t.rcov = true
27
+
28
+ if RUBY_VERSION >= "1.8.6" && RUBY_PATCHLEVEL >= 110
29
+ t.rcov = false
30
+ else
31
+ t.rcov = true
32
+ end
33
+
34
+ t.rcov_dir = (ENV['CC_BUILD_ARTIFACTS'] || 'doc') + "/rcov"
28
35
  t.rcov_dir = (ENV['CC_BUILD_ARTIFACTS'] || 'doc') + "/rcov"
29
36
  t.rcov_opts = ["--exclude","spec.*\.rb"]
30
37
  end
@@ -49,9 +49,15 @@ module Onix
49
49
 
50
50
  # Return an XML string representing this contributor
51
51
  def to_s
52
- tmp = to_element
53
52
  output = ''
54
- tmp.write(output, 0)
53
+
54
+ # handle the REXML API change in 1.8.6.110. bah!
55
+ if RUBY_VERSION >= "1.8.6" && RUBY_PATCHLEVEL >= 110
56
+ formatter = REXML::Formatters::Pretty.new( 2 )
57
+ formatter.write( to_element , output )
58
+ else
59
+ to_element.write(output, 0)
60
+ end
55
61
  return output
56
62
  end
57
63
  end
@@ -77,7 +77,12 @@ module RBook
77
77
  def to_s
78
78
  doc = to_xml
79
79
  output = ''
80
- doc.write(output, 2)
80
+ # stupid hack, because the ruby release mangers imported a broken REXML for this patchset
81
+ if RUBY_VERSION == "1.8.6" && (RUBY_PATCHLEVEL == 110 || RUBY_PATCHLEVEL == 111)
82
+ doc.write(output,-1)
83
+ else
84
+ doc.write(output,0)
85
+ end
81
86
  return output
82
87
  end
83
88
 
@@ -199,7 +199,14 @@ module RBook
199
199
  # return an XML string representing this contributor
200
200
  def to_s
201
201
  output = ''
202
- to_element.write(output, 0)
202
+
203
+ # handle the REXML API change in 1.8.6.110. bah!
204
+ if RUBY_VERSION >= "1.8.6" && RUBY_PATCHLEVEL >= 110
205
+ formatter = REXML::Formatters::Pretty.new( 2 )
206
+ formatter.write( to_element , output )
207
+ else
208
+ to_element.write(output, 0)
209
+ end
203
210
  return output
204
211
  end
205
212
  end
@@ -40,9 +40,15 @@ module Onix
40
40
 
41
41
  # Return an XML string representing this contributor
42
42
  def to_s
43
- tmp = to_element
44
43
  output = ''
45
- tmp.write(output, 0)
44
+
45
+ # handle the REXML API change in 1.8.6.110. bah!
46
+ if RUBY_VERSION >= "1.8.6" && RUBY_PATCHLEVEL >= 110
47
+ formatter = REXML::Formatters::Pretty.new( 2 )
48
+ formatter.write( to_element , output )
49
+ else
50
+ to_element.write(output, 0)
51
+ end
46
52
  return output
47
53
  end
48
54
  end
@@ -65,9 +65,15 @@ module Onix
65
65
 
66
66
  # Return an XML string representing this contributor
67
67
  def to_s
68
- tmp = to_element
69
68
  output = ''
70
- tmp.write(output, 0)
69
+
70
+ # handle the REXML API change in 1.8.6.110. bah!
71
+ if RUBY_VERSION >= "1.8.6" && RUBY_PATCHLEVEL >= 110
72
+ formatter = REXML::Formatters::Pretty.new( 2 )
73
+ formatter.write( to_element , output )
74
+ else
75
+ to_element.write(output, 0)
76
+ end
71
77
  return output
72
78
  end
73
79
  end
@@ -55,6 +55,19 @@ context "A message object with valid data" do
55
55
  msg.to_s.should be_a_kind_of(String)
56
56
  end
57
57
 
58
+ specify "should output a valid string with no line breaks between tags and content" do
59
+ msg = RBook::Onix::Message.new
60
+ msg.from_person = "James Healy"
61
+ msg.from_company = "Healy Inc."
62
+ msg.to_person = "RSpec"
63
+
64
+ product = RBook::Onix::Product.new
65
+ product.product_identifier = '0977616606'
66
+ msg.add_product(product)
67
+
68
+ msg.to_s.include?("<ToPerson>RSpec</ToPerson>").should be_true
69
+ end
70
+
58
71
  # ensure all output is cleansed UTF-8
59
72
  specify "should output valid UTF-8, regardless of the input" do
60
73
  msg = RBook::Onix::Message.new
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rbook-onix
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
7
- date: 2007-10-19 00:00:00 +10:00
6
+ version: 0.5.2
7
+ date: 2007-10-24 00:00:00 +10:00
8
8
  summary: A library for manipulating ONIX files
9
9
  require_paths:
10
10
  - lib