class Yarn < Formula desc "JavaScript package manager" homepage "https://yarnpkg.com/" url "https://yarnpkg.com/downloads/1.0.2/yarn-v1.0.2.tar.gz" sha256 "8a31f8fa50ab6d5f8852025fb0ea4a50f2f8b82792f060fa99de0acc370b0698" bottle :unneeded depends_on "node" => :recommended def install libexec.install Dir["*"] (bin/"yarn").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX (bin/"yarnpkg").write_env_script "#{libexec}/bin/yarn.js", :PREFIX => HOMEBREW_PREFIX inreplace "#{libexec}/package.json", '"installationMethod": "tar"', '"installationMethod": "homebrew"' end test do (testpath/"package.json").write('{"name": "test"}') system bin/"yarn", "add", "jquery" end end