csv-import-analyzer 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/lib/csv-import-analyzer/analyzer/delimiter_identifier.rb +0 -1
- data/lib/csv-import-analyzer/analyzer/file_type_assertion.rb +0 -1
- data/lib/csv-import-analyzer/csv_datatype_analysis.rb +0 -1
- data/lib/csv-import-analyzer/csv_sanitizer.rb +1 -1
- data/lib/csv-import-analyzer/export/metadata_analysis.rb +2 -3
- data/lib/csv-import-analyzer/version.rb +1 -1
- data/samples/27_sweep_net_arthropods_1.csv +2902 -0
- data/samples/584_ccs_survey_data_2010.csv +150 -0
- data/samples/591_fluxtower_data_corrected_2012.csv +18314 -0
- data/samples/5_photos_1.csv +448 -0
- data/samples/80_water_chemistry_1.csv +305 -0
- data/samples/86_dbg_irrigation_rates_1.csv +8 -0
- data/samples/AllstarFull.csv +4835 -0
- data/samples/LDP_TenMin.dat +58448 -0
- data/samples/sampleTab.csv +5 -0
- data/samples/sampleTab.tsv +5 -0
- data/spec/csv-import-analyzer/analyzer/delimiter_identifier_spec.rb +3 -2
- data/spec/csv-import-analyzer/csv_sanitizer_spec.rb +0 -1
- data/spec/fixtures/sample.csv +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
@@ -0,0 +1,5 @@
|
|
1
|
+
Year ID,Make ID,Model ID,Description ID,Price ID
|
2
|
+
1997,Ford,E350,"ac, abs, moon","3000.00"
|
3
|
+
1999,Chevy,"Venture ""Extended Edition""",,4900.00
|
4
|
+
1999,"Chevy","Venture ""Extended Edition, Very Large""","",5000.00
|
5
|
+
1996,Jeep,Grand Che'rokee,"MUST SELL!air, moon roof, loaded",4799.00
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Year ID Make ID Model ID Description ID Price ID
|
2
|
+
1997 Ford E350 'ac, abs, moon' "3000.00"
|
3
|
+
1999 Chevy "Venture ""Extended Edition""" "" 4900.00
|
4
|
+
1999 'Chevy' "Venture ""Extended Edition, Very Large""" 5000.00
|
5
|
+
1996 Jeep Grand Che'rokee "MUST SELL!air, moon roof, loaded" 4799.00
|
@@ -42,6 +42,7 @@ describe "#identify_delimiter" do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
# Testing private method, although we don't really have to
|
45
46
|
describe "#return_plausible_delimiter" do
|
46
47
|
before(:each) do
|
47
48
|
@dummy_class = DummyClass.new
|
@@ -50,12 +51,12 @@ describe "#return_plausible_delimiter" do
|
|
50
51
|
|
51
52
|
context "identifies delimiter" do
|
52
53
|
it "returns comma as the delimiter by default" do
|
53
|
-
expect(@dummy_class.return_plausible_delimiter).to eq(",")
|
54
|
+
expect(@dummy_class.send(:return_plausible_delimiter)).to eq(",")
|
54
55
|
end
|
55
56
|
|
56
57
|
it "returns semicolon as the delimiter for sample delimiter_count" do
|
57
58
|
@dummy_class.stub(:delimiter_count).and_return(Hash[","=>15, ";"=>16, "\t"=>0, "|"=>0])
|
58
|
-
expect(@dummy_class.return_plausible_delimiter).to eq(";")
|
59
|
+
expect(@dummy_class.send(:return_plausible_delimiter)).to eq(";")
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
@@ -14,7 +14,6 @@ describe CsvImportAnalyzer::CsvSanitizer do
|
|
14
14
|
let (:test) {"\"t1\", 't2', \"t3\""}
|
15
15
|
let (:res) {"\"t1\", \"t2\", \"t3\""}
|
16
16
|
xit "replaces single quotes to double quotes" do
|
17
|
-
binding.pry
|
18
17
|
expect(csv_sanitizer.send(:replace_line_single_quotes, test, ",")).to eq(res)
|
19
18
|
end
|
20
19
|
let (:test) {["t1","t2","",nil,"t3"]}
|
data/spec/fixtures/sample.csv
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Year ID,Make ID,Model ID,Description ID,Price ID
|
2
|
-
1997,Ford,,"ac, abs, moon","3000
|
3
|
-
1999,Chevy,"Venture ""Extended Edition""",",4900.00
|
2
|
+
1997,Ford,,"ac, abs, moon","3000"
|
3
|
+
1999,Chevy,"Venture ""Extended Edition""","",4900.00
|
4
4
|
1999,'Chevy',"Venture ""Extended Edition, Very Large""",,5000.00
|
5
5
|
1996,Jeep,Grand Che'rokee,"MUST SELL!air, moon roof, loaded",4799.00
|
data/spec/spec_helper.rb
CHANGED
@@ -2,7 +2,7 @@ require 'simplecov'
|
|
2
2
|
# Must be ahead of requiring core library to start the code coverage.
|
3
3
|
SimpleCov.start
|
4
4
|
require 'csv-import-analyzer'
|
5
|
-
|
5
|
+
# $:<< File.join(File.dirname(__FILE__), '..')
|
6
6
|
# Path to sample files in the fixtures folder that are made available to all specs for testing
|
7
7
|
$sample_csv_path = "/home/avinash/Desktop/csv-import-analyzer/spec/fixtures/sample.csv"
|
8
8
|
$sample_ssv_path = "/home/avinash/Desktop/csv-import-analyzer/spec/fixtures/semicolon-sample.csv"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv-import-analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avinash Vallabhaneni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|