s3imageoptim 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/s3imageoptim/cli.rb +1 -2
- data/lib/s3imageoptim/command.rb +11 -2
- data/lib/s3imageoptim/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33bfb718df6e460f830ea298af9cea240cd81246
|
4
|
+
data.tar.gz: 43d04c5df3f5cf9409d044f11dc6901fda2a9bd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f133af9d475bd51cd16ad39f8b30360d98d3b9eccb49ee6e1199d55a4ec1170abf82b7dc593977fa00abc38dbf24531a03788869e536e819194fe5084bd4691
|
7
|
+
data.tar.gz: 458d4f2d21cced8a379b004fe1b829625891ca67bb841e854aed237219de256d6ca13d83b73f620613b08570c77669fb4f27161fb22a7a6e2b987ccc7b01a2ef
|
data/lib/s3imageoptim/cli.rb
CHANGED
@@ -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?
|
data/lib/s3imageoptim/command.rb
CHANGED
@@ -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(
|
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
|
data/lib/s3imageoptim/version.rb
CHANGED