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
19 20 21 |
# File 'lib/s3imageoptim/command.rb', line 19 def compress ImageOptim.new(pngout: false, svgo: false).optimize_images!(local_files) end |
#get ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/s3imageoptim/command.rb', line 9 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
23 24 25 26 27 |
# File 'lib/s3imageoptim/command.rb', line 23 def put s3cmd("sync #{tmpdir}/ #{bucket}") do |error| abort("An error ocurred while putting the files: #{error}") end end |
#remove ⇒ Object
29 30 31 |
# File 'lib/s3imageoptim/command.rb', line 29 def remove FileUtils.remove_entry(tmpdir) end |