ruby-ole 1.2.8.1 → 1.2.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.2.8.2 / 2009-01-01
2
+
3
+ - Update code to support ruby 1.9.1
4
+
1
5
  == 1.2.8.1 / 2008-10-22
2
6
 
3
7
  - Fix a couple of breakages when using $KCODE = 'UTF8'
data/Rakefile CHANGED
@@ -38,7 +38,7 @@ end
38
38
  Rake::RDocTask.new do |t|
39
39
  t.rdoc_dir = 'doc'
40
40
  t.rdoc_files.include 'lib/**/*.rb'
41
- t.rdoc_files.include 'README'
41
+ t.rdoc_files.include 'README', 'ChangeLog'
42
42
  t.title = "#{PKG_NAME} documentation"
43
43
  t.options += %w[--line-numbers --inline-source --tab-width 2]
44
44
  t.main = 'README'
@@ -63,7 +63,7 @@ spec = Gem::Specification.new do |s|
63
63
  s.test_files = FileList['test/test_*.rb']
64
64
 
65
65
  s.has_rdoc = true
66
- s.extra_rdoc_files = ['README']
66
+ s.extra_rdoc_files = ['README', 'ChangeLog']
67
67
  s.rdoc_options += [
68
68
  '--main', 'README',
69
69
  '--title', "#{PKG_NAME} documentation",
@@ -73,7 +73,7 @@ end
73
73
 
74
74
  Rake::GemPackageTask.new(spec) do |t|
75
75
  t.gem_spec = spec
76
- t.need_tar = false
76
+ t.need_tar = true
77
77
  t.need_zip = false
78
78
  t.package_dir = 'build'
79
79
  end
@@ -192,6 +192,8 @@ class RangesIO
192
192
  end
193
193
  data_pos
194
194
  end
195
+
196
+ alias << write
195
197
 
196
198
  # i can wrap it in a buffered io stream that
197
199
  # provides gets, and appropriately handle pos,
@@ -21,7 +21,7 @@ module Ole # :nodoc:
21
21
  class FormatError < StandardError # :nodoc:
22
22
  end
23
23
 
24
- VERSION = '1.2.8.1'
24
+ VERSION = '1.2.8.2'
25
25
 
26
26
  # options used at creation time
27
27
  attr_reader :params
@@ -60,6 +60,8 @@ module Ole # :nodoc:
60
60
  IO::Mode.new(mode).writeable?
61
61
  else
62
62
  @io.flush
63
+ # this is for the benefit of ruby-1.9
64
+ @io.syswrite('') if @io.respond_to?(:syswrite)
63
65
  true
64
66
  end
65
67
  rescue IOError
@@ -305,7 +307,7 @@ module Ole # :nodoc:
305
307
  io.binmode
306
308
  repack_using_io io
307
309
  end
308
- when :mem; StringIO.open(&method(:repack_using_io))
310
+ when :mem; StringIO.open('', &method(:repack_using_io))
309
311
  else raise ArgumentError, "unknown temp backing #{temp.inspect}"
310
312
  end
311
313
  end
@@ -46,7 +46,11 @@ module Ole # :nodoc:
46
46
 
47
47
  def self.dump str
48
48
  # need to append nulls?
49
- TO_UTF16.iconv str
49
+ data = TO_UTF16.iconv str
50
+ # not sure if this is the recommended way to do it, but I want to treat
51
+ # the resulting utf16 data as regular bytes, not characters.
52
+ data.force_encoding Encoding::US_ASCII if data.respond_to? :encoding
53
+ data
50
54
  end
51
55
  end
52
56
 
@@ -8,19 +8,7 @@ require 'digest/sha1'
8
8
  require 'stringio'
9
9
  require 'tempfile'
10
10
  require 'zlib'
11
-
12
- begin
13
- require 'base64'
14
- rescue LoadError
15
- # for 1.9 compatability - for now. not sure what
16
- # advised migration is
17
- module Base64
18
- module_function
19
- def decode64(str)
20
- str.unpack("m")[0]
21
- end
22
- end
23
- end
11
+ require 'base64'
24
12
 
25
13
  #
26
14
  # = TODO
@@ -60,26 +48,20 @@ class TestStorageRead < Test::Unit::TestCase
60
48
  @warn = []
61
49
  outer_warn = @warn
62
50
  old_log = Ole::Log
51
+ old_verbose = $VERBOSE
63
52
  begin
64
- old_verbose = $VERBOSE
65
- begin
66
- $VERBOSE = nil
67
- Ole.const_set :Log, Object.new
68
- ensure
69
- $VERBOSE = old_verbose
70
- end
53
+ $VERBOSE = nil
54
+ Ole.const_set :Log, Object.new
55
+ # restore for the yield
56
+ $VERBOSE = old_verbose
71
57
  (class << Ole::Log; self; end).send :define_method, :warn do |message|
72
58
  outer_warn << message
73
59
  end
74
60
  yield
75
61
  ensure
76
- old_verbose = $VERBOSE
77
- begin
78
- $VERBOSE = nil
79
- Ole.const_set :Log, Object.new
80
- ensure
81
- $VERBOSE = old_verbose
82
- end
62
+ $VERBOSE = nil
63
+ Ole.const_set :Log, old_log
64
+ $VERBOSE = old_verbose
83
65
  end
84
66
  end
85
67
 
@@ -124,8 +106,8 @@ class TestStorageRead < Test::Unit::TestCase
124
106
  end
125
107
 
126
108
  def test_read
127
- # this data should probably be put elsewhere. not asserting
128
- # using hashes anymore, cause they were different on the mac.
109
+ # the regular String#hash was different on the mac, so asserting
110
+ # against full strings. switch this to sha1 instead of this fugly blob
129
111
  data = <<-end
130
112
  eJxjZGBgYkADAABKAAQ=
131
113
 
@@ -248,7 +230,7 @@ class TestStorageWrite < Test::Unit::TestCase
248
230
  end
249
231
 
250
232
  def test_create_from_scratch_hash
251
- io = StringIO.new
233
+ io = StringIO.new('')
252
234
  Ole::Storage.open(io) { }
253
235
  assert_equal '6bb9d6c1cdf1656375e30991948d70c5fff63d57', sha1(io.string)
254
236
  # more repack test, note invariance
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8.1
4
+ version: 1.2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Lowe
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-22 00:00:00 +11:00
12
+ date: 2009-01-01 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -21,6 +21,7 @@ extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
23
  - README
24
+ - ChangeLog
24
25
  files:
25
26
  - README
26
27
  - Rakefile