csv_to_sqlite3 0.1.3.1 → 0.1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/csv_to_sqlite.rb +17 -1
- data/lib/csv_to_sqlite/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 709acaceea756a2fab95c45bc156de01f41050fa6ec82461659a2779728e50f4
|
4
|
+
data.tar.gz: 16d5d03ec204d8f1f4fc2fe51a629be1333f60cc788187ac01c966de674c8b52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f69c8c7f24386a62b21cc6c21a775b335b86312cb81bb8ddb58bf171036a87f5e08799b2a7e42c6043ba50dd836edae20e96c278a501ce7c072d0ba9ff78e8f5
|
7
|
+
data.tar.gz: 07053a0b2a2d559ea7cf2e276c2372b3517557e1174b13d6f2ad17c09aa86f7bf18f090021db3b1647e6442a1b5730eabc5b82fc8ad77421359b1428af95d6bc
|
data/Gemfile.lock
CHANGED
data/lib/csv_to_sqlite.rb
CHANGED
@@ -22,11 +22,27 @@ module CsvToSqlite
|
|
22
22
|
def convert file_path
|
23
23
|
connection = CsvToSqlite::Database.new().connect
|
24
24
|
csv_table = CsvToSqlite::CsvReader.new(file_path).load_file
|
25
|
-
table_name = file_path.split("/").last.split(".csv").first
|
26
25
|
CsvToSqlite::SQL::CreateTable.new(name: table_name, csv_table: csv_table, connection: connection).run
|
27
26
|
CsvToSqlite::SQL::Insert.new(name: table_name, csv_table: csv_table, connection: connection).run
|
28
27
|
end
|
29
28
|
|
29
|
+
def table_name
|
30
|
+
if @args.include? "-t"
|
31
|
+
table_name_index = @args.find_index "-t"
|
32
|
+
return @args[table_name_index + 1]
|
33
|
+
else
|
34
|
+
return csv_file_name.split("/").last.split(".csv").first
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def csv_file_name
|
39
|
+
file_name = nil
|
40
|
+
@args.each_with_index do |param, index|
|
41
|
+
file_name = param if param.include? ".csv"
|
42
|
+
end
|
43
|
+
file_name
|
44
|
+
end
|
45
|
+
|
30
46
|
end
|
31
47
|
|
32
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csv_to_sqlite3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.3.
|
4
|
+
version: 0.1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joaofelipelopes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Add the executable "csv_to_sqlite" to your terminal, wich is used to
|
14
14
|
create a SQLite3 database with all data from a csv file by running "csv_to_sqlite
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
66
|
+
rubygems_version: 3.0.3
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: An easy way to convert a csv file into SQLite3 database.
|