amber icon indicating copy to clipboard operation
amber copied to clipboard

Provide Way to Install with Homebrew on macOS

Open ryandanielspmc opened this issue 4 years ago • 4 comments

It would be great to be able to install amber with Homebrew on macOS. Please provide a way to do that.

ryandanielspmc avatar Dec 29 '20 22:12 ryandanielspmc

Homebrew accepts PR through https://github.com/Homebrew/homebrew-core. If you are interesting in Homebrew packaging, could you try to send PR? I can't maintain Homebrew package because I don't use brew and don't have macOS machine.

dalance avatar Dec 30 '20 04:12 dalance

Similarly, Homebrew on Linux support would be quite nice. This is one of the few tools that I have to seek out a binary of when setting up a Linux dev env vs. adding it to a brew install copy paste.

To my understanding Homebrew wants to be able to build everything from source, so one would want to expect to tell it how to do that (and then the prebuilts will be formed from the same instructions). So it'd probably be smart to look at other Rust taps/formulas/whatever.

danopia avatar Jan 07 '21 20:01 danopia

I used Homebrew on Linux, but don't use now because glibc compatibility issue can't be resolved on my environment. If anyone try to send PR, the following may be helpful.

https://github.com/Homebrew/homebrew-core/pull/39584/files

I think the formula of amber is like below:

class Amber < Formula
  desc "A code search and replace tool"
  homepage "https://github.com/dalance/amber"
  url "https://github.com/dalance/amber/archive/v0.5.8.tar.gz"
  sha256 "f12e0b176273e011209e7d8613d1b9a049e50aeb536871c1f6c05a9d6a494935"

  depends_on "rust" => :build

  def install
    system "cargo", "install", "--root", prefix, "--path", "."
  end

  test do
    output = shell_output("#{bin}/ambr --help")
    count = output.lines.count
    assert count > 2
    assert output.start_with?("ambr")
  end
end

dalance avatar Jan 08 '21 02:01 dalance

I've published a variant of the above on a personal tap, you can use it like so on either platform:

brew install danopia/tools/amber

This is the formula before bottles were inserted: https://github.com/danopia/homebrew-tools/blob/241fb4eeb58e301efb463a1d6bc52ffb9bd34fd1/Formula/amber.rb

I use both macOS and Linux so was able to verify this on both machines. (It's actually quite smooth to make a personal tap...)

To get the formula listed upstream, I believe it has to be PR'd to both https://github.com/Homebrew/homebrew-core and https://github.com/Homebrew/linuxbrew-core (the same file to both repos... There's ongoing work to merge the repos but it has not happened yet). The formula I wrote should pass any criteria though maybe the name should be more specific. Perhaps amber-search to line up with AUR.

danopia avatar Jan 08 '21 15:01 danopia