Module: PrelandsRails::UpdateSimpleSource::Upload::DeleteCompiledFiles
- Defined in:
- lib/prelands_rails/update_simple_source/upload/delete_compiled_files.rb
Overview
Удалить из bucket_names
файлы преленда из директории aws_prefix
.
Instance Method Summary collapse
Instance Method Details
#delete_compiled_files ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/prelands_rails/update_simple_source/upload/delete_compiled_files.rb', line 10 def delete_compiled_files creds = context.s3_credentials client = ::PrelandsRails::MyAwsClient.new creds[:access_key], creds[:secret_key], creds[:region] context.bucket_names.each do |bucket_name| files = client.list_objects bucket_name next unless files files = files.map do |file_name| { key: file_name } if file_name.index(context.aws_prefix) == 0 end.compact next if files.empty? client.delete_objects bucket_name, files end end |