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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0583147dda078db538c335bd42e4090cd2d0a622
4
- data.tar.gz: ad8d99f9555035f9a2247602934383e71f7b49d1
3
+ metadata.gz: d896092aad733d4690ade46adde34f6198fcb8f8
4
+ data.tar.gz: e406a48df3513d4f891166ab951bedd4962a5c37
5
5
  SHA512:
6
- metadata.gz: 0bdcdf2dc4ec29f6a7febe24e659f25a6ba18f379b56956cc6aa8d5d72478a80bf2949d2380294821161e0b48f62803fa2052108e952205b0416cd89375a97d4
7
- data.tar.gz: 44bc20891f85f6ebc3df601d12a8ff180b00fa4e03eef55dabb004e7855f465819ae77cf91c28f1442a14dce741c7037b7070b1ebce93c0da8835df56a729b5d
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 -- #{path})
44
+ %x(pngquant --force --ext .png --skip-if-larger -- #{exePath})
37
45
  @count += 1
38
46
  @newSize += File.size(path)
39
47
  end
@@ -1,3 +1,3 @@
1
1
  module Banhpho
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/banhpho.rb CHANGED
@@ -1,3 +1,5 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
1
3
  require "banhpho/version"
2
4
  require "banhpho/cli"
3
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banhpho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - heartace