Class: S3imageoptim::Command
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- S3imageoptim::Command
- Defined in:
- lib/s3imageoptim/command.rb
Instance Method Summary collapse
Instance Method Details
#compress ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/s3imageoptim/command.rb', line 21 def compress ImageOptim.new( svgo: false, pngout: false, jpegoptim: { allow_lossy: true, max_quality: 80 } ).optimize_images!(local_files) end |
#get ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/s3imageoptim/command.rb', line 11 def get s3cmd("get --exclude '*' --rinclude '\.(#{extensions("|")})$' --recursive #{bucket} #{tmpdir}") do |error| abort("An error ocurred while getting the files: #{error}") end if local_files.empty? abort("No images were found in the bucket") end end |
#put ⇒ Object
32 33 34 35 36 |
# File 'lib/s3imageoptim/command.rb', line 32 def put s3cmd("sync --acl-#{[:acl]} #{tmpdir}/ #{bucket}") do |error| abort("An error ocurred while putting the files: #{error}") end end |
#remove ⇒ Object
38 39 40 |
# File 'lib/s3imageoptim/command.rb', line 38 def remove FileUtils.remove_entry(tmpdir) end |