remote_table 3.0.0.rc1 → 3.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,19 @@
1
+ 3.0.0.rc2 / 2013-08-30
2
+
3
+ * Breaking changes
4
+
5
+ * skip blank lines at the top of CSV files when looking for headers
6
+ * require rubyzip2 for Roo compatibility with Ruby 1.9
7
+
8
+ * Enhancements
9
+
10
+ * eagerly load format-specific methods (instead of waiting for #each to be called)
11
+ * use new Roo class names (Roo::OpenOffice instead of Roo::Openoffice)
12
+
13
+ * Bug fixes
14
+
15
+ * pass CSV options to header parser - before, options like delimiter weren't passed so it couldn't read TSVs
16
+
1
17
  3.0.0.rc1 / 2013-08-08
2
18
 
3
19
  * Breaking changes
data/lib/remote_table.rb CHANGED
@@ -444,6 +444,7 @@ class RemoteTable
444
444
  @other_options = settings
445
445
 
446
446
  @local_copy = LocalCopy.new self
447
+ extend!
447
448
  end
448
449
 
449
450
  # Yield each row.
@@ -452,7 +453,6 @@ class RemoteTable
452
453
  #
453
454
  # @yield [Hash,Array] A hash or an array depending on whether the RemoteTable has named headers (column names).
454
455
  def each
455
- extend!
456
456
  if fully_cached?
457
457
  cache.each do |row|
458
458
  yield row
@@ -23,7 +23,7 @@ class RemoteTable
23
23
 
24
24
  # Yield each row using Ruby's CSV parser (FasterCSV on Ruby 1.8).
25
25
  def _each
26
- Engine.new(local_copy.encoded_io, csv_options).each do |row|
26
+ Engine.new(local_copy.encoded_io, csv_options.merge(headers: headers)).each do |row|
27
27
 
28
28
  some_value_present = false
29
29
 
@@ -65,7 +65,6 @@ class RemoteTable
65
65
  def csv_options
66
66
  {
67
67
  skip_blanks: !keep_blank_rows,
68
- headers: headers,
69
68
  col_sep: delimiter,
70
69
  quote_char: quote_char,
71
70
  }
@@ -78,10 +77,17 @@ class RemoteTable
78
77
  false
79
78
  when :first_row, TrueClass
80
79
  i = 0
81
- line = local_copy.encoded_io.gets
82
- Engine.parse_line(line).map do |v|
83
- header = RemoteTable.normalize_whitespace v
84
- header.present? ? header : "empty_#{i+=1}"
80
+ begin
81
+ line = local_copy.encoded_io.gets.strip
82
+ end while line.length == 0
83
+ proto_headers = Engine.parse_line(line, csv_options)
84
+ if proto_headers
85
+ proto_headers.map do |v|
86
+ header = RemoteTable.normalize_whitespace v
87
+ header.present? ? header : "empty_#{i+=1}"
88
+ end
89
+ else
90
+ raise "No headers found in first line: #{line.inspect}"
85
91
  end
86
92
  when Array
87
93
  @headers
@@ -11,7 +11,14 @@ class RemoteTable
11
11
  if ::RUBY_PLATFORM == 'java'
12
12
  ::Kernel.warn "[remote_table] Opening ODS files on JRuby is known to fail because of a flaw in the underlying Roo library"
13
13
  end
14
- Roo.const_defined?(:Openoffice) ? Roo::Openoffice : ::Openoffice
14
+ [:Openoffice, :OpenOffice]
15
+ if ::Roo.const_defined?(:OpenOffice)
16
+ ::Roo::OpenOffice
17
+ elsif ::Roo.const_defined?(:Openoffice)
18
+ ::Roo::Openoffice
19
+ else
20
+ raise "Couldn't find roo's OpenOffice class, maybe you need a newer version?"
21
+ end
15
22
  end
16
23
  end
17
24
  end
@@ -1,3 +1,3 @@
1
1
  class RemoteTable
2
- VERSION = '3.0.0.rc1'
2
+ VERSION = '3.0.0.rc2'
3
3
  end
data/remote_table.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency 'unix_utils', '>=0.0.8'
25
25
  s.add_runtime_dependency 'fastercsv', '>=1.5.0'
26
26
  s.add_runtime_dependency 'hash_digest'
27
+ s.add_runtime_dependency 'rubyzip2'
27
28
 
28
29
  s.add_development_dependency 'errata', '>=0.2.0'
29
30
  s.add_development_dependency 'minitest'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 3.0.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-08 00:00:00.000000000 Z
13
+ date: 2013-08-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -124,6 +124,22 @@ dependencies:
124
124
  - - ! '>='
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: rubyzip2
129
+ requirement: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ type: :runtime
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
127
143
  - !ruby/object:Gem::Dependency
128
144
  name: errata
129
145
  requirement: !ruby/object:Gem::Requirement