poi2csv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f419a351e1981e983019c5d6c94be41e8aa77d7
4
- data.tar.gz: d469b9326fae229ffd4d460f5b9eff199e2455d7
3
+ metadata.gz: 3ebec8107ea1c700652cf0ad34f2a79559eff813
4
+ data.tar.gz: 1c1849e8fe0939a46fe534fa55952bbd9983a2df
5
5
  SHA512:
6
- metadata.gz: c8ee1be9dce6a77176aab26eae45577a93378fe6cb80b00ecb1fec2de915969dba906c0c267a8628350d52f59141b405d11babcb482a775c7c9a02feac86971b
7
- data.tar.gz: adcd33315bd73bca8543afcb523c3547b206a914412847e18912e4ee1581a5cb98c094092924a7cbb6b1f6efb360b602fd4dab09b86397aa931998185bcfaf2c
6
+ metadata.gz: 144bd751b9e12f3412ca49408cc6a9fdd83539f726694de8e5cc2c038225f784aed321d3c43c1aa70cc35bf3a5fd57514412c4d1d2ebf78e16a95ba8be76c6d0
7
+ data.tar.gz: a08b5bccd32699b4914de68d7e731fff64cb1ca032cf41f0dc3ff74e642d1dddd6fdf0a51d9d40df94a3b7cc4367f8d0c7df328c15f026984128023343a81b5a
data/classes/ToCSV.class CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  module Poi2csv
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/poi2csv.rb CHANGED
@@ -1,9 +1,12 @@
1
+ require 'shellwords'
1
2
  require "poi2csv/version"
2
3
 
3
4
  module Poi2csv
4
5
 
5
6
  def self.to_csv(input_file_path, output_folder_path, separator=nil, formating_convention=nil)
6
- `java -cp #{classpath} ToCSV #{input_file_path} #{output_folder_path} #{separator} #{formating_convention}`
7
+ args = [input_file_path, output_folder_path, separator, formating_convention].reject { |v| v.nil? }
8
+ args = args.map { |v| Shellwords.escape(v) }
9
+ `java -cp #{classpath} ToCSV #{args * ' '}`
7
10
  end
8
11
 
9
12
  def self.classpath
data/src/ToCSV.java CHANGED
@@ -26,11 +26,12 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
26
26
 
27
27
  import java.io.File;
28
28
  import java.io.FileInputStream;
29
- import java.io.FileWriter;
30
29
  import java.io.BufferedWriter;
31
30
  import java.io.FilenameFilter;
31
+ import java.io.FileOutputStream;
32
32
  import java.io.IOException;
33
33
  import java.io.FileNotFoundException;
34
+ import java.io.OutputStreamWriter;
34
35
  import java.util.ArrayList;
35
36
 
36
37
  /**
@@ -445,7 +446,7 @@ public class ToCSV {
445
446
  */
446
447
  private void saveCSVFile(File file)
447
448
  throws FileNotFoundException, IOException {
448
- FileWriter fw = null;
449
+ OutputStreamWriter fw = null;
449
450
  BufferedWriter bw = null;
450
451
  ArrayList<String> line = null;
451
452
  StringBuffer buffer = null;
@@ -455,7 +456,7 @@ public class ToCSV {
455
456
  System.out.println("Saving the CSV file [" + file.getName() + "]");
456
457
 
457
458
  // Open a writer onto the CSV file.
458
- fw = new FileWriter(file);
459
+ fw = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
459
460
  bw = new BufferedWriter(fw);
460
461
 
461
462
  // Step through the elements of the ArrayList that was used to hold
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poi2csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Douglas English
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-25 00:00:00.000000000 Z
11
+ date: 2013-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler