mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
26 lines
750 B
Ruby
Executable file
26 lines
750 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
require File.join(File.dirname(__FILE__), '..', 'lib', 'fog')
|
|
require 'irb'
|
|
require 'yaml'
|
|
|
|
if ARGV[0] && File.exists?(File.expand_path(ARGV[0]))
|
|
@credentials = YAML.load(File.open(File.expand_path(ARGV[0])).read)
|
|
elsif File.exists?(File.expand_path('~/.fog'))
|
|
@credentials = YAML.load(File.open(File.expand_path('~/.fog')).read)
|
|
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 buckets
|
|
@s3.buckets
|
|
end
|
|
|
|
ARGV.clear # Avoid passing args to IRB
|
|
IRB.setup(nil)
|
|
@irb = IRB::Irb.new(nil)
|
|
IRB.conf[:MAIN_CONTEXT] = @irb.context
|
|
@irb.context.workspace = IRB::WorkSpace.new(binding)
|
|
catch(:IRB_EXIT) { @irb.eval_input }
|