banhpho 0.1.3 → 0.1.4
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/banhpho/cli.rb +9 -1
- data/lib/banhpho/version.rb +1 -1
- data/lib/banhpho.rb +2 -0
- 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: d896092aad733d4690ade46adde34f6198fcb8f8
|
4
|
+
data.tar.gz: e406a48df3513d4f891166ab951bedd4962a5c37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd8fdd61ea151777c3b1aa5b62d022e8d4b6bd39fd30245ef450d12321480a969cb4ec521b4d889e8bd77b4a8534ee84077b0b13dbe8dc05bb223a0d7659167a
|
7
|
+
data.tar.gz: 93502506797490b53748b10befd3d1e0f0ec7863d7b86b99d56ca2a6f9b297203cd4ea7011f8538dd7fb4ac59002a60a1e6e749b40694fcf0a9ea36834460b84
|
data/lib/banhpho/cli.rb
CHANGED
@@ -2,6 +2,7 @@ require "thor"
|
|
2
2
|
|
3
3
|
module Banhpho
|
4
4
|
class CLI < Thor
|
5
|
+
|
5
6
|
desc "compress DIR", "compress all png files in DIR"
|
6
7
|
def compress(dir)
|
7
8
|
@count = 0
|
@@ -19,6 +20,12 @@ module Banhpho
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
desc "version", "print the version of current release"
|
24
|
+
map ['-v', 'v', '--version'] => :version
|
25
|
+
def version()
|
26
|
+
puts VERSION
|
27
|
+
end
|
28
|
+
|
22
29
|
no_commands do
|
23
30
|
def compressInDir (dir)
|
24
31
|
Dir.foreach(dir) do |item|
|
@@ -32,8 +39,9 @@ module Banhpho
|
|
32
39
|
ext = File.extname(path).downcase
|
33
40
|
if ext == ".png" then
|
34
41
|
@originalSize += File.size(path)
|
42
|
+
exePath = path.gsub(/ /, "\\ ")
|
35
43
|
puts(" compressing file: #{path}")
|
36
|
-
%x(pngquant --force --ext .png --skip-if-larger -- #{
|
44
|
+
%x(pngquant --force --ext .png --skip-if-larger -- #{exePath})
|
37
45
|
@count += 1
|
38
46
|
@newSize += File.size(path)
|
39
47
|
end
|
data/lib/banhpho/version.rb
CHANGED
data/lib/banhpho.rb
CHANGED