Merge pull request #207020 from Homebrew/bump-qpdf-11.10.0
[Homebrew/homebrew-core.git] / Formula / w / web-ext.rb
bloba1d2181b1792e91796108ca230fe13d1560a605d
1 class WebExt < Formula
2   desc "Command-line tool to help build, run, and test web extensions"
3   homepage "https://github.com/mozilla/web-ext"
4   url "https://registry.npmjs.org/web-ext/-/web-ext-8.4.0.tgz"
5   sha256 "5dcddeaa63ca25a0cbb2ea641d12691af7f92e816f96d4e0f56daa31150f3e1f"
6   license "MPL-2.0"
8   bottle do
9     sha256 cellar: :any_skip_relocation, arm64_sequoia: "2aa682a7090e03e34a1041b3d9d54ecee870d7406fe7c8a40627fad229003206"
10     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "2aa682a7090e03e34a1041b3d9d54ecee870d7406fe7c8a40627fad229003206"
11     sha256 cellar: :any_skip_relocation, arm64_ventura: "2aa682a7090e03e34a1041b3d9d54ecee870d7406fe7c8a40627fad229003206"
12     sha256 cellar: :any_skip_relocation, sonoma:        "c997242418dc610143bfe3cbc2fa0c5773ab693485af4aa3706eaf6b4ccbe837"
13     sha256 cellar: :any_skip_relocation, ventura:       "c997242418dc610143bfe3cbc2fa0c5773ab693485af4aa3706eaf6b4ccbe837"
14     sha256 cellar: :any_skip_relocation, x86_64_linux:  "679ff6e757ae6af8b40f2ea0ffb6e0feeb05145b9b09f260f5ac4c14e3ddd211"
15   end
17   depends_on "node"
19   on_macos do
20     depends_on "terminal-notifier"
21   end
23   def install
24     system "npm", "install", *std_npm_args
25     bin.install_symlink Dir["#{libexec}/bin/*"]
27     # Remove vendored pre-built binary `terminal-notifier`
28     node_notifier_vendor_dir = libexec/"lib/node_modules/web-ext/node_modules/node-notifier/vendor"
29     rm_r(node_notifier_vendor_dir) # remove vendored pre-built binaries
31     if OS.mac?
32       terminal_notifier_dir = node_notifier_vendor_dir/"mac.noindex"
33       terminal_notifier_dir.mkpath
35       # replace vendored `terminal-notifier` with our own
36       terminal_notifier_app = Formula["terminal-notifier"].opt_prefix/"terminal-notifier.app"
37       ln_sf terminal_notifier_app.relative_path_from(terminal_notifier_dir), terminal_notifier_dir
38     end
39   end
41   test do
42     (testpath/"manifest.json").write <<~JSON
43       {
44         "manifest_version": 2,
45         "name": "minimal web extension",
46         "version": "0.0.1"
47       }
48     JSON
49     assert_equal <<~EOF, shell_output("#{bin}/web-ext lint").gsub(/ +$/, "")
50       Validation Summary:
52       errors          0
53       notices         0
54       warnings        0
56     EOF
58     assert_match version.to_s, shell_output("#{bin}/web-ext --version")
59   end
60 end