action_csv 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8030f01b05744157fc78a295401bdada61df1e53eaf2655a83c251bcb70a6534
4
- data.tar.gz: 3591a84c072103d466237a53c81661e5910dce0859a10830ea6e455dcbceafbd
3
+ metadata.gz: d83f30c7aabfd75ad257cec3e7aa8a3b7da401f107ca301f6474bf67b337eadc
4
+ data.tar.gz: 766e7ab59248529e7eb0bd8e53af638279aa6f3f73e02f1e32ed597bf5cef811
5
5
  SHA512:
6
- metadata.gz: bf9023730b25b1ead96751df62e0b9646d957020fce5489efdd213ba182d170fabf4e773b119f9dec7d6dc489f6564b14e7a7b3a27c1ec68cf39dceb5d7f0d08
7
- data.tar.gz: 91e013d338773d87753d276becf171b8fafc4594d34d2b628fbb0b515bb0f79e73749a53d2631d2fe0622c35a15fbe15c436f63e85b8ee21c0e75be2f04e33ed
6
+ metadata.gz: 872b8479b79060221aa8b4d7788e6998ebe117add6448da1f97fc120b25f2403cafc275be98599878d6e8274dcc18e4ea412f6650d4aa11b266af29d0e1961dc
7
+ data.tar.gz: 51e453632ff25d51c9bbb50ac1c7007a58a5855b4b74d764c71908debe263c3da3570498e66f326841706b095dc4db40fb5f71fa8a5c896a0efd9dd30b053c11
data/.irb_history CHANGED
@@ -0,0 +1,3 @@
1
+ FileUtiles
2
+ FileUtils
3
+ Dir.exist? "./db"
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in action_csv.gemspec
6
6
  gemspec
7
7
 
8
- gem "activerecord", "6.1.3.1"
9
8
  gem "rake", "13.0.3"
10
9
  gem "rspec", "3.10.0"
11
10
  gem "rubocop", "1.12.1"
data/Gemfile.lock CHANGED
@@ -1,28 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- action_csv (0.1.0)
4
+ action_csv (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- activemodel (6.1.3.1)
10
- activesupport (= 6.1.3.1)
11
- activerecord (6.1.3.1)
12
- activemodel (= 6.1.3.1)
13
- activesupport (= 6.1.3.1)
14
- activesupport (6.1.3.1)
15
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
- i18n (>= 1.6, < 2)
17
- minitest (>= 5.1)
18
- tzinfo (~> 2.0)
19
- zeitwerk (~> 2.3)
20
9
  ast (2.4.2)
21
- concurrent-ruby (1.1.8)
22
10
  diff-lcs (1.4.4)
23
- i18n (1.8.10)
24
- concurrent-ruby (~> 1.0)
25
- minitest (5.14.4)
26
11
  parallel (1.20.1)
27
12
  parser (3.0.1.0)
28
13
  ast (~> 2.4.1)
@@ -55,17 +40,13 @@ GEM
55
40
  rubocop-ast (1.4.1)
56
41
  parser (>= 2.7.1.5)
57
42
  ruby-progressbar (1.11.0)
58
- tzinfo (2.0.4)
59
- concurrent-ruby (~> 1.0)
60
43
  unicode-display_width (2.0.0)
61
- zeitwerk (2.4.2)
62
44
 
63
45
  PLATFORMS
64
46
  x86_64-linux
65
47
 
66
48
  DEPENDENCIES
67
49
  action_csv!
68
- activerecord (= 6.1.3.1)
69
50
  rake (= 13.0.3)
70
51
  rspec (= 3.10.0)
71
52
  rubocop (= 1.12.1)
data/lib/action_csv.rb CHANGED
@@ -9,7 +9,7 @@ module ActionCsv
9
9
  def self.export_csv model_name
10
10
  singularized_name = model_name.singularize.underscore
11
11
  file_dir = "./db/csv"
12
- FileUtiles.mkdir_p file_dir unless Dir.exist? file_dir
12
+ FileUtils.mkdir_p file_dir unless Dir.exist? file_dir
13
13
  file_path = ENV["RACK_ENV"] == "production" ? "#{file_dir}#{model_name.pluralize.underscore}_production.csv" : "#{file_dir}#{model_name.pluralize.underscore}.csv"
14
14
  CSV.open(file_path, "w") do |csv|
15
15
  if COLUMNS[singularized_name].present?
@@ -27,4 +27,16 @@ module ActionCsv
27
27
  rescue StandardError => error
28
28
  error.backtrace
29
29
  end
30
+
31
+ def self.get_tables
32
+ path = "./db/schema.rb"
33
+ tables = []
34
+ File.open(path, "r") do |f|
35
+ f.each_line.with_index do |line, i|
36
+ tables << line.split("\"")[1] if line.include?("create_table")
37
+ end
38
+ end
39
+ puts tables
40
+ tables
41
+ end
30
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionCsv
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - POPPIN-FUMI