Class: DearS3::Client
- Inherits:
-
Object
- Object
- DearS3::Client
- Includes:
- Thor::Shell
- Defined in:
- lib/dears3.rb,
lib/dears3/client.rb
Instance Method Summary collapse
- #configure_website ⇒ Object
-
#initialize(s3_connection) ⇒ Client
constructor
A new instance of Client.
- #remove_website ⇒ Object
- #sync(path) ⇒ Object
Constructor Details
#initialize(s3_connection) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 |
# File 'lib/dears3/client.rb', line 9 def initialize s3_connection @s3 = s3_connection @bucket = nil set_bucket end |
Instance Method Details
#configure_website ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dears3/client.rb', line 22 def configure_website files = bucket.objects.map { |obj| obj.key } say "Files currently in your bucket:" say files.join(" | "), :green index_doc = ask "Pick your bucket's index document:" error_doc = ask "Pick your bucket's error document:" say "Publishing your bucket. This may take a while..." bucket.configure_website do |cfg| cfg.index_document_suffix = index_doc cfg.error_document_key = error_doc # TODO: Make this optional end say "Bucket published at #{ bucket.url }." end |
#remove_website ⇒ Object
36 37 38 39 |
# File 'lib/dears3/client.rb', line 36 def remove_website bucket.remove_website_configuration say "Removed #{ bucket.name } from the web." end |
#sync(path) ⇒ Object
16 17 18 19 20 |
# File 'lib/dears3/client.rb', line 16 def sync path say "Uploading files to bucket '#{ bucket.name }'." walk_and_upload path say "Done syncing bucket." end |