squeezem 0.1.5 → 0.1.6
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.
- data/lib/squeezem.rb +1 -1
- metadata +27 -48
- data/bin/squeezem.rb~ +0 -51
- data/bin/squeezem~ +0 -52
- data/lib/squeezem.rb~ +0 -2
data/lib/squeezem.rb
CHANGED
@@ -123,7 +123,7 @@ class Squeezem
|
|
123
123
|
output = ''
|
124
124
|
case file_type
|
125
125
|
when :png
|
126
|
-
cmd = ['pngcrush', '-quiet', '-rem', '
|
126
|
+
cmd = ['pngcrush', '-quiet', '-rem', 'allb', path, @output_path]
|
127
127
|
log("Calling #{cmd.join(' ')}")
|
128
128
|
Open3.popen3(*cmd) do |stdin, stdout, stderr|
|
129
129
|
output = stdout.read
|
metadata
CHANGED
@@ -1,77 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: squeezem
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 5
|
10
|
-
version: 0.1.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Steve Woodcock
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-08-29 00:00:00 +01:00
|
19
|
-
default_executable:
|
12
|
+
date: 2013-09-04 00:00:00.000000000 Z
|
20
13
|
dependencies: []
|
14
|
+
description: ! 'List pngs or jpgs which are bigger than they need to be. Can optionally
|
21
15
|
|
22
|
-
description: |-
|
23
|
-
List pngs or jpgs which are bigger than they need to be. Can optionally
|
24
16
|
compress them, but is designed mainly to keep an eye on a tree of
|
25
|
-
|
26
|
-
|
17
|
+
|
18
|
+
images to make sure they stay in good shape.'
|
19
|
+
email:
|
27
20
|
- steve.woodcock@gmail.com
|
28
|
-
executables:
|
21
|
+
executables:
|
29
22
|
- squeezem
|
30
23
|
extensions: []
|
31
|
-
|
32
24
|
extra_rdoc_files: []
|
33
|
-
|
34
|
-
files:
|
25
|
+
files:
|
35
26
|
- bin/squeezem
|
36
|
-
- bin/squeezem.rb~
|
37
|
-
- bin/squeezem~
|
38
27
|
- lib/squeezem.rb
|
39
|
-
- lib/squeezem.rb~
|
40
28
|
- LICENSE
|
41
29
|
- README
|
42
|
-
has_rdoc: true
|
43
30
|
homepage: http://github.com/stevewoodcock/squeezem
|
44
31
|
licenses: []
|
45
|
-
|
46
32
|
post_install_message:
|
47
33
|
rdoc_options: []
|
48
|
-
|
49
|
-
require_paths:
|
34
|
+
require_paths:
|
50
35
|
- lib
|
51
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
52
41
|
none: false
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
- 0
|
59
|
-
version: "0"
|
60
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
61
47
|
none: false
|
62
|
-
requirements:
|
63
|
-
- - ">="
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
hash: 3
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
version: "0"
|
69
48
|
requirements: []
|
70
|
-
|
71
49
|
rubyforge_project: squeezem
|
72
|
-
rubygems_version: 1.
|
50
|
+
rubygems_version: 1.8.25
|
73
51
|
signing_key:
|
74
52
|
specification_version: 3
|
75
|
-
summary: List pngs or jpgs which are bigger than they need to be, and optionally compress
|
53
|
+
summary: List pngs or jpgs which are bigger than they need to be, and optionally compress
|
54
|
+
them
|
76
55
|
test_files: []
|
77
|
-
|
56
|
+
has_rdoc:
|
data/bin/squeezem.rb~
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Like smusher but uses local tools
|
4
|
-
|
5
|
-
# report mode
|
6
|
-
# pass list of files on stdin
|
7
|
-
# save canonicalised list of files processed + state (can squeeze vs already squeezed)
|
8
|
-
# squeeze mode
|
9
|
-
# handle exception when pngcrush given a jpeg
|
10
|
-
# handle nonempty output_dir at exit
|
11
|
-
# license
|
12
|
-
|
13
|
-
require 'find'
|
14
|
-
require 'open3'
|
15
|
-
require 'tempfile'
|
16
|
-
|
17
|
-
total_bytes = 0
|
18
|
-
saved_bytes = 0
|
19
|
-
output_dir = Dir.mktmpdir
|
20
|
-
at_exit do
|
21
|
-
Dir.rmdir(output_dir)
|
22
|
-
end
|
23
|
-
output_path = File.join(output_dir, 'x')
|
24
|
-
|
25
|
-
$stdin.each_line do |file_or_dir|
|
26
|
-
puts file_or_dir
|
27
|
-
end
|
28
|
-
ARGV.each do |file_or_dir|
|
29
|
-
Find.find(file_or_dir) do |path|
|
30
|
-
next unless path =~ /\.(png)$/
|
31
|
-
original_size = File.size(path)
|
32
|
-
output = ''
|
33
|
-
Open3.popen3('pngcrush', '-quiet', path, output_path) do |stdin, stdout, stderr|
|
34
|
-
output = stdout.read
|
35
|
-
end
|
36
|
-
if File.exist?(output_path)
|
37
|
-
new_size = File.size(output_path)
|
38
|
-
if new_size < original_size
|
39
|
-
total_bytes += original_size
|
40
|
-
saving = original_size - new_size
|
41
|
-
saved_bytes += saving
|
42
|
-
puts "#{path}"
|
43
|
-
end
|
44
|
-
File.unlink(output_path)
|
45
|
-
else
|
46
|
-
puts path, output
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
pct_saved = saved_bytes * 100.0 / total_bytes
|
51
|
-
puts "#{saved_bytes} saved out of #{total_bytes} (%.2f)%" % pct_saved
|
data/bin/squeezem~
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Like smusher but uses local tools
|
4
|
-
|
5
|
-
# report mode
|
6
|
-
# pass list of files on stdin
|
7
|
-
# save canonicalised list of files processed + state (can squeeze vs already squeezed)
|
8
|
-
# squeeze mode
|
9
|
-
# handle exception when pngcrush given a jpeg
|
10
|
-
# handle nonempty output_dir at exit
|
11
|
-
# license
|
12
|
-
|
13
|
-
require 'squeezem'
|
14
|
-
require 'find'
|
15
|
-
require 'open3'
|
16
|
-
require 'tempfile'
|
17
|
-
|
18
|
-
total_bytes = 0
|
19
|
-
saved_bytes = 0
|
20
|
-
output_dir = Dir.mktmpdir
|
21
|
-
at_exit do
|
22
|
-
Dir.rmdir(output_dir)
|
23
|
-
end
|
24
|
-
output_path = File.join(output_dir, 'x')
|
25
|
-
|
26
|
-
$stdin.each_line do |file_or_dir|
|
27
|
-
puts file_or_dir
|
28
|
-
end
|
29
|
-
ARGV.each do |file_or_dir|
|
30
|
-
Find.find(file_or_dir) do |path|
|
31
|
-
next unless path =~ /\.(png)$/
|
32
|
-
original_size = File.size(path)
|
33
|
-
output = ''
|
34
|
-
Open3.popen3('pngcrush', '-quiet', path, output_path) do |stdin, stdout, stderr|
|
35
|
-
output = stdout.read
|
36
|
-
end
|
37
|
-
if File.exist?(output_path)
|
38
|
-
new_size = File.size(output_path)
|
39
|
-
if new_size < original_size
|
40
|
-
total_bytes += original_size
|
41
|
-
saving = original_size - new_size
|
42
|
-
saved_bytes += saving
|
43
|
-
puts "#{path}"
|
44
|
-
end
|
45
|
-
File.unlink(output_path)
|
46
|
-
else
|
47
|
-
puts path, output
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
pct_saved = saved_bytes * 100.0 / total_bytes
|
52
|
-
puts "#{saved_bytes} saved out of #{total_bytes} (%.2f)%" % pct_saved
|
data/lib/squeezem.rb~
DELETED