crop-duster 0.0.7 → 0.0.8

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: 482a4f648759ef823f98109266ed74dbcb539f69
4
- data.tar.gz: 964dd97a1c21a9f98f37d08977be33aab1f298ae
3
+ metadata.gz: 33934c7affccf917babfbff9c04f3625b3ae27eb
4
+ data.tar.gz: 7f754b3fe63afa280b030c80c71eb3d442bd9d50
5
5
  SHA512:
6
- metadata.gz: bdf1940a9637197a7d504cc159e3e0d4b5ce4e655a936800cf5767c197c341f865282f8afd435cd41d0fbf18b6752ac174ba69c0f8fe4dfe96dfd3c7fdc48c7f
7
- data.tar.gz: 318ef45c68818fc635fe37e305cf63f75b927e3182472668db1f466765586e05466b5424dd2f06abb0bbbb9fc87d1332c986a63930d1514c2342c8baa5e833fe
6
+ metadata.gz: 8d3f847f04a9e2f1dce9c453243ab58cb097d5f5fb12068f09aa970d96350658678f987848f266ca28fc68392ad52ee45b0fceea82973891e70fcb1ee91e084e
7
+ data.tar.gz: 4a398d7be79c9899c01a935818c38fdaa5b4471d6b5030a4f5980b7be364fdfb4b69a12dcda001d5f0119611df568fd7b9824d115b51abfc8a7c824fb5435b81
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crop-duster (0.0.1)
4
+ crop-duster (0.0.7)
5
5
  activerecord (~> 4.0.2)
6
6
  activesupport (~> 4.0.2)
7
7
  bundler (~> 1.3)
data/README.md CHANGED
@@ -7,13 +7,15 @@ stack. With Crop Duster, you can both query state and transition.
7
7
 
8
8
  ## Running & Installation
9
9
 
10
- Crop Duster is a stand alone application for mfile:
10
+ Crop Duster is a stand alone application. Install using a gem file:
11
11
 
12
12
  gem install crop-duster
13
13
 
14
14
  And then execute:
15
15
 
16
- $ crop-duster AWS_SECRET=<IAM secret> AWS_KEY=<IAM key> AWS_BILLING_BUCKET=<S3 Bucket>
16
+ $ crop-duster import --db=<postgres url> AWS_SECRET=<IAM secret> AWS_KEY=<IAM key> AWS_BILLING_BUCKET=<S3 Bucket>
17
+
18
+ For best results, schedule to run nightly.
17
19
 
18
20
  ## Contributing
19
21
 
@@ -19,8 +19,9 @@ module CropDuster
19
19
  option :aws_secret, required: true
20
20
  option :aws_key, required: true
21
21
  option :aws_billing_bucket
22
+ option :tmp_dir
22
23
  def import
23
- set_configs(options[:db], options[:aws_secret], options[:aws_key], options[:aws_billing_bucket])
24
+ set_configs(options[:db], options[:aws_secret], options[:aws_key], options[:aws_billing_bucket], options[:tmp_dir])
24
25
  CropDuster::Importer.import
25
26
  end
26
27
 
@@ -29,18 +30,20 @@ module CropDuster
29
30
  option :aws_secret, required: true
30
31
  option :aws_key, required: true
31
32
  option :aws_billing_bucket, required: true
33
+ option :tmp_dir
32
34
  def import_billing
33
- set_configs(options[:db], options[:aws_secret], options[:aws_key], options[:aws_billing_bucket])
35
+ set_configs(options[:db], options[:aws_secret], options[:aws_key], options[:aws_billing_bucket], options[:tmp_dir])
34
36
  CropDuster::Importer.import_billing
35
37
  end
36
38
 
37
39
  private
38
- def set_configs(db_url, aws_secret, aws_key, aws_billing_bucket = nil)
40
+ def set_configs(db_url, aws_secret, aws_key, aws_billing_bucket = nil, tmp_dir = "/tmp")
39
41
  CropDuster.configure do |config|
40
42
  config.db = db_url
41
43
  config.aws_secret = aws_secret
42
44
  config.aws_key = aws_key
43
45
  config.aws_billing_bucket = aws_billing_bucket
46
+ config.tmp_dir = tmp_dir
44
47
  end
45
48
  end
46
49
  end
@@ -47,7 +47,7 @@ module CropDuster
47
47
  def import_billing(import_id = SecureRandom.hex)
48
48
  ActiveRecord::Base.connection.execute("TRUNCATE aws_billing_imports")
49
49
  s = Fog::Storage.new CropDuster.aws_keys
50
- path = "/tmp/#{import_id}"
50
+ path = "#{CropDuster.tmp_dir}/#{import_id}"
51
51
  Dir.mkdir path
52
52
 
53
53
  s.directories.get(CropDuster.aws_billing_bucket).files.find_all { |f| f.key =~ /-aws-billing-detailed-line-items-with-resources-and-tags-/ }.each do |file|
@@ -1,5 +1,5 @@
1
1
  module Crop
2
2
  module Duster
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
data/lib/crop_duster.rb CHANGED
@@ -43,6 +43,14 @@ module CropDuster
43
43
  @aws_billing_bucket
44
44
  end
45
45
 
46
+ def tmp_dir=(string)
47
+ @tmp_dir = string
48
+ end
49
+
50
+ def tmp_dir
51
+ @tmp_dir
52
+ end
53
+
46
54
  def configure(&block)
47
55
  block.call(self)
48
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crop-duster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Winslett
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-04 00:00:00.000000000 Z
11
+ date: 2014-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake