lib/microstatic/s3_bucket_creator.rb in microstatic-0.3.0 vs lib/microstatic/s3_bucket_creator.rb in microstatic-0.4.0

- old
+ new

@@ -6,12 +6,15 @@ def initialize( aws_creds ) check_and_store_aws_creds(aws_creds) end def create( bucket_name ) - connection.put_bucket( bucket_name ) - connection.put_bucket_acl( bucket_name, 'public-read' ) - connection.put_bucket_website( bucket_name, 'index.html', :key => '404.html' ) + # TODO: can we create a new directory without eagerly fetch the list of all dirs? + directory = connection.directories.create( :key => bucket_name, :public => true ) + # TODO: can I do this by calling a method on directory? + connection.put_bucket_website( directory.key, 'index.html', :key => '404.html' ) + + directory end end end