sepparator 0.0.2 → 0.0.3

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: 0ccf7dde4f64b081fb5014eb763d95e112c79233
4
- data.tar.gz: 4160d2d8940adcbb79112fcb672c65eeb1d14fee
3
+ metadata.gz: d93fccb627ad3d66c6e00d20d3a2bc668f64b29e
4
+ data.tar.gz: ebd2433753ad5c13ca230b460df759149bc4bdda
5
5
  SHA512:
6
- metadata.gz: 7dd59a02e1a3c6e27702c9bbf3f4e6f642859826f5826fc8867bcc0b24a4c79d6bc4ac976e3c55f1f3eb4ef53f8fb6aa4503e4a2d3f391cca1124cbf6dde3a69
7
- data.tar.gz: 4175441d828bfb3a7a7cd9a78285ecdbea7845d34a71e77432c92f18ae350852c1cd98c3463747ad8299badc19590a81aec1e4c18fbbb9cc7a063dafb9618a95
6
+ metadata.gz: 02651843254b0342c6ac479a5dcec397fe03a654137401905fe60d9000e243be2b74f66f97300e3dee06777e263061d8c504466d5d59ee40081e5131ace0b3d8
7
+ data.tar.gz: 0fd1b75bbec543a4e52855f5a58de97c3d1c23d823cee5abeec71881176d8eadc86903703a8eb09a3cb7c396fa92c0a9972bf2c0ef48c0b2a520ed9bb0671bb8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sepparator (0.0.2)
4
+ sepparator (0.0.3)
5
5
  simple_xlsx_writer
6
6
  thor
7
7
 
data/README.md CHANGED
@@ -1,2 +1,38 @@
1
- sepparator
2
- ==========
1
+ sepparator - separating value from commata
2
+ ===========================================
3
+
4
+ Simple CSV pocket-knife-tool.
5
+
6
+ Features:
7
+ ---------
8
+ * convert CSV to Excel format and detect datatypes
9
+ * (not yet implemented:) Detect CSV schema, create database table and load the file automatically
10
+
11
+ Tries to detect appropriate datatypes and therefore you might get rid of the CSV-like question "what's decimal separator?".
12
+
13
+
14
+ ```
15
+ Usage:
16
+ sepp convert CSV XLS
17
+
18
+ Options:
19
+ -s, [--col-sep=\t] # CSV column separator, defaults to tab-separated values
20
+ -f, [--force] # overwrite existing files
21
+
22
+ Description:
23
+ `sepp convert` converts a CSV file to a xlsx file.
24
+
25
+ Parameters:
26
+
27
+ CSV - path to a CSV file (required)
28
+
29
+ XLS - destination path for excel file (optional)
30
+ Use --force to overwrite existing files.
31
+ If XLS is ommited, sepp will create the excel file alongside the csv using the .xlsx extension.
32
+
33
+ Options:
34
+
35
+ --col_sep - CSV column separation character(s)
36
+
37
+ --force - overwrite destination files if necessary
38
+ ```
@@ -7,4 +7,9 @@ module Sepparator
7
7
  Console.start(args)
8
8
  end
9
9
 
10
+ def csv_to_excel(csv_path, excel_path, col_sep: ';', sheet_name: 'from CSV')
11
+ converter = SpreadsheetConverter.new(col_sep: col_sep)
12
+ converter.convert(csv_path, excel_path, sheet_name: sheet_name)
13
+ end
14
+
10
15
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "sepparator"
7
- spec.version = '0.0.2'
7
+ spec.version = '0.0.3'
8
8
  spec.authors = ["Andreas Brandl"]
9
9
  spec.email = ["github@andreas-brandl.de"]
10
10
  spec.description = %q{tool for working with CSV files, it supports conversion to Excel files and import to databases.}
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sepparator do
4
+
5
+ context '.csv_to_excel' do
6
+ it 'creates a converter and uses it appropriately' do
7
+ col_sep = ','
8
+ csv_path = 'foo/bar.csv'
9
+ xls_path = 'bla/fu.xls'
10
+ sheet_name = 'my sheet'
11
+ converter = stub
12
+ Sepparator::SpreadsheetConverter.should_receive(:new).with(col_sep: col_sep).and_return(converter)
13
+ converter.should_receive(:convert).with(csv_path, xls_path, sheet_name: sheet_name)
14
+
15
+ Sepparator.csv_to_excel(csv_path, xls_path, sheet_name: sheet_name, col_sep: col_sep)
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sepparator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Brandl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-15 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_xlsx_writer
@@ -148,6 +148,7 @@ files:
148
148
  - spec/sepparator/example.csv
149
149
  - spec/sepparator/spreadsheet_converter.rb
150
150
  - spec/sepparator/spreadsheet_converter_spec.rb
151
+ - spec/sepparator_spec.rb
151
152
  - spec/spec_helper.rb
152
153
  homepage: https://github.com/afirel/sepparator
153
154
  licenses:
@@ -178,4 +179,5 @@ test_files:
178
179
  - spec/sepparator/example.csv
179
180
  - spec/sepparator/spreadsheet_converter.rb
180
181
  - spec/sepparator/spreadsheet_converter_spec.rb
182
+ - spec/sepparator_spec.rb
181
183
  - spec/spec_helper.rb