├── .github ├── dependabot.yml └── workflows │ └── update.yml ├── Abstract └── abstract-tideways-php-extension.rb ├── Formula ├── tideways-cli.rb ├── tideways-daemon.rb ├── tideways-php@8.0.rb ├── tideways-php@8.1.rb ├── tideways-php@8.2.rb ├── tideways-php@8.3.rb └── tideways-php@8.4.rb ├── README.md └── scripts └── update_formula.php /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | day: "wednesday" 8 | time: "12:00" 9 | -------------------------------------------------------------------------------- /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: Update 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | paths: 8 | - '.github/**' 9 | schedule: 10 | - cron: "0 11 * * *" 11 | workflow_dispatch: 12 | 13 | permissions: 14 | contents: write 15 | 16 | jobs: 17 | update: 18 | name: Update Versions 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | fetch-depth: 0 24 | - uses: actions/setup-go@v5 25 | with: 26 | cache: false 27 | - name: Run scripts/update_formula.php 28 | run: php scripts/update_formula.php 29 | - name: Commit changes. 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | run: | 33 | set -x 34 | 35 | go install github.com/planetscale/ghcommit@latest 36 | 37 | if ! git diff --quiet Formula/tideways-php@*; then 38 | changed_files=() 39 | for f in Formula/tideways-php@*; do 40 | changed_files+=(--add "$f") 41 | done 42 | ghcommit -r ${{ github.repository }} \ 43 | -b master \ 44 | "${changed_files[@]}" \ 45 | --message "Update to tideways-php $(awk '$1 == "version"{gsub(/"/,"",$2); print $2}' ${changed_files[1]})" 46 | git pull --autostash 47 | fi 48 | 49 | if ! git diff --quiet Formula/tideways-daemon.rb; then 50 | ghcommit -r ${{ github.repository }} \ 51 | -b master \ 52 | --add Formula/tideways-daemon.rb \ 53 | --message "Update to tideways-daemon $(awk '$1 == "version"{gsub(/"/,"",$2); print $2}' Formula/tideways-daemon.rb)" 54 | git pull --autostash 55 | fi 56 | 57 | if ! git diff --quiet Formula/tideways-cli.rb; then 58 | ghcommit -r ${{ github.repository }} \ 59 | -b master \ 60 | --add Formula/tideways-cli.rb \ 61 | --message "Update to tideways-cli $(awk '$1 == "version"{gsub(/"/,"",$2); print $2}' Formula/tideways-cli.rb)" 62 | git pull --autostash 63 | fi 64 | -------------------------------------------------------------------------------- /Abstract/abstract-tideways-php-extension.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | # https://raw.githubusercontent.com/shivammathur/homebrew-extensions/master/Abstract/abstract-php-extension.rb 4 | 5 | # Abstract class for PHP extensions 6 | class AbstractTidewaysPhpExtension < Formula 7 | desc "Tideways PHP Profiler Extension" 8 | homepage 'https://tideways.com' 9 | 10 | def initialize(name, path, spec, alias_path: nil, tap: nil, force_bottle: false) 11 | super 12 | @priority = self.class.priority || "20" 13 | end 14 | 15 | def caveats 16 | <<~EOS 17 | To finish installing #{extension} for PHP #{php_version}: 18 | * #{config_filepath} was created," 19 | do not forget to remove it upon extension removal." 20 | * Validate installation by running php -m 21 | EOS 22 | end 23 | 24 | test do 25 | output = shell_output("#{Formula[php_formula].opt_bin}/php -m").downcase 26 | assert_match(/#{extension.downcase}/, output, "failed to find extension in php -m output") 27 | end 28 | 29 | private 30 | 31 | attr_reader :priority 32 | 33 | delegate [:php_version, :extension] => :"self.class" 34 | 35 | def module_path 36 | opt_prefix / "#{extension}-php-#{php_version}.so" 37 | end 38 | 39 | def config_file_content 40 | <<~EOS 41 | ; See https://support.tideways.com/documentation/setup/configuration/configure-tideways-globally-via-php-ini.html 42 | extension="#{module_path}" 43 | tideways.api_key= 44 | tideways.connection=tcp://127.0.0.1:9135 45 | 46 | ; This setting is used if the current project is a "Profiling Space", disabling any monitoring. 47 | tideways.monitor=none 48 | EOS 49 | rescue error 50 | raise error 51 | end 52 | 53 | def config_scandir_path 54 | etc / "php" / php_version / "conf.d" 55 | end 56 | 57 | def config_filepath 58 | config_scandir_path / "#{priority}-#{extension}.ini" 59 | end 60 | 61 | def write_config_file 62 | Dir[config_scandir_path / "*#{extension}*.ini"].each do |ini_file| 63 | rm ini_file 64 | end 65 | config_scandir_path.mkpath 66 | config_filepath.write(config_file_content) 67 | end 68 | 69 | class << self 70 | attr_reader :php_version, :extension 71 | 72 | attr_accessor :priority 73 | 74 | def parse_extension(matches) 75 | @extension = matches[1].downcase if matches 76 | @extension.gsub("pecl", "").gsub("pdo", "pdo_").gsub("xdebug2", "xdebug").gsub(/phalcon\d+/, "phalcon") 77 | end 78 | 79 | def init 80 | class_name = name.split("::").last 81 | matches = /(\w+)AT(\d)(\d)/.match(class_name) 82 | @extension = "tideways" 83 | @php_version = "#{matches[2]}.#{matches[3]}" if matches 84 | end 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /Formula/tideways-cli.rb: -------------------------------------------------------------------------------- 1 | require "formula" 2 | 3 | class TidewaysCli < Formula 4 | homepage 'https://tideways.com' 5 | version "1.2.10" 6 | checksum = { 7 | "macos-arm64" => "c6cb5373ccb4dee5a6377dce8bc87bce6a0c9b85ed63c925ded68b95a2426269", 8 | "macos-amd64" => "0792bb0af055752a6045f3d7c58ada3c86709305bf9319643e6683132d5c3ae1", 9 | "linux-arm64" => "6bfd07eb83522591b68b1242782029d520ffda5e871824f5a040934ac81fbb61", 10 | "linux-amd64" => "7545b05fed2b0d071efc0925ac153800b4529876c19db4101a552d7caf85a1e8", 11 | } 12 | 13 | if OS.linux? 14 | os = "linux" 15 | arch = Hardware::CPU.arm? ? "arm64" : "amd64" 16 | else 17 | os = "macos" 18 | arch = Hardware::CPU.arm? ? "arm64" : "amd64" 19 | end 20 | 21 | url "https://tideways.s3.amazonaws.com/cli/#{version}/tideways-cli_#{os}_#{arch}-#{version}.tar.gz" 22 | sha256 checksum["#{os}-#{arch}"] 23 | 24 | def install 25 | bin.install "tideways" 26 | end 27 | 28 | test do 29 | system opt_bin/"tideways", "version" 30 | end 31 | 32 | def caveats 33 | return <<~EOS 34 | Follow the instructions on Tideways Profiler website 35 | to import your application settings: 36 | 37 | https://app.tideways.io/user/cli-import-settings 38 | EOS 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /Formula/tideways-daemon.rb: -------------------------------------------------------------------------------- 1 | require "formula" 2 | 3 | class TidewaysDaemon < Formula 4 | homepage 'https://tideways.com' 5 | version "1.9.40" 6 | checksum = { 7 | "macos-arm64" => "69bed9014607e049ba2ae13f56554b22d7f7374c8cbc846e2677fbbce1831ac6", 8 | "macos-amd64" => "8b97de3104434bc1c65dbff618d02765abd0c2aeb7d7e6f9794df8f4958fb260", 9 | "linux-aarch64" => "d98ab61ef42804f3c3bc4c993e3c324e38dcfdb6f8fb33abc249ea1d49d9b237", 10 | "linux-amd64" => "e94e95abdd3cb49991e09cd995b2bfaa395f0a5fe25ab08838936f521d17bda8", 11 | } 12 | 13 | if OS.linux? 14 | os = "linux" 15 | arch = Hardware::CPU.arm? ? "aarch64" : "amd64" 16 | else 17 | os = "macos" 18 | arch = Hardware::CPU.arm? ? "arm64" : "amd64" 19 | end 20 | 21 | url "https://tideways.s3.amazonaws.com/daemon/#{version}/tideways-daemon_#{os}_#{arch}-#{version}.tar.gz" 22 | sha256 checksum["#{os}-#{arch}"] 23 | 24 | def install 25 | bin.install 'tideways-daemon' 26 | end 27 | 28 | def post_install 29 | (var/"log/tideways").mkpath 30 | end 31 | 32 | service do 33 | run [opt_bin/"tideways-daemon", "--address", "127.0.0.1:9135", "--env", "development"] 34 | log_path var/"log/tideways/daemon.log" 35 | end 36 | 37 | test do 38 | system opt_bin/"tideways-daemon", "-version" 39 | end 40 | 41 | def caveats 42 | <<~EOS 43 | 44 | Please contact support@tideways.com if you have problems setting up the daemon. 45 | 46 | EOS 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /Formula/tideways-php@8.0.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require File.expand_path("../Abstract/abstract-tideways-php-extension", __dir__) 5 | 6 | class TidewaysPhpAT80 < AbstractTidewaysPhpExtension 7 | init 8 | version "5.23.0" 9 | checksum = { 10 | "macos-arm" => "a605346d2527a9d6228d760941c247d205883e74be59cd3ebcc05abe6a142694", 11 | "macos-x86" => "8963bcfebc57db1bc47c29d9bf0ce5ef7ba108f58662bfa21338584991bd992e", 12 | "arm64" => "0fe80484fed8bb653c0208bb4ec581e0874ee56ac4977268f57da5d3b0bf5b34", 13 | "x86_64" => "4510db3758273237b1cef450b76d7d0a2152a7a0c3bde5c1f208706a3a70d866", 14 | } 15 | 16 | if OS.linux? 17 | os = "" 18 | arch = Hardware::CPU.arm? ? "arm64" : "x86_64" 19 | else 20 | os = "macos-" 21 | arch = Hardware::CPU.arm? ? "arm" : "x86" 22 | end 23 | 24 | url "https://tideways.s3.amazonaws.com/extension/#{version}/tideways-php-#{version}-#{os}#{arch}.tar.gz" 25 | sha256 checksum["#{os}#{arch}"] 26 | 27 | def install 28 | prefix.install "tideways-php-#{php_version}.so" 29 | write_config_file 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /Formula/tideways-php@8.1.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require File.expand_path("../Abstract/abstract-tideways-php-extension", __dir__) 5 | 6 | class TidewaysPhpAT81 < AbstractTidewaysPhpExtension 7 | init 8 | version "5.23.0" 9 | checksum = { 10 | "macos-arm" => "a605346d2527a9d6228d760941c247d205883e74be59cd3ebcc05abe6a142694", 11 | "macos-x86" => "8963bcfebc57db1bc47c29d9bf0ce5ef7ba108f58662bfa21338584991bd992e", 12 | "arm64" => "0fe80484fed8bb653c0208bb4ec581e0874ee56ac4977268f57da5d3b0bf5b34", 13 | "x86_64" => "4510db3758273237b1cef450b76d7d0a2152a7a0c3bde5c1f208706a3a70d866", 14 | } 15 | 16 | if OS.linux? 17 | os = "" 18 | arch = Hardware::CPU.arm? ? "arm64" : "x86_64" 19 | else 20 | os = "macos-" 21 | arch = Hardware::CPU.arm? ? "arm" : "x86" 22 | end 23 | 24 | url "https://tideways.s3.amazonaws.com/extension/#{version}/tideways-php-#{version}-#{os}#{arch}.tar.gz" 25 | sha256 checksum["#{os}#{arch}"] 26 | 27 | def install 28 | prefix.install "tideways-php-#{php_version}.so" 29 | write_config_file 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /Formula/tideways-php@8.2.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require File.expand_path("../Abstract/abstract-tideways-php-extension", __dir__) 5 | 6 | class TidewaysPhpAT82 < AbstractTidewaysPhpExtension 7 | init 8 | version "5.23.0" 9 | checksum = { 10 | "macos-arm" => "a605346d2527a9d6228d760941c247d205883e74be59cd3ebcc05abe6a142694", 11 | "macos-x86" => "8963bcfebc57db1bc47c29d9bf0ce5ef7ba108f58662bfa21338584991bd992e", 12 | "arm64" => "0fe80484fed8bb653c0208bb4ec581e0874ee56ac4977268f57da5d3b0bf5b34", 13 | "x86_64" => "4510db3758273237b1cef450b76d7d0a2152a7a0c3bde5c1f208706a3a70d866", 14 | } 15 | 16 | if OS.linux? 17 | os = "" 18 | arch = Hardware::CPU.arm? ? "arm64" : "x86_64" 19 | else 20 | os = "macos-" 21 | arch = Hardware::CPU.arm? ? "arm" : "x86" 22 | end 23 | 24 | url "https://tideways.s3.amazonaws.com/extension/#{version}/tideways-php-#{version}-#{os}#{arch}.tar.gz" 25 | sha256 checksum["#{os}#{arch}"] 26 | 27 | def install 28 | prefix.install "tideways-php-#{php_version}.so" 29 | write_config_file 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /Formula/tideways-php@8.3.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require File.expand_path("../Abstract/abstract-tideways-php-extension", __dir__) 5 | 6 | class TidewaysPhpAT83 < AbstractTidewaysPhpExtension 7 | init 8 | version "5.23.0" 9 | checksum = { 10 | "macos-arm" => "a605346d2527a9d6228d760941c247d205883e74be59cd3ebcc05abe6a142694", 11 | "macos-x86" => "8963bcfebc57db1bc47c29d9bf0ce5ef7ba108f58662bfa21338584991bd992e", 12 | "arm64" => "0fe80484fed8bb653c0208bb4ec581e0874ee56ac4977268f57da5d3b0bf5b34", 13 | "x86_64" => "4510db3758273237b1cef450b76d7d0a2152a7a0c3bde5c1f208706a3a70d866", 14 | } 15 | 16 | if OS.linux? 17 | os = "" 18 | arch = Hardware::CPU.arm? ? "arm64" : "x86_64" 19 | else 20 | os = "macos-" 21 | arch = Hardware::CPU.arm? ? "arm" : "x86" 22 | end 23 | 24 | url "https://tideways.s3.amazonaws.com/extension/#{version}/tideways-php-#{version}-#{os}#{arch}.tar.gz" 25 | sha256 checksum["#{os}#{arch}"] 26 | 27 | def install 28 | prefix.install "tideways-php-#{php_version}.so" 29 | write_config_file 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /Formula/tideways-php@8.4.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require File.expand_path("../Abstract/abstract-tideways-php-extension", __dir__) 5 | 6 | class TidewaysPhpAT84 < AbstractTidewaysPhpExtension 7 | init 8 | version "5.23.0" 9 | checksum = { 10 | "macos-arm" => "a605346d2527a9d6228d760941c247d205883e74be59cd3ebcc05abe6a142694", 11 | "macos-x86" => "8963bcfebc57db1bc47c29d9bf0ce5ef7ba108f58662bfa21338584991bd992e", 12 | "arm64" => "0fe80484fed8bb653c0208bb4ec581e0874ee56ac4977268f57da5d3b0bf5b34", 13 | "x86_64" => "4510db3758273237b1cef450b76d7d0a2152a7a0c3bde5c1f208706a3a70d866", 14 | } 15 | 16 | if OS.linux? 17 | os = "" 18 | arch = Hardware::CPU.arm? ? "arm64" : "x86_64" 19 | else 20 | os = "macos-" 21 | arch = Hardware::CPU.arm? ? "arm" : "x86" 22 | end 23 | 24 | url "https://tideways.s3.amazonaws.com/extension/#{version}/tideways-php-#{version}-#{os}#{arch}.tar.gz" 25 | sha256 checksum["#{os}#{arch}"] 26 | 27 | def install 28 | prefix.install "tideways-php-#{php_version}.so" 29 | write_config_file 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Homebrew Formulas for Tideways Profiler 2 | 3 | With this repository you can install the Tideways Profiler Daemon, Commandline-Tool and PHP Extension via Homebrew. 4 | 5 | > **Warning:** This only works with homebrew PHP installations for now. 6 | 7 | 1. Tap this repository 8 | 9 | brew tap tideways/homebrew-profiler 10 | 11 | 2. Install PHP Extension (if you have `homebrew-php`) 12 | 13 | brew install tideways-php@8.0 14 | brew install tideways-php@8.1 15 | brew install tideways-php@8.2 16 | brew install tideways-php@8.3 17 | 18 | 4. Install Daemon 19 | 20 | brew install tideways-daemon 21 | 22 | 5. Install Commandline Tool 23 | 24 | brew install tideways-cli 25 | 26 | ## Feedback: Help us improve Installation 27 | 28 | If using this homebrew recipe is at any point complicated for you or not 29 | intuitive that is our mistake. Please help us improve installation by sending 30 | notes to [support@tideways.com](mailto:support@tideways.com). 31 | 32 | ## Acknowledgements 33 | 34 | This work is based on [homebrew-php](https://github.com/Homebrew/homebrew-php) 35 | and [shivamathur/homebrew-extensins](https://github.com/shivammathur/homebrew-extensions) 36 | and uses parts of their codebase to work with different PHP versions. 37 | 38 | ## License 39 | 40 | Covers code in this repository only: https://github.com/tideways/homebrew-profiler 41 | 42 | Copyright (c) 2014-2023 Tideways GmbH 43 | 44 | Permission is hereby granted, free of charge, to any person obtaining a copy of 45 | this software and associated documentation files (the "Software"), to deal in 46 | the Software without restriction, including without limitation the rights to 47 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 48 | of the Software, and to permit persons to whom the Software is furnished to do 49 | so, subject to the following conditions: 50 | 51 | The above copyright notice and this permission notice shall be included in all 52 | copies or substantial portions of the Software. 53 | 54 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 55 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 56 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 57 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 58 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 59 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 60 | SOFTWARE. 61 | -------------------------------------------------------------------------------- /scripts/update_formula.php: -------------------------------------------------------------------------------- 1 | "{$hashMacosArm}", 36 | "macos-x86" => "{$hashMacosX86}", 37 | "arm64" => "{$hashLinuxArm64}", 38 | "x86_64" => "{$hashLinuxX86_64}", 39 | } 40 | 41 | if OS.linux? 42 | os = "" 43 | arch = Hardware::CPU.arm? ? "arm64" : "x86_64" 44 | else 45 | os = "macos-" 46 | arch = Hardware::CPU.arm? ? "arm" : "x86" 47 | end 48 | 49 | url "https://tideways.s3.amazonaws.com/extension/#{version}/tideways-php-#{version}-#{os}#{arch}.tar.gz" 50 | sha256 checksum["#{os}#{arch}"] 51 | 52 | def install 53 | prefix.install "tideways-php-#{php_version}.so" 54 | write_config_file 55 | end 56 | end 57 | 58 | FORMULA, 59 | ); 60 | } 61 | 62 | echo "tideways-daemon", PHP_EOL; 63 | $daemonVersion = $currentVersions['daemon']['version'] ?? throw new RuntimeException("Current Tideways extension version not found in current versions payload."); 64 | $hashMacosArm64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/daemon/{$daemonVersion}/tideways-daemon_macos_arm64-{$daemonVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine macOS ARM64 hash."); 65 | $hashMacosAmd64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/daemon/{$daemonVersion}/tideways-daemon_macos_amd64-{$daemonVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine macOS AMD64 hash."); 66 | $hashLinuxAarch64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/daemon/{$daemonVersion}/tideways-daemon_linux_aarch64-{$daemonVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine Linux aarch64 hash."); 67 | $hashLinuxAmd64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/daemon/{$daemonVersion}/tideways-daemon_linux_amd64-{$daemonVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine Linux AMD64 hash."); 68 | 69 | file_put_contents( 70 | __DIR__ . '/../Formula/tideways-daemon.rb', 71 | << "{$hashMacosArm64}", 79 | "macos-amd64" => "{$hashMacosAmd64}", 80 | "linux-aarch64" => "{$hashLinuxAarch64}", 81 | "linux-amd64" => "{$hashLinuxAmd64}", 82 | } 83 | 84 | if OS.linux? 85 | os = "linux" 86 | arch = Hardware::CPU.arm? ? "aarch64" : "amd64" 87 | else 88 | os = "macos" 89 | arch = Hardware::CPU.arm? ? "arm64" : "amd64" 90 | end 91 | 92 | url "https://tideways.s3.amazonaws.com/daemon/#{version}/tideways-daemon_#{os}_#{arch}-#{version}.tar.gz" 93 | sha256 checksum["#{os}-#{arch}"] 94 | 95 | def install 96 | bin.install 'tideways-daemon' 97 | end 98 | 99 | def post_install 100 | (var/"log/tideways").mkpath 101 | end 102 | 103 | service do 104 | run [opt_bin/"tideways-daemon", "--address", "127.0.0.1:9135", "--env", "development"] 105 | log_path var/"log/tideways/daemon.log" 106 | end 107 | 108 | test do 109 | system opt_bin/"tideways-daemon", "-version" 110 | end 111 | 112 | def caveats 113 | <<~EOS 114 | 115 | Please contact support@tideways.com if you have problems setting up the daemon. 116 | 117 | EOS 118 | end 119 | end 120 | 121 | FORMULA, 122 | ); 123 | 124 | 125 | echo "tideways-cli", PHP_EOL; 126 | $cliVersion = $currentVersions['cli']['version'] ?? throw new RuntimeException("Current Tideways extension version not found in current versions payload."); 127 | $hashMacosArm64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/cli/{$cliVersion}/tideways-cli_macos_arm64-{$cliVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine macOS ARM64 hash."); 128 | $hashMacosAmd64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/cli/{$cliVersion}/tideways-cli_macos_amd64-{$cliVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine macOS AMD64 hash."); 129 | $hashLinuxArm64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/cli/{$cliVersion}/tideways-cli_linux_arm64-{$cliVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine Linux ARM64 hash."); 130 | $hashLinuxAmd64 = hash_file('sha256', "https://tideways.s3.amazonaws.com/cli/{$cliVersion}/tideways-cli_linux_amd64-{$cliVersion}.tar.gz") ?: throw new RuntimeException("Failed to determine Linux AMD64 hash."); 131 | 132 | file_put_contents( 133 | __DIR__ . '/../Formula/tideways-cli.rb', 134 | << "{$hashMacosArm64}", 142 | "macos-amd64" => "{$hashMacosAmd64}", 143 | "linux-arm64" => "{$hashLinuxArm64}", 144 | "linux-amd64" => "{$hashLinuxAmd64}", 145 | } 146 | 147 | if OS.linux? 148 | os = "linux" 149 | arch = Hardware::CPU.arm? ? "arm64" : "amd64" 150 | else 151 | os = "macos" 152 | arch = Hardware::CPU.arm? ? "arm64" : "amd64" 153 | end 154 | 155 | url "https://tideways.s3.amazonaws.com/cli/#{version}/tideways-cli_#{os}_#{arch}-#{version}.tar.gz" 156 | sha256 checksum["#{os}-#{arch}"] 157 | 158 | def install 159 | bin.install "tideways" 160 | end 161 | 162 | test do 163 | system opt_bin/"tideways", "version" 164 | end 165 | 166 | def caveats 167 | return <<~EOS 168 | Follow the instructions on Tideways Profiler website 169 | to import your application settings: 170 | 171 | https://app.tideways.io/user/cli-import-settings 172 | EOS 173 | end 174 | end 175 | 176 | FORMULA, 177 | ); 178 | --------------------------------------------------------------------------------