Skip to content

Commit

Permalink
use first 8 characters of sha1 hex for jpegrescan version, closes #131
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Mar 17, 2016
1 parent de0cbf7 commit 168b74b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## unreleased

* Use first 8 characters of sha1 hex for jpegrescan version [#131](https://github.com/toy/image_optim/issues/131) [@toy](https://github.com/toy)

## v0.22.1 (2016-02-21)

* Fix missing old (1.x) `pngquant` version as it was output to stderr [#123](https://github.com/toy/image_optim/issues/123) [@toy](https://github.com/toy)
Expand Down
5 changes: 3 additions & 2 deletions lib/image_optim/bin_resolver/bin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'image_optim/bin_resolver/comparable_condition'
require 'image_optim/cmd'
require 'shellwords'
require 'digest/sha1'

class ImageOptim
class BinResolver
Expand Down Expand Up @@ -87,8 +88,8 @@ def version_string
date_str = capture("#{escaped_path} 2>&1")[date_regexp]
Date.parse(date_str).strftime('%Y%m%d') if date_str
when :jpegrescan
# jpegrescan has no version so just check presence
path && '-'
# jpegrescan has no version so use first 8 characters of sha1 hex
Digest::SHA1.file(path).hexdigest[0, 8] if path
else
fail "getting `#{name}` version is not defined"
end
Expand Down

0 comments on commit 168b74b

Please sign in to comment.