s3sizecalc 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5989b8eeb58eafc76a897bef4b9564d71a0895d4
4
- data.tar.gz: d89b75c832ecd11811a5b3c129c15b62e5e85448
3
+ metadata.gz: dc31e53445a70a96cb117d1a3801ba5d4f0b9b51
4
+ data.tar.gz: 672648c5f0857fe362dd7f0f57c2d049d4836845
5
5
  SHA512:
6
- metadata.gz: 08b53da0f51e52f2b76fd2ebc39da35e629a738da28d59b7c85ca6f2b86ede4c480234d3f634b6d39508411e5a60e60a8cd7181ee75ca2090db23e66ec1dc0b1
7
- data.tar.gz: 3495ac2b34566e37202d32e1371669ab4ae05cb51b7d80d5c4ca40a6c5a36f56b643d00cfdebdbe86f0d6c7504e1fba752eaed8ed6321713a61bcdc6f392b951
6
+ metadata.gz: 64b2bbd48c67129261408d4dbde98e9feb9890d0e00904e9fb43f28f89d055221929ec561db2619a15f46aaa419f749a81bf8878cd418acd8f76cec82af50f86
7
+ data.tar.gz: cdc947b4a5e5635b55502ef10ca6d017531c704959b74b788ca01e6799af52d940f965808a0faba7ffe8e7a7a1926dec6ab76f5f2a3c861103c155a70a677350
@@ -57,11 +57,28 @@ module S3SizeCalc
57
57
 
58
58
  def s3(region = current_region)
59
59
  name = :"@s3_#{region.gsub("-", "_")}"
60
- instance_variable_get(name) or instance_variable_set(name, Aws::S3::Resource.new(region: (region)))
60
+ instance_variable_get(name) or instance_variable_set(name, Aws::S3::Resource.new(aws_configuration.merge region: (region)))
61
61
  end
62
62
 
63
63
  def ec2
64
- @ec2 ||= Aws::EC2::Resource.new(region: (current_region))
64
+ @ec2 ||= Aws::EC2::Resource.new(aws_configuration.merge region: current_region)
65
+ end
66
+
67
+ def aws_configuration
68
+ return @aws_configuration if @aws_configuration
69
+
70
+ @aws_configuration = {}
71
+
72
+ [:access_key_id, :secret_access_key].each do |option|
73
+ @aws_configuration.update(option => @options[option]) if @options[option]
74
+ end
75
+
76
+ if [@options.shared_credentials_path, @options.profile].any?
77
+ credentials = Aws::SharedCredentials.new path: @options.shared_credentials_path, profile_name: @options.profile
78
+ @aws_configuration.update credentials: credentials
79
+ end
80
+
81
+ @aws_configuration
65
82
  end
66
83
  end
67
84
  end
@@ -1,3 +1,3 @@
1
1
  module S3SizeCalc
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.2".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3sizecalc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - y13i