Class: Rstreet::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/rstreet.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Uploader

Returns a new instance of Uploader.



10
11
12
13
14
15
# File 'lib/rstreet.rb', line 10

def initialize(options)
  @options = options
  load_env if should_load_env?
  config_aws
  validate_options
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rstreet.rb', line 17

def run
  collector = UploadableCollector.new(@options.src)
  uploadables = collector.collect

  bucket_communicator = BucketCommunicator.new(@options.s3_bucket, @options.dry_run)
  old_manifest = bucket_communicator.pull_manifest(collector.manifest_uploadable)
  current_manifest_builder = collector.manifest_builder
  diff = current_manifest_builder.diff(old_manifest)

  to_upload = collector.find_uploadables(diff)
  bucket_communicator.upload(to_upload)
end