|
1 | | -# typed: false |
2 | | -# frozen_string_literal: true |
3 | | - |
4 | | -# This file was generated by GoReleaser. DO NOT EDIT. |
5 | 1 | class Odict < Formula |
6 | | - desc "A lightning-fast dictionary compiler and toolchain" |
7 | | - homepage "https://odict.org/" |
8 | | - version "1.23.0" |
9 | | - |
10 | | - on_macos do |
| 2 | + desc "A lightning-fast dictionary file format and toolchain" |
| 3 | + homepage "https://odict.org" |
| 4 | + version "2.0.0" |
| 5 | + if OS.mac? |
11 | 6 | if Hardware::CPU.arm? |
12 | | - url "https://github.com/TheOpenDictionary/odict/releases/download/v1.23.0/odict_1.23.0_darwin_arm64.tar.gz" |
13 | | - sha256 "aee0be3c2c445e67cd34244b8549600c5c36824f8ee47384e63582059e627119" |
14 | | - |
15 | | - def install |
16 | | - bin.install "odict" |
17 | | - end |
| 7 | + url "https://github.com/TheOpenDictionary/odict/releases/download/cli/v2.0.0/odict-cli-aarch64-apple-darwin.tar.xz" |
| 8 | + sha256 "01d6df2c7c9a5c16b93ecb961c446bcc9732bc8b96b88db95ec31fee6bb9d0b6" |
18 | 9 | end |
19 | 10 | if Hardware::CPU.intel? |
20 | | - url "https://github.com/TheOpenDictionary/odict/releases/download/v1.23.0/odict_1.23.0_darwin_amd64.tar.gz" |
21 | | - sha256 "1d366a640d2074188800554dc7eaed3f9b0752621f268cbbf8f60817442c0d4d" |
22 | | - |
23 | | - def install |
24 | | - bin.install "odict" |
25 | | - end |
| 11 | + url "https://github.com/TheOpenDictionary/odict/releases/download/cli/v2.0.0/odict-cli-x86_64-apple-darwin.tar.xz" |
| 12 | + sha256 "895e5a56a5e62bf53ab0c3fcfd29bcbb87eb779b40156d35e5da2f627b60f898" |
26 | 13 | end |
27 | 14 | end |
| 15 | + if OS.linux? && Hardware::CPU.intel? |
| 16 | + url "https://github.com/TheOpenDictionary/odict/releases/download/cli/v2.0.0/odict-cli-x86_64-unknown-linux-gnu.tar.xz" |
| 17 | + sha256 "eb57f8c39ce4670fb07071ff0a6145d61cf6deabf9fcc3d080814babb3651a04" |
| 18 | + end |
28 | 19 |
|
29 | | - on_linux do |
30 | | - if Hardware::CPU.arm? && Hardware::CPU.is_64_bit? |
31 | | - url "https://github.com/TheOpenDictionary/odict/releases/download/v1.23.0/odict_1.23.0_linux_arm64.tar.gz" |
32 | | - sha256 "304a36a30e8af6f74fbf3e288608b1586d550a580c960ce63c862261cdc809b1" |
| 20 | + BINARY_ALIASES = { |
| 21 | + "aarch64-apple-darwin": {}, |
| 22 | + "x86_64-apple-darwin": {}, |
| 23 | + "x86_64-pc-windows-gnu": {}, |
| 24 | + "x86_64-unknown-linux-gnu": {}, |
| 25 | + "x86_64-unknown-linux-musl-dynamic": {}, |
| 26 | + "x86_64-unknown-linux-musl-static": {}, |
| 27 | + }.freeze |
33 | 28 |
|
34 | | - def install |
35 | | - bin.install "odict" |
36 | | - end |
37 | | - end |
38 | | - if Hardware::CPU.intel? |
39 | | - url "https://github.com/TheOpenDictionary/odict/releases/download/v1.23.0/odict_1.23.0_linux_amd64.tar.gz" |
40 | | - sha256 "4e13fa30998cd2c7ce9bea7b3dd2391e167cc9ff9fdee048bd6677efbb55f1ed" |
| 29 | + def target_triple |
| 30 | + cpu = Hardware::CPU.arm? ? "aarch64" : "x86_64" |
| 31 | + os = OS.mac? ? "apple-darwin" : "unknown-linux-gnu" |
| 32 | + |
| 33 | + "#{cpu}-#{os}" |
| 34 | + end |
41 | 35 |
|
42 | | - def install |
43 | | - bin.install "odict" |
| 36 | + def install_binary_aliases! |
| 37 | + BINARY_ALIASES[target_triple.to_sym].each do |source, dests| |
| 38 | + dests.each do |dest| |
| 39 | + bin.install_symlink bin/source.to_s => dest |
44 | 40 | end |
45 | 41 | end |
46 | 42 | end |
| 43 | + |
| 44 | + def install |
| 45 | + bin.install "odict" if OS.mac? && Hardware::CPU.arm? |
| 46 | + bin.install "odict" if OS.mac? && Hardware::CPU.intel? |
| 47 | + bin.install "odict" if OS.linux? && Hardware::CPU.intel? |
| 48 | + |
| 49 | + install_binary_aliases! |
| 50 | + |
| 51 | + # Homebrew will automatically install these, so we don't need to do that |
| 52 | + doc_files = Dir["README.*", "readme.*", "LICENSE", "LICENSE.*", "CHANGELOG.*"] |
| 53 | + leftover_contents = Dir["*"] - doc_files |
| 54 | + |
| 55 | + # Install any leftover files in pkgshare; these are probably config or |
| 56 | + # sample files. |
| 57 | + pkgshare.install(*leftover_contents) unless leftover_contents.empty? |
| 58 | + end |
47 | 59 | end |
0 commit comments