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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5f1dee4684b766e69ff16db70c84628b2eccf0f69e69b2f1584472cf46bcdf1
4
- data.tar.gz: 3963bfc8ca100d2a1c4d57f0c5bfbf387708486c8f44f18af43c2e1353a7349d
3
+ metadata.gz: 709acaceea756a2fab95c45bc156de01f41050fa6ec82461659a2779728e50f4
4
+ data.tar.gz: 16d5d03ec204d8f1f4fc2fe51a629be1333f60cc788187ac01c966de674c8b52
5
5
  SHA512:
6
- metadata.gz: c9d0d144cde3c4aafa2e90a719cbe98d5c5b8ed3c25de09a0dc3582492bcf949e222c6c7da9d10890996a44d4d00242e5e9795795e75354365ce7ae7d4bfed0a
7
- data.tar.gz: e29b9122c799b60d1ef6041714f6a67fba28c635f8dd37e3ee061f3d58b883af227e6c872f4188dccc4fb94e7e72e7434372bb90dfe10fe425ca101d34b75dd3
6
+ metadata.gz: f69c8c7f24386a62b21cc6c21a775b335b86312cb81bb8ddb58bf171036a87f5e08799b2a7e42c6043ba50dd836edae20e96c278a501ce7c072d0ba9ff78e8f5
7
+ data.tar.gz: 07053a0b2a2d559ea7cf2e276c2372b3517557e1174b13d6f2ad17c09aa86f7bf18f090021db3b1647e6442a1b5730eabc5b82fc8ad77421359b1428af95d6bc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- csv_to_sqlite3 (0.1.3.1)
4
+ csv_to_sqlite3 (0.1.3.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -1,3 +1,3 @@
1
1
  module CsvToSqlite
2
- VERSION = "0.1.3.1"
2
+ VERSION = "0.1.3.2"
3
3
  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.1
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-24 00:00:00.000000000 Z
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.1.2
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.