s3imageoptim 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b954eab6b4c9b81c9a54930f5871792ed4ddbd22
4
- data.tar.gz: b4a5e45d0199bc4d9deab70e7cf9d19b821c335d
3
+ metadata.gz: 33bfb718df6e460f830ea298af9cea240cd81246
4
+ data.tar.gz: 43d04c5df3f5cf9409d044f11dc6901fda2a9bd5
5
5
  SHA512:
6
- metadata.gz: 7851ee775e1082de771b10320607206544ad761e264946b49f3882de5efe21689e7679e854e81818a968249740988e49fa3a5d2bce19097bf96d2f2fff7504d8
7
- data.tar.gz: d5b158b7674199281223f8ea419202d9403b458281b70bafbcc8d02521e145181559ec527923ab6ffccf9ee1b02ca067028a23593645db255090994d5927a941
6
+ metadata.gz: 7f133af9d475bd51cd16ad39f8b30360d98d3b9eccb49ee6e1199d55a4ec1170abf82b7dc593977fa00abc38dbf24531a03788869e536e819194fe5084bd4691
7
+ data.tar.gz: 458d4f2d21cced8a379b004fe1b829625891ca67bb841e854aed237219de256d6ca13d83b73f620613b08570c77669fb4f27161fb22a7a6e2b987ccc7b01a2ef
@@ -2,8 +2,7 @@ require "thor"
2
2
  require "s3imageoptim/command"
3
3
 
4
4
  class S3imageoptim::CLI < Thor
5
-
6
- register S3imageoptim::Command, "optim", "optim BUCKET", "Get all files from a S3 BUCKET and put them back compressed"
5
+ register S3imageoptim::Command, "optim", "optim BUCKET [--acl=public|private]", "Get all files from a S3 BUCKET and put them back compressed"
7
6
 
8
7
  private
9
8
  def exit_on_failure?
@@ -5,6 +5,8 @@ require "open3"
5
5
 
6
6
  class S3imageoptim::Command < Thor::Group
7
7
  argument :bucket, desc: "S3 Bucket to compress"
8
+ class_option :acl, enum: %w(public private), default: "public"
9
+
8
10
  desc "Get all files from BUCKET and put them back compressed"
9
11
  def get
10
12
  s3cmd("get --exclude '*' --rinclude '\.(#{extensions("|")})$' --recursive #{bucket} #{tmpdir}") do |error|
@@ -17,11 +19,18 @@ class S3imageoptim::Command < Thor::Group
17
19
  end
18
20
 
19
21
  def compress
20
- ImageOptim.new(pngout: false, svgo: false).optimize_images!(local_files)
22
+ ImageOptim.new(
23
+ svgo: false,
24
+ pngout: false,
25
+ jpegoptim: {
26
+ allow_lossy: true,
27
+ max_quality: 80
28
+ }
29
+ ).optimize_images!(local_files)
21
30
  end
22
31
 
23
32
  def put
24
- s3cmd("sync #{tmpdir}/ #{bucket}") do |error|
33
+ s3cmd("sync --acl-#{options[:acl]} #{tmpdir}/ #{bucket}") do |error|
25
34
  abort("An error ocurred while putting the files: #{error}")
26
35
  end
27
36
  end
@@ -1,3 +1,3 @@
1
1
  module S3imageoptim
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3imageoptim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Álvarez