4

I have some git repos that have scripts in them (bash and ruby). Is there a way to use homebrew to tap those repos and install those scripts to /usr/local/bin? If so, how do I need to set them up?

Ideally for the ruby scripts it would check for dependencies (they’re gems) and install those first, but it’s not mandatory (should they be specified with something like depends_on 'some-gem' => :ruby?).

5

Figured it out, so I’ll post an example for each.

bash scripts

require 'formula'

class MyBashScripts < Formula
  homepage 'http://example.com'
  head 'https://github.com/user/my-bash-scripts.git'

  def install
    bin.install 'script1', 'script2', 'script3'
  end
end

ruby scripts

require 'formula'

class MyRubyScripts < Formula
  depends_on 'some-gem' => :ruby

  homepage 'http://example.com'
  head 'https://github.com/user/my-ruby-scripts.git'

  def install
    bin.install 'script1', 'scrip2', 'script3'
  end
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.