image_optim_pack 0.5.0.20170830-x86-linux → 0.5.0.20170831-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c654499f9931bbfc7ba823be423162204b3b47cc
4
- data.tar.gz: de7dba97c97cca0c97ef923ba9cf745917d88e29
3
+ metadata.gz: cf137ba453f4eaa3a60a32ea84101f52e1f0df72
4
+ data.tar.gz: be30f652b37c032a230dd21f19c62a7f348241ba
5
5
  SHA512:
6
- metadata.gz: c340308230a7cc43bf6f85bb7dc508089181a31b00a5badfee52627f9f6f8abaf80a1c5347193b690b1a442eec5fc7c6a6a337fe1c4da8992d540d5d2c5cd034
7
- data.tar.gz: de28a7b28bd45635a988853c543baa0ca57f8968427124680889cd146569672049418ea0aa8cdc4e866a50bf0adaa4c1040400007ceebf42c2b16dac68fd87a1
6
+ metadata.gz: 507df70a13c15809148a20a4fc4b75247e348cc71be23c359043c41b8709b90fdd9098f3f78c1870c8effb35fc876b493ea6a00131c2c5f31fd2b416966fa757
7
+ data.tar.gz: 13e67ad3683aeefc958d74d09bdacd105ea8bf39e09e8f92923430176adf80045b641cae6e5794f0061de6f401370803f3327141fd6aa4638c1b6d59c83eb8a6
data/.rubocop.yml CHANGED
@@ -61,9 +61,6 @@ Style/Semicolon:
61
61
  Style/SignalException:
62
62
  EnforcedStyle: semantic
63
63
 
64
- Style/SpecialGlobalVars:
65
- Enabled: false
66
-
67
64
  Style/SymbolArray:
68
65
  Enabled: false
69
66
 
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## unreleased
4
4
 
5
+ ## v0.5.0.20170831 (2017-08-31)
6
+
7
+ * pngcrush 1.8.13 [@toy](https://github.com/toy)
8
+
5
9
  ## v0.5.0.20170830 (2017-08-30)
6
10
 
7
11
  * libpng 1.6.32 [@toy](https://github.com/toy)
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.12
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 :; @$(foreach archive,$(ARCHIVES),script/livecheck $(call downcase,$(archive)) $($(archive)_VER);)
196
+ livecheck :; @script/livecheck
197
197
  .PHONY : livecheck
198
198
 
199
- Makefile.updated :
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 ======
@@ -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.20170830'
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
- # Compare versions including libjpeg ones (9b <=> 9)
11
- class Version
12
- include Comparable
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
- attr_reader :string, :parsed
15
- alias_method :to_s, :string
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
- def initialize(string)
18
- @string = string
19
- @parsed = begin
20
- Gem::Version.new(string)
21
- rescue ArgumentError
22
- nil
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
- def <=>(other)
27
- if parsed && other.parsed
28
- parsed <=> other.parsed
29
- else
30
- string <=> other.string
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
- bare = ARGV.delete('--bare')
122
+ CONFIG = YAML.load(DATA).freeze
36
123
 
37
- unless [1, 2].include?(ARGV.length)
38
- abort 'expected project name and optional current version'
39
- end
124
+ attr_reader :name, :current_version
40
125
 
41
- def version(string)
42
- Version.new(string)
43
- end
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 get(url)
46
- uri = URI(url)
136
+ def changed?
137
+ latest_version != current_version
138
+ end
47
139
 
48
- http = Net::HTTP.new(uri.host, uri.port)
49
- http.use_ssl = (uri.scheme == 'https')
140
+ def name_n_latest_version
141
+ "#{name} #{latest_version}"
142
+ end
50
143
 
51
- request = Net::HTTP::Get.new(uri.request_uri)
52
- http.request(request).body
53
- end
144
+ private
54
145
 
55
- name = ARGV[0].downcase
56
- config = YAML.load(DATA)[name]
57
- abort "Livecheck for #{name} was not defined" unless config
58
-
59
- url = config['url']
60
- version_regex = Regexp.new(config['regexp'])
61
- current_version = ARGV[1] && version(ARGV[1])
62
-
63
- data = get(url)
64
- versions = data.scan(version_regex).uniq.map{ |match| version(match[0]) }
65
- abort "No versions found for #{name} in data:\n#{data}" if versions.empty?
66
-
67
- latest_version = versions.max
68
- case
69
- when bare
70
- print latest_version
71
- when current_version
72
- if latest_version != current_version
73
- sign = latest_version > current_version ? '>' : '<'
74
- puts "#{name} #{latest_version} #{sign} #{current_version}"
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
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.20170830
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-29 00:00:00.000000000 Z
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
@@ -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