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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d305d8ea487f314cd5e1be6d0fb615fbe4eb3905
4
- data.tar.gz: 79120de446c415b64b23b0a32ccdfb7c647ddd6d
3
+ metadata.gz: ec065087078cb2ec65e5aeb9907ef1984fb1d7ae
4
+ data.tar.gz: 544a4f044b27bd6e43371cc320cacf571cbbb1e1
5
5
  SHA512:
6
- metadata.gz: d95155eb2b0d5f002e5cd152a7bda7e6c00d7f0bd2693e8f60015ca0a5bd6a8176bf639a16c0f2954dd01c10afaeb1da5ae532e0e97d119a0877831c3972d445
7
- data.tar.gz: ce5f7e0dc72eb54a3be1d1a8f8aa209764ab20878983880efbff361579c3fa9a6a3a63728b56f241c0680cb41854a3d9c0254494721e741042b0a152971cd924
6
+ metadata.gz: e031da7623557bcf5cdad96fad0d34cfb8a2016b40ba6d505dcab3766d1317d9652b2b36ce5bb125b4c99582c2d0a22ae4810dc7185e7ecf5693e364191d563d
7
+ data.tar.gz: b397508fb1ac8599cc366b8ba449b93ae88d5bd84928690ecc33b1c3511c92cab6934ac69cadf700d67f16b2a35966240354b5c991758129bf8e1606cd6ad284
@@ -45,7 +45,11 @@ module CropDuster
45
45
  end
46
46
 
47
47
  def import_billing(import_id = SecureRandom.hex)
48
- ActiveRecord::Base.connection.instance_variable_get("@connection").exec("TRUNCATE aws_billing_imports")
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
@@ -1,5 +1,5 @@
1
1
  module Crop
2
2
  module Duster
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crop-duster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Winslett