How to use homebrew to install scripts

4

3

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?).

user137369

Posted 2013-12-18T14:20:20.687

Reputation: 916

Answers

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

user137369

Posted 2013-12-18T14:20:20.687

Reputation: 916