Class: Elasticity::SyncToS3
- Inherits:
-
Object
- Object
- Elasticity::SyncToS3
- Defined in:
- lib/elasticity/sync_to_s3.rb
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#secret_key ⇒ Object
readonly
Returns the value of attribute secret_key.
Instance Method Summary collapse
-
#initialize(bucket, access = nil, secret = nil, region = nil) ⇒ SyncToS3
constructor
A new instance of SyncToS3.
- #sync(local, remote) ⇒ Object
Constructor Details
#initialize(bucket, access = nil, secret = nil, region = nil) ⇒ SyncToS3
Returns a new instance of SyncToS3.
14 15 16 17 18 19 |
# File 'lib/elasticity/sync_to_s3.rb', line 14 def initialize(bucket, access=nil, secret=nil, region=nil) @access_key = get_access_key(access) @secret_key = get_secret_key(secret) @bucket_name = bucket @region = region ||= 'us-east-1' end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
9 10 11 |
# File 'lib/elasticity/sync_to_s3.rb', line 9 def access_key @access_key end |
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
11 12 13 |
# File 'lib/elasticity/sync_to_s3.rb', line 11 def bucket_name @bucket_name end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
12 13 14 |
# File 'lib/elasticity/sync_to_s3.rb', line 12 def region @region end |
#secret_key ⇒ Object (readonly)
Returns the value of attribute secret_key.
10 11 12 |
# File 'lib/elasticity/sync_to_s3.rb', line 10 def secret_key @secret_key end |
Instance Method Details
#sync(local, remote) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/elasticity/sync_to_s3.rb', line 21 def sync(local, remote) if File.directory?(local) sync_dir(local, remote) else sync_file(local, remote) end end |