action_csv 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.irb_history +3 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +1 -20
- data/lib/action_csv.rb +13 -1
- data/lib/action_csv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d83f30c7aabfd75ad257cec3e7aa8a3b7da401f107ca301f6474bf67b337eadc
|
4
|
+
data.tar.gz: 766e7ab59248529e7eb0bd8e53af638279aa6f3f73e02f1e32ed597bf5cef811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 872b8479b79060221aa8b4d7788e6998ebe117add6448da1f97fc120b25f2403cafc275be98599878d6e8274dcc18e4ea412f6650d4aa11b266af29d0e1961dc
|
7
|
+
data.tar.gz: 51e453632ff25d51c9bbb50ac1c7007a58a5855b4b74d764c71908debe263c3da3570498e66f326841706b095dc4db40fb5f71fa8a5c896a0efd9dd30b053c11
|
data/.irb_history
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,28 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
action_csv (0.1.
|
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
|
-
|
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
|
data/lib/action_csv/version.rb
CHANGED