Skip to content

Instantly share code, notes, and snippets.

@chrmoritz
Last active June 13, 2018 01:27
Show Gist options
  • Select an option

  • Save chrmoritz/0a4f37d0b3e8f52e3243f3c0c89bf8a6 to your computer and use it in GitHub Desktop.

Select an option

Save chrmoritz/0a4f37d0b3e8f52e3243f3c0c89bf8a6 to your computer and use it in GitHub Desktop.
require "language/node"
class ImageoptimCli < Formula
desc "CLI for ImageOptim, ImageAlpha and JPEGmini"
homepage "https://jamiemason.github.io/ImageOptim-CLI/"
url "https://github.com/JamieMason/ImageOptim-CLI/archive/2.0.2.tar.gz"
sha256 "65ccf26cf45012e20877bf7985b1f9d99cfef4ac3d0f1209dd6fa04ef02056ff"
depends_on "node" => :build
def install
inreplace "package.json" do |s|
s.gsub! "\"imageoptim\": \"dist/imageoptim\"", "\"imageoptim\": \"dist/imageoptim.js\""
s.gsub! "\"build:ts\": \"tsc --project .\"", "\"prepare\": \"tsc --project .\""
end
system "npm", "install", *Language::Node.std_npm_install_args(libexec, prepare_required: true)
bin.install_symlink Dir["#{libexec}/bin/*"]
inreplace libexec/"lib/node_modules/imageoptim-cli/dist/imageoptim.js", "\"use strict\";", "#!/usr/bin/env node\n\"use strict\";"
end
test do
assert_match version.to_s, shell_output("#{bin}/imageoptim -V")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment