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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -2
- data/lib/crop_duster/cli.rb +6 -3
- data/lib/crop_duster/importer.rb +1 -1
- data/lib/crop_duster/version.rb +1 -1
- data/lib/crop_duster.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33934c7affccf917babfbff9c04f3625b3ae27eb
|
4
|
+
data.tar.gz: 7f754b3fe63afa280b030c80c71eb3d442bd9d50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d3f847f04a9e2f1dce9c453243ab58cb097d5f5fb12068f09aa970d96350658678f987848f266ca28fc68392ad52ee45b0fceea82973891e70fcb1ee91e084e
|
7
|
+
data.tar.gz: 4a398d7be79c9899c01a935818c38fdaa5b4471d6b5030a4f5980b7be364fdfb4b69a12dcda001d5f0119611df568fd7b9824d115b51abfc8a7c824fb5435b81
|
data/Gemfile.lock
CHANGED
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
|
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
|
|
data/lib/crop_duster/cli.rb
CHANGED
@@ -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
|
data/lib/crop_duster/importer.rb
CHANGED
@@ -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 = "
|
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|
|
data/lib/crop_duster/version.rb
CHANGED
data/lib/crop_duster.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|