geordi 0.15.2 → 0.15.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/optimize-png +13 -6
  2. data/lib/geordi/version.rb +1 -1
  3. metadata +3 -3
data/bin/optimize-png CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require "ruby-debug"
3
2
  require 'fileutils'
4
3
 
5
4
  # pngcrush -rem allb -reduce -brute original.png optimized.png
@@ -38,9 +37,12 @@ def print_manual
38
37
  indented_puts "- Eliminates unused colors and reduce bit-depth (If possible)"
39
38
  indented_puts "- May reduce PNG file size lossless"
40
39
  indented_puts
41
- indented_puts "Batch optimize all *.png in current directory:"
40
+ indented_puts "Batch-optimize all *.png in a directory:"
42
41
  indented_puts " #{script_name} directory"
43
42
  indented_puts
43
+ indented_puts "Batch-optimize the current directory:"
44
+ indented_puts " #{script_name} ."
45
+ indented_puts
44
46
  indented_puts "Optimize single file:"
45
47
  indented_puts " #{script_name} input.png"
46
48
  indented_puts
@@ -91,16 +93,21 @@ def batch_optimize_inplace(path)
91
93
  end
92
94
 
93
95
  def main
94
- if ARGV.size == 1
96
+ if `which pngcrush`.strip == ""
97
+ indented_puts
98
+ indented_puts "You have to install pngcrush first: sudo apt-get install pngcrush"
99
+ indented_puts
100
+ elsif ARGV.size == 1
95
101
  path = ARGV[0]
96
102
  if File.directory?(path)
97
103
  batch_optimize_inplace(path)
98
104
  elsif File.file?(path)
99
105
  optimize_inplace(path)
106
+ else
107
+ print_manual
108
+ indented_puts "*** Error: '#{path}' is neither a directory nor a file ***"
109
+ indented_puts
100
110
  end
101
- print_manual
102
- indented_puts "*** Error: '#{path}' is neither a directory nor a file ***"
103
- indented_puts
104
111
  else
105
112
  print_manual
106
113
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '0.15.2'
2
+ VERSION = '0.15.3'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 15
9
- - 2
10
- version: 0.15.2
9
+ - 3
10
+ version: 0.15.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch