Skip to content

Best way to use a ruby gem as a build dependency? #2873

Discussion options

You must be logged in to vote

The closest examples I can think of are some Formulae that use a specific bundler like:

  • swiftgen
        ENV["GEM_HOME"] = buildpath/"gem_home"
        system "gem", "install", "bundler"
        ENV.prepend_path "PATH", buildpath/"gem_home/bin"
  • mailcatcher
        ENV["GEM_HOME"] = buildpath/"gem_home"
        system "gem", "install", "--no-document", resource("bundler").cached_download
        with_env(PATH: "#{buildpath}/gem_home/bin:#{ENV["PATH"]}") do

In general, the idea would be to use a directory under buildpath since this is a temporary location where the build will take place.

In above examples, the 1st downloads an unversioned/latest bundler while the 2nd downloads a specific version of bundler (v…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mhanberg
Comment options

Answer selected by mhanberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants