mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
lazy load connections for bin/fog
This commit is contained in:
parent
5afbcc802a
commit
8a182e5ce5
1 changed files with 19 additions and 15 deletions
34
bin/fog
34
bin/fog
|
@ -9,42 +9,46 @@ elsif File.exists?(File.expand_path('~/.fog'))
|
|||
@credentials = YAML.load(File.open(File.expand_path('~/.fog')).read)
|
||||
end
|
||||
|
||||
@ec2 = Fog::AWS::EC2.new(
|
||||
:aws_access_key_id => @credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => @credentials[:aws_secret_access_key]
|
||||
)
|
||||
def ec2
|
||||
@ec2 = Fog::AWS::EC2.new(
|
||||
:aws_access_key_id => @credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => @credentials[:aws_secret_access_key]
|
||||
)
|
||||
end
|
||||
|
||||
@s3 = Fog::AWS::S3.new(
|
||||
:aws_access_key_id => @credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => @credentials[:aws_secret_access_key]
|
||||
)
|
||||
def s3
|
||||
@s3 = Fog::AWS::S3.new(
|
||||
:aws_access_key_id => @credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => @credentials[:aws_secret_access_key]
|
||||
)
|
||||
end
|
||||
|
||||
def addresses
|
||||
@ec2.addresses
|
||||
ec2.addresses
|
||||
end
|
||||
|
||||
def buckets
|
||||
@s3.buckets
|
||||
s3.buckets
|
||||
end
|
||||
|
||||
def instances
|
||||
@ec2.instances
|
||||
ec2.instances
|
||||
end
|
||||
|
||||
def key_pairs
|
||||
@ec2.key_pairs
|
||||
ec2.key_pairs
|
||||
end
|
||||
|
||||
def security_groups
|
||||
@ec2.security_groups
|
||||
ec2.security_groups
|
||||
end
|
||||
|
||||
def snapshots
|
||||
@ec2.snapshots
|
||||
ec2.snapshots
|
||||
end
|
||||
|
||||
def volumes
|
||||
@ec2.volumes
|
||||
ec2.volumes
|
||||
end
|
||||
|
||||
ARGV.clear # Avoid passing args to IRB
|
||||
|
|
Loading…
Reference in a new issue