class Deadpull::Commands::Push

Public Instance Methods

call() click to toggle source
# File lib/deadpull/commands/push.rb, line 12
def call
  paths.each do |current_path|
    bucket.put_object(
      key: Values::S3Path.concretize(local_root, current_path, s3_locations.prefix),
      body: File.read(current_path)
    )
  end
  true
end

Private Instance Methods

local_root() click to toggle source
# File lib/deadpull/commands/push.rb, line 32
def local_root
  @local_root ||= File.file?(path) ? File.dirname(path) : path
end
paths() click to toggle source
# File lib/deadpull/commands/push.rb, line 24
def paths
  @paths ||= if File.file?(path)
               [path]
             else
               Dir[path.join('**', '*')].select { |item| File.file?(item) }
             end
end