poi2csv 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/poi2csv/version.rb +1 -1
  3. data/lib/poi2csv.rb +16 -3
  4. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd7618a5e1863eacbbe2f742891714c66908f821
4
- data.tar.gz: d2aa51d17653f4bf899923cc4f04359b6e5a88d9
3
+ metadata.gz: d6f79b232feeb0143b8471471e7b1b9b8ef46575
4
+ data.tar.gz: 11ed17db8006366b25b302252e4fd0438ae03895
5
5
  SHA512:
6
- metadata.gz: e70230e2d7b38f0ad0467d3b55eee8b29de2ef99eadc3cc30c140e1242c4d7dd634c9e90899cd484448b466c149027f17cf25abfbd1a601e9ca19d7b6b628b7f
7
- data.tar.gz: 3fcbcb2444114480a599d0c94c22fed879f28f857756afd20237cb23b48438fb1cd1bb595922d04696092c407efd8253991e1dcb901a893b8112359d36b5abe0
6
+ metadata.gz: a894ac3e3a44672f2fdbdde7fb36e9705958e0ac08ebe1ed06a7b8bf3e649727a138051f56cd951a112a69b925bec615bafe8ea132930cedae9fa6748a465851
7
+ data.tar.gz: a87fc3bdd9cf0b4fda2a1dbe5f16cf4def6774be714a3462012389cc44768a4a0e4abb0d41d1fe997fbede2de71ca3213646f763e88ab1030c009775b963aa44
@@ -1,3 +1,3 @@
1
1
  module Poi2csv
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/poi2csv.rb CHANGED
@@ -3,13 +3,26 @@ require "poi2csv/version"
3
3
 
4
4
  module Poi2csv
5
5
 
6
- def self.to_csv(input_file_path, output_folder_path, separator=nil, formating_convention=nil)
6
+ Poi2csvException = Class.new(StandardError)
7
+ SUPPORTED_EXTENSIONS = [:xls, :xlsx]
8
+
9
+ def self.to_csv(input_file_path, output_folder_path, separator=nil, formating_convention=nil)
7
10
  args = [input_file_path, output_folder_path, separator, formating_convention].reject { |v| v.nil? }
8
11
  args = args.map { |v| Shellwords.escape(v) }
9
- `java -cp #{classpath} ToCSV #{args * ' '}`
12
+ console_message = `java -cp #{classpath} ToCSV #{args * ' '}`
13
+ raise Poi2csvException.new, console_message unless output_file_created?(input_file_path, output_folder_path)
14
+ end
15
+
16
+ def supports_extension?(extension)
17
+ SUPPORTED_EXTENSIONS.include?(extension)
10
18
  end
11
19
 
12
20
  def self.classpath
13
- @_classpath ||= File.expand_path(File.join(File.dirname(__FILE__),'*')) + File::PATH_SEPARATOR + File.expand_path(File.join(File.dirname(__FILE__),'..', 'classes'))
21
+ @_classpath ||= File.expand_path(File.join(File.dirname(__FILE__),'*')) + File::PATH_SEPARATOR + File.expand_path(File.join(File.dirname(__FILE__),'..', 'classes'))
22
+ end
23
+
24
+ def self.output_file_created?(input_file_path, output_folder_path)
25
+ output_file = File.join(output_folder_path , File.basename(input_file_path, '.*')) + '.csv'
26
+ File.exists?(output_file)
14
27
  end
15
28
  end
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poi2csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-10-16 00:00:00.000000000 Z
11
+ date: 2014-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: Converts Excel .xls and .xlsx files to CSV.
@@ -45,8 +45,8 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .DS_Store
49
- - .gitignore
48
+ - ".DS_Store"
49
+ - ".gitignore"
50
50
  - Gemfile
51
51
  - LICENSE.txt
52
52
  - README.md
@@ -83,17 +83,17 @@ require_paths:
83
83
  - lib
84
84
  required_ruby_version: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - '>='
91
+ - - ">="
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.0.10
96
+ rubygems_version: 2.2.2
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: This GEM provides a wrapper to the http://poi.apache.org/ library for converting