Class: S3rbsync::Synchronizer
- Inherits:
-
Object
- Object
- S3rbsync::Synchronizer
- Defined in:
- lib/s3rbsync/synchronizer.rb
Instance Method Summary collapse
- #connected? ⇒ Boolean
-
#initialize(configure, directory = nil) ⇒ Synchronizer
constructor
A new instance of Synchronizer.
- #sync! ⇒ Object
Constructor Details
#initialize(configure, directory = nil) ⇒ Synchronizer
Returns a new instance of Synchronizer.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/s3rbsync/synchronizer.rb', line 6 def initialize(configure, directory = nil) @configure = configure @local_dir = directory @s3 = Fog::Storage.new(:provider => 'AWS', :aws_access_key_id => @configure.access_key, :aws_secret_access_key => @configure.secret_key, :region => (@configure.region || 'ap-northeast-1'), :persistent => false ) @bucket = @s3.directories.get(@configure.bucket_name) @queue = Queue.new rescue => e puts "----- Error -----" puts e. exit 1 end |
Instance Method Details
#connected? ⇒ Boolean
22 23 24 |
# File 'lib/s3rbsync/synchronizer.rb', line 22 def connected? !!@bucket end |
#sync! ⇒ Object
26 27 28 29 |
# File 'lib/s3rbsync/synchronizer.rb', line 26 def sync! # puts '...call sync!' upload_files(@local_dir) end |