image_optim_pack 0.5.0.20170830-x86-linux → 0.5.0.20170831-x86-linux
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/.rubocop.yml +0 -3
- data/CHANGELOG.markdown +4 -0
- data/Makefile +3 -7
- data/image_optim_pack.gemspec +1 -1
- data/script/livecheck +146 -55
- data/vendor/linux-i686/pngcrush +0 -0
- metadata +2 -3
- data/script/update_versions +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf137ba453f4eaa3a60a32ea84101f52e1f0df72
|
4
|
+
data.tar.gz: be30f652b37c032a230dd21f19c62a7f348241ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 507df70a13c15809148a20a4fc4b75247e348cc71be23c359043c41b8709b90fdd9098f3f78c1870c8effb35fc876b493ea6a00131c2c5f31fd2b416966fa757
|
7
|
+
data.tar.gz: 13e67ad3683aeefc958d74d09bdacd105ea8bf39e09e8f92923430176adf80045b641cae6e5794f0061de6f401370803f3327141fd6aa4638c1b6d59c83eb8a6
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.markdown
CHANGED
data/Makefile
CHANGED
@@ -12,7 +12,7 @@ LIBMOZJPEG_VER := 3.1
|
|
12
12
|
LIBPNG_VER := 1.6.32
|
13
13
|
LIBZ_VER := 1.2.11
|
14
14
|
OPTIPNG_VER := 0.7.6
|
15
|
-
PNGCRUSH_VER := 1.8.
|
15
|
+
PNGCRUSH_VER := 1.8.13
|
16
16
|
PNGQUANT_VER := 2.10.2
|
17
17
|
|
18
18
|
# ====== CONSTANTS ======
|
@@ -193,14 +193,10 @@ test :
|
|
193
193
|
$(call check_bin,pngquant,--help,$(PNGQUANT_VER))
|
194
194
|
.PHONY : test
|
195
195
|
|
196
|
-
livecheck :;
|
196
|
+
livecheck :; @script/livecheck
|
197
197
|
.PHONY : livecheck
|
198
198
|
|
199
|
-
|
200
|
-
cat Makefile | script/update_versions > Makefile.updated
|
201
|
-
|
202
|
-
update-versions : Makefile.updated
|
203
|
-
mv Makefile.updated Makefile
|
199
|
+
update-versions :; @script/livecheck --update
|
204
200
|
.PHONY : update-versions
|
205
201
|
|
206
202
|
# ====== CLEAN ======
|
data/image_optim_pack.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'image_optim_pack'
|
5
|
-
s.version = '0.5.0.
|
5
|
+
s.version = '0.5.0.20170831'
|
6
6
|
s.summary = %q{Precompiled binaries for image_optim: advpng, gifsicle, jhead, jpeg-recompress, jpegoptim, jpegtran, optipng, pngcrush, pngquant}
|
7
7
|
s.homepage = "http://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
data/script/livecheck
CHANGED
@@ -1,82 +1,173 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
# Get latest version of tools
|
4
|
-
|
5
3
|
require 'yaml'
|
6
4
|
require 'uri'
|
7
5
|
require 'net/http'
|
6
|
+
require 'openssl'
|
8
7
|
require 'rubygems/version'
|
8
|
+
require 'fspath'
|
9
|
+
|
10
|
+
# Fetch and compare latest tool/library versions
|
11
|
+
class Livecheck
|
12
|
+
# Commands
|
13
|
+
class Cli
|
14
|
+
VERSION_REGEXP = /^([A-Z]+)_VER *:= *(.*)$/
|
15
|
+
|
16
|
+
def initialize(args)
|
17
|
+
@update = args.delete('--update')
|
18
|
+
abort '--update is the only supported option' unless args.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
dump_changes
|
23
|
+
|
24
|
+
return unless @update
|
25
|
+
return unless livechecks.any?(&:changed?)
|
26
|
+
|
27
|
+
update_changelog
|
28
|
+
update_makefile
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def dump_changes
|
34
|
+
livechecks.each do |lc|
|
35
|
+
next unless lc.changed?
|
36
|
+
puts "#{lc.name_n_latest_version} (current: #{lc.current_version})"
|
37
|
+
end
|
38
|
+
end
|
9
39
|
|
10
|
-
|
11
|
-
|
12
|
-
|
40
|
+
def update_changelog
|
41
|
+
changelog = FSPath('CHANGELOG.markdown')
|
42
|
+
lines = changelog.readlines
|
43
|
+
lines.insert(4, "\n") if lines[4] =~ /^## /
|
44
|
+
lines.insert(4, changelog_entry)
|
45
|
+
write(changelog, lines.join(''))
|
46
|
+
end
|
47
|
+
|
48
|
+
def update_makefile
|
49
|
+
content = makefile.read.gsub(VERSION_REGEXP) do
|
50
|
+
livecheck = livechecks_by_name[Regexp.last_match[1].downcase]
|
51
|
+
"#{livecheck.name.upcase}_VER := #{livecheck.latest_version}"
|
52
|
+
end
|
53
|
+
write(makefile, content)
|
54
|
+
end
|
55
|
+
|
56
|
+
def makefile
|
57
|
+
FSPath('Makefile')
|
58
|
+
end
|
59
|
+
|
60
|
+
def livechecks
|
61
|
+
@livechecks ||= makefile.read.scan(VERSION_REGEXP).map do |name, version|
|
62
|
+
Livecheck.new(name.downcase, version)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def livechecks_by_name
|
67
|
+
@livechecks_by_name ||= Hash[livechecks.map{ |lc| [lc.name, lc] }]
|
68
|
+
end
|
69
|
+
|
70
|
+
def changelog_entry
|
71
|
+
github_user = `git config github.user`.strip
|
72
|
+
changed = livechecks.select(&:changed?)
|
73
|
+
%W[
|
74
|
+
*
|
75
|
+
#{to_sentence(changed.map(&:name_n_latest_version))}
|
76
|
+
[@#{github_user}](https://github.com/#{github_user})
|
77
|
+
].join(' ') + "\n"
|
78
|
+
end
|
13
79
|
|
14
|
-
|
15
|
-
|
80
|
+
def to_sentence(array)
|
81
|
+
case array.length
|
82
|
+
when 0 then ''
|
83
|
+
when 1 then array[0].to_s
|
84
|
+
else "#{array[0...-1].join(', ')} and #{array[-1]}"
|
85
|
+
end
|
86
|
+
end
|
16
87
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
88
|
+
def write(path, data)
|
89
|
+
path.temp_file(path.dirname) do |io|
|
90
|
+
io.write data
|
91
|
+
io.path.rename(path)
|
92
|
+
end
|
93
|
+
warn "Wrote #{path}"
|
23
94
|
end
|
24
95
|
end
|
25
96
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
97
|
+
# Compare versions including libjpeg ones (9b <=> 9)
|
98
|
+
class Version
|
99
|
+
include Comparable
|
100
|
+
|
101
|
+
attr_reader :string, :parsed
|
102
|
+
alias_method :to_s, :string
|
103
|
+
|
104
|
+
def initialize(string)
|
105
|
+
@string = string
|
106
|
+
@parsed = begin
|
107
|
+
Gem::Version.new(string)
|
108
|
+
rescue ArgumentError
|
109
|
+
nil
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def <=>(other)
|
114
|
+
if parsed && other.parsed
|
115
|
+
parsed <=> other.parsed
|
116
|
+
else
|
117
|
+
string <=> other.string
|
118
|
+
end
|
31
119
|
end
|
32
120
|
end
|
33
|
-
end
|
34
121
|
|
35
|
-
|
122
|
+
CONFIG = YAML.load(DATA).freeze
|
36
123
|
|
37
|
-
|
38
|
-
abort 'expected project name and optional current version'
|
39
|
-
end
|
124
|
+
attr_reader :name, :current_version
|
40
125
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
126
|
+
def initialize(name, current_version)
|
127
|
+
@name = name
|
128
|
+
@current_version = Version.new(current_version)
|
129
|
+
@fetcher = Thread.new{ fetch_versions.last }
|
130
|
+
end
|
131
|
+
|
132
|
+
def latest_version
|
133
|
+
@fetcher.value
|
134
|
+
end
|
44
135
|
|
45
|
-
def
|
46
|
-
|
136
|
+
def changed?
|
137
|
+
latest_version != current_version
|
138
|
+
end
|
47
139
|
|
48
|
-
|
49
|
-
|
140
|
+
def name_n_latest_version
|
141
|
+
"#{name} #{latest_version}"
|
142
|
+
end
|
50
143
|
|
51
|
-
|
52
|
-
http.request(request).body
|
53
|
-
end
|
144
|
+
private
|
54
145
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
146
|
+
def config
|
147
|
+
CONFIG[name] || fail(ArgumentError, "Livecheck for #{name} not defined")
|
148
|
+
end
|
149
|
+
|
150
|
+
def get(url)
|
151
|
+
uri = URI(url)
|
152
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
153
|
+
http.use_ssl = (uri.scheme == 'https')
|
154
|
+
http.request_get(uri.request_uri).body
|
155
|
+
end
|
156
|
+
|
157
|
+
def fetch_versions
|
158
|
+
body = get(config['url'])
|
159
|
+
|
160
|
+
version_regex = Regexp.new(config['regexp'])
|
161
|
+
|
162
|
+
versions = body.scan(version_regex).map{ |match| Version.new(*match) }.sort
|
163
|
+
fail "No versions found for #{name} in body:\n#{body}" if versions.empty?
|
164
|
+
|
165
|
+
versions
|
75
166
|
end
|
76
|
-
else
|
77
|
-
puts "#{name} #{latest_version}"
|
78
167
|
end
|
79
168
|
|
169
|
+
Livecheck::Cli.new(ARGV).run
|
170
|
+
|
80
171
|
__END__
|
81
172
|
advancecomp:
|
82
173
|
url: https://github.com/amadvance/advancecomp/releases.atom
|
data/vendor/linux-i686/pngcrush
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_optim_pack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0.
|
4
|
+
version: 0.5.0.20170831
|
5
5
|
platform: x86-linux
|
6
6
|
authors:
|
7
7
|
- Ivan Kuchin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: image_optim
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- lib/image_optim_pack.rb
|
136
136
|
- script/livecheck
|
137
137
|
- script/run
|
138
|
-
- script/update_versions
|
139
138
|
- spec/image_optim/pack_spec.rb
|
140
139
|
- spec/image_optim_spec.rb
|
141
140
|
- spec/spec_helper.rb
|
data/script/update_versions
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Feed Makefile to this script to set all variables XXX_VER to latest versions
|
4
|
-
|
5
|
-
ARGF.map do |line|
|
6
|
-
if (name = line[/^([A-Z]+)_VER *:= *.*/, 1])
|
7
|
-
Thread.new do
|
8
|
-
version = `script/livecheck --bare #{name}`.strip
|
9
|
-
abort unless $?.success?
|
10
|
-
"#{name}_VER := #{version}\n"
|
11
|
-
end
|
12
|
-
else
|
13
|
-
line
|
14
|
-
end
|
15
|
-
end.each do |out|
|
16
|
-
if out.respond_to?(:value)
|
17
|
-
$stderr << out.value unless $stdout.tty?
|
18
|
-
$stdout << out.value
|
19
|
-
else
|
20
|
-
$stdout << out
|
21
|
-
end
|
22
|
-
end
|