Skip to content

Commit

Permalink
correct environment variable to specify jpeg-recompress location
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Feb 26, 2025
1 parent bc0582f commit 5532416
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 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

* Correct environment variable to specify `jpeg-recompress` location [@toy](https://github.com/toy)

## v0.31.4 (2024-11-19)

* Added `--svgo-allow-lossy` and `--svgo-precision` options to use svgo in lossy mode. This sets svgo `--precision`, which can result in substantially smaller svgs (see [#211](https://github.com/toy/image_optim/issues/211) for some experiments). Lower values are more lossy. 3 is the default, but many SVGs will work well even with 0 or 1. Like all worker specific lossy flags, this is also enabled with `--allow-lossy`. [#210](https://github.com/toy/image_optim/issues/210) [#211](https://github.com/toy/image_optim/issues/211) [@gurgeous](https://github.com/gurgeous)
Expand Down
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Simplest way for `image_optim` to locate binaries is to install them in common l

If you cannot install to common location, then install to custom one and add it to `PATH`.

Specify custom bin location using `XXX_BIN` environment variable (`JPEGOPTIM_BIN`, `OPTIPNG_BIN`, …).
Specify custom bin location using `XXX_BIN` environment variable (`JPEGOPTIM_BIN`, `OPTIPNG_BIN`, `JPEG_RECOMPRESS_BIN`, …).

Besides permanently setting environment variables in `~/.profile`, `~/.bash_profile`, `~/.bashrc`, `~/.zshrc`, … they can be set:

Expand Down
2 changes: 1 addition & 1 deletion lib/image_optim/bin_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def resolving(name)
# Check path in XXX_BIN to exist, be a file and be executable and symlink to
# dir as name
def symlink_custom_bin!(name)
env_name = "#{name}_bin".upcase
env_name = "#{name.to_s.tr('-', '_').upcase}_BIN"
path = ENV.fetch(env_name, nil)
return unless path

Expand Down
6 changes: 3 additions & 3 deletions spec/image_optim/bin_resolver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ def self.path
expect(FSPath).to receive(:temp_dir).
once.and_return(tmpdir)
expect(tmpdir).to receive(:/).
with(:the_optimizer).once.and_return(symlink)
with(:'the-optimizer').once.and_return(symlink)
expect(symlink).to receive(:make_symlink).
with(File.expand_path(path)).once

expect(resolver).not_to receive(:full_path)
bin = double
expect(Bin).to receive(:new).
with(:the_optimizer, File.expand_path(path)).and_return(bin)
with(:'the-optimizer', File.expand_path(path)).and_return(bin)
expect(bin).to receive(:check!).once
expect(bin).to receive(:check_fail!).exactly(5).times

Expand All @@ -160,7 +160,7 @@ def self.path
end

5.times do
resolver.resolve!(:the_optimizer)
resolver.resolve!(:'the-optimizer')
end
expect(resolver.env_path).to eq([
tmpdir,
Expand Down

0 comments on commit 5532416

Please sign in to comment.