crop-duster 0.0.11 → 0.0.12
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/lib/crop_duster/importer.rb +7 -4
- data/lib/crop_duster/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec065087078cb2ec65e5aeb9907ef1984fb1d7ae
|
4
|
+
data.tar.gz: 544a4f044b27bd6e43371cc320cacf571cbbb1e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e031da7623557bcf5cdad96fad0d34cfb8a2016b40ba6d505dcab3766d1317d9652b2b36ce5bb125b4c99582c2d0a22ae4810dc7185e7ecf5693e364191d563d
|
7
|
+
data.tar.gz: b397508fb1ac8599cc366b8ba449b93ae88d5bd84928690ecc33b1c3511c92cab6934ac69cadf700d67f16b2a35966240354b5c991758129bf8e1606cd6ad284
|
data/lib/crop_duster/importer.rb
CHANGED
@@ -45,7 +45,11 @@ module CropDuster
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def import_billing(import_id = SecureRandom.hex)
|
48
|
-
ActiveRecord::Base.
|
48
|
+
ar_conn = ActiveRecord::Base.connection_pool.checkout
|
49
|
+
conn = ar_conn.raw_connection
|
50
|
+
|
51
|
+
conn.exec("TRUNCATE aws_billing_imports")
|
52
|
+
|
49
53
|
s = Fog::Storage.new CropDuster.aws_keys
|
50
54
|
path = "#{CropDuster.tmp_dir}/#{import_id}"
|
51
55
|
Dir.mkdir path
|
@@ -60,8 +64,6 @@ module CropDuster
|
|
60
64
|
next if file =~ /^\./
|
61
65
|
headers = nil
|
62
66
|
|
63
|
-
ar_conn = ActiveRecord::Base.connection_pool.checkout
|
64
|
-
conn = ar_conn.raw_connection
|
65
67
|
conn.copy_data "COPY aws_billing_imports FROM STDIN CSV" do
|
66
68
|
File.new(File.join(path, file)).each_line do |line|
|
67
69
|
if headers.nil?
|
@@ -71,9 +73,10 @@ module CropDuster
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
end
|
74
|
-
ActiveRecord::Base.connection_pool.checkin(ar_conn)
|
75
76
|
end
|
76
77
|
|
78
|
+
ActiveRecord::Base.connection_pool.checkin(ar_conn)
|
79
|
+
|
77
80
|
`rm #{path}/*.csv`
|
78
81
|
end
|
79
82
|
end
|
data/lib/crop_duster/version.rb
CHANGED