| 
									
										
										
										
											2024-08-12 10:30:59 +01:00
										 |  |  | # typed: true # rubocop:todo Sorbet/StrictSigil | 
					
						
							| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  | require "digest" | 
					
						
							|  |  |  | require "erb" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2020-08-17 05:53:46 +02:00
										 |  |  |   # Class for generating a formula from a template. | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |   class FormulaCreator | 
					
						
							| 
									
										
										
										
											2023-11-28 18:10:20 +00:00
										 |  |  |     attr_accessor :name | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-28 18:32:56 +00:00
										 |  |  |     sig { | 
					
						
							| 
									
										
										
										
											2023-11-29 19:13:19 +00:00
										 |  |  |       params(name: T.nilable(String), version: T.nilable(String), tap: T.nilable(String), url: String, | 
					
						
							|  |  |  |              mode: T.nilable(Symbol), license: T.nilable(String), fetch: T::Boolean, head: T::Boolean).void | 
					
						
							| 
									
										
										
										
											2023-11-28 18:32:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-29 19:17:10 +00:00
										 |  |  |     def initialize(name, version, tap:, url:, mode:, license:, fetch:, head:) | 
					
						
							| 
									
										
										
										
											2023-11-27 20:29:42 +00:00
										 |  |  |       @name = name | 
					
						
							| 
									
										
										
										
											2023-11-27 20:51:47 +00:00
										 |  |  |       @version = Version.new(version) if version | 
					
						
							| 
									
										
										
										
											2023-11-28 16:07:38 +00:00
										 |  |  |       @tap = Tap.fetch(tap || "homebrew/core") | 
					
						
							| 
									
										
										
										
											2023-11-29 19:13:19 +00:00
										 |  |  |       @url = url | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |       @mode = mode | 
					
						
							| 
									
										
										
										
											2023-11-28 15:46:01 +00:00
										 |  |  |       @license = license | 
					
						
							| 
									
										
										
										
											2023-11-27 20:10:23 +00:00
										 |  |  |       @fetch = fetch | 
					
						
							| 
									
										
										
										
											2023-11-27 20:16:45 +00:00
										 |  |  |       @head = head | 
					
						
							| 
									
										
										
										
											2020-07-23 03:08:19 +02:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-29 18:57:24 +00:00
										 |  |  |     sig { void } | 
					
						
							|  |  |  |     def verify | 
					
						
							|  |  |  |       raise TapUnavailableError, @tap.name unless @tap.installed? | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-17 11:33:47 -04:00
										 |  |  |     sig { params(url: String).returns(T.nilable(String)) } | 
					
						
							| 
									
										
										
										
											2023-12-01 19:19:43 +00:00
										 |  |  |     def self.name_from_url(url) | 
					
						
							|  |  |  |       stem = Pathname.new(url).stem | 
					
						
							|  |  |  |       # special cases first | 
					
						
							|  |  |  |       if stem.start_with? "index.cgi" | 
					
						
							|  |  |  |         # gitweb URLs e.g. http://www.codesrc.com/gitweb/index.cgi?p=libzipper.git;a=summary | 
					
						
							|  |  |  |         stem.rpartition("=").last | 
					
						
							|  |  |  |       elsif url =~ %r{github\.com/\S+/(\S+)/(archive|releases)/} | 
					
						
							|  |  |  |         # e.g. https://github.com/stella-emu/stella/releases/download/6.7/stella-6.7-src.tar.xz | 
					
						
							|  |  |  |         Regexp.last_match(1) | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         # e.g. http://digit-labs.org/files/tools/synscan/releases/synscan-5.02.tar.gz | 
					
						
							|  |  |  |         pathver = Version.parse(stem).to_s | 
					
						
							|  |  |  |         stem.sub(/[-_.]?#{Regexp.escape(pathver)}$/, "") | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2023-12-01 19:19:43 +00:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-17 11:33:47 -04:00
										 |  |  |     sig { void } | 
					
						
							| 
									
										
										
										
											2023-12-01 19:19:43 +00:00
										 |  |  |     def parse_url | 
					
						
							|  |  |  |       @name = FormulaCreator.name_from_url(@url) if @name.blank? | 
					
						
							|  |  |  |       odebug "name_from_url: #{@name}" | 
					
						
							| 
									
										
										
										
											2023-11-29 19:13:19 +00:00
										 |  |  |       @version = Version.detect(@url) if @version.nil? | 
					
						
							| 
									
										
										
										
											2023-12-01 19:19:43 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       case @url | 
					
						
							|  |  |  |       when %r{github\.com/(\S+)/(\S+)\.git} | 
					
						
							|  |  |  |         @head = true | 
					
						
							| 
									
										
										
										
											2024-02-16 14:55:09 +03:00
										 |  |  |         user = Regexp.last_match(1) | 
					
						
							|  |  |  |         repo = Regexp.last_match(2) | 
					
						
							|  |  |  |         @github = GitHub.repository(user, repo) if @fetch | 
					
						
							| 
									
										
										
										
											2023-12-01 19:19:43 +00:00
										 |  |  |       when %r{github\.com/(\S+)/(\S+)/(archive|releases)/} | 
					
						
							| 
									
										
										
										
											2024-02-16 14:55:09 +03:00
										 |  |  |         user = Regexp.last_match(1) | 
					
						
							|  |  |  |         repo = Regexp.last_match(2) | 
					
						
							|  |  |  |         @github = GitHub.repository(user, repo) if @fetch | 
					
						
							| 
									
										
										
										
											2023-12-01 19:19:43 +00:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-17 11:33:47 -04:00
										 |  |  |     sig { returns(Pathname) } | 
					
						
							| 
									
										
										
										
											2023-11-23 18:04:03 +03:00
										 |  |  |     def write_formula! | 
					
						
							| 
									
										
										
										
											2023-11-23 18:53:22 +03:00
										 |  |  |       raise ArgumentError, "name is blank!" if @name.blank? | 
					
						
							|  |  |  |       raise ArgumentError, "tap is blank!" if @tap.blank? | 
					
						
							| 
									
										
										
										
											2023-11-23 18:12:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-20 14:03:50 +00:00
										 |  |  |       path = @tap.new_formula_path(@name) | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |       raise "#{path} already exists" if path.exist? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-28 15:39:04 +00:00
										 |  |  |       if @version.nil? || @version.null? | 
					
						
							| 
									
										
										
										
											2023-09-08 14:46:15 -04:00
										 |  |  |         odie "Version cannot be determined from URL. Explicitly set the version with `--set-version` instead." | 
					
						
							| 
									
										
										
										
											2024-02-16 14:55:09 +03:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if @fetch | 
					
						
							| 
									
										
										
										
											2023-11-27 20:16:45 +00:00
										 |  |  |         unless @head | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |           r = Resource.new | 
					
						
							| 
									
										
										
										
											2023-11-29 18:48:06 +00:00
										 |  |  |           r.url(@url) | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |           r.owner = self | 
					
						
							| 
									
										
										
										
											2025-03-27 06:09:58 +03:00
										 |  |  |           filepath = r.fetch | 
					
						
							| 
									
										
										
										
											2025-03-28 06:59:02 +03:00
										 |  |  |           html_doctype_prefix = "<!doctype html" | 
					
						
							| 
									
										
										
										
											2025-03-28 07:05:53 +03:00
										 |  |  |           if File.read(filepath, html_doctype_prefix.length).downcase.start_with?(html_doctype_prefix) | 
					
						
							|  |  |  |             raise "Downloaded URL is not archive" | 
					
						
							|  |  |  |           end | 
					
						
							| 
									
										
										
										
											2025-03-27 06:09:58 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |           @sha256 = filepath.sha256 | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-16 14:55:09 +03:00
										 |  |  |         if @github | 
					
						
							|  |  |  |           @desc = @github["description"] | 
					
						
							| 
									
										
										
										
											2025-03-30 18:15:00 +02:00
										 |  |  |           @homepage = @github["homepage"].presence || "https://github.com/#{@github["full_name"]}" | 
					
						
							| 
									
										
										
										
											2024-02-16 14:55:09 +03:00
										 |  |  |           @license = @github["license"]["spdx_id"] if @github["license"] | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-03 13:24:32 +01:00
										 |  |  |       path.dirname.mkpath | 
					
						
							| 
									
										
										
										
											2019-10-13 10:09:38 +01:00
										 |  |  |       path.write ERB.new(template, trim_mode: ">").result(binding) | 
					
						
							| 
									
										
										
										
											2023-11-20 14:03:50 +00:00
										 |  |  |       path | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-05 14:09:27 +08:00
										 |  |  |     sig { params(name: String).returns(String) } | 
					
						
							|  |  |  |     def latest_versioned_formula(name) | 
					
						
							|  |  |  |       name_prefix = "#{name}@" | 
					
						
							| 
									
										
										
										
											2025-02-10 14:55:20 +08:00
										 |  |  |       CoreTap.instance.formula_names | 
					
						
							|  |  |  |              .select { |f| f.start_with?(name_prefix) } | 
					
						
							|  |  |  |              .max_by { |v| Gem::Version.new(v.sub(name_prefix, "")) } || "python" | 
					
						
							| 
									
										
										
										
											2025-02-05 14:09:27 +08:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-20 12:03:48 +02:00
										 |  |  |     sig { returns(String) } | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |     def template | 
					
						
							| 
									
										
										
										
											2024-04-30 11:10:23 +02:00
										 |  |  |       # FIXME: https://github.com/errata-ai/vale/issues/818 | 
					
						
							|  |  |  |       # <!-- vale off --> | 
					
						
							| 
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 |  |  |       <<~ERB | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         # Documentation: https://docs.brew.sh/Formula-Cookbook | 
					
						
							| 
									
										
										
										
											2019-03-28 21:15:50 +00:00
										 |  |  |         #                https://rubydoc.brew.sh/Formula | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! | 
					
						
							|  |  |  |         class #{Formulary.class_s(name)} < Formula | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% if  @mode == :python %> | 
					
						
							| 
									
										
										
										
											2019-09-24 19:34:34 +02:00
										 |  |  |           include Language::Python::Virtualenv | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <% end  %> | 
					
						
							| 
									
										
										
										
											2023-11-29 18:43:03 +00:00
										 |  |  |           desc "#{@desc}" | 
					
						
							|  |  |  |           homepage "#{@homepage}" | 
					
						
							| 
									
										
										
										
											2023-11-27 20:16:45 +00:00
										 |  |  |         <% unless  @head %> | 
					
						
							| 
									
										
										
										
											2023-11-29 18:48:06 +00:00
										 |  |  |           url "#{@url}" | 
					
						
							| 
									
										
										
										
											2023-11-28 15:39:04 +00:00
										 |  |  |         <% unless  @version.detected_from_url? %> | 
					
						
							|  |  |  |           version "#{@version}" | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         <% end  %> | 
					
						
							| 
									
										
										
										
											2023-11-29 18:43:03 +00:00
										 |  |  |           sha256 "#{@sha256}" | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         <% end  %> | 
					
						
							| 
									
										
										
										
											2023-11-28 15:46:01 +00:00
										 |  |  |           license "#{@license}" | 
					
						
							| 
									
										
										
										
											2023-11-27 20:16:45 +00:00
										 |  |  |         <% if  @head %> | 
					
						
							| 
									
										
										
										
											2023-11-29 18:48:06 +00:00
										 |  |  |           head "#{@url}" | 
					
						
							| 
									
										
										
										
											2020-07-14 17:37:55 -07:00
										 |  |  |         <% end  %> | 
					
						
							| 
									
										
										
										
											2019-07-17 14:26:32 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% if  @mode == :cmake %> | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |           depends_on "cmake" => :build | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :crystal %> | 
					
						
							| 
									
										
										
										
											2020-06-25 17:17:42 +02:00
										 |  |  |           depends_on "crystal" => :build | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :go %> | 
					
						
							| 
									
										
										
										
											2019-09-20 16:09:01 +02:00
										 |  |  |           depends_on "go" => :build | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :meson %> | 
					
						
							| 
									
										
										
										
											2019-05-12 09:14:25 +01:00
										 |  |  |           depends_on "meson" => :build | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |           depends_on "ninja" => :build | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :node %> | 
					
						
							| 
									
										
										
										
											2020-07-12 21:25:01 -07:00
										 |  |  |           depends_on "node" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :perl %> | 
					
						
							| 
									
										
										
										
											2019-09-25 21:52:16 +02:00
										 |  |  |           uses_from_macos "perl" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :python %> | 
					
						
							| 
									
										
										
										
											2025-02-05 14:09:27 +08:00
										 |  |  |           depends_on "#{latest_versioned_formula("python")}" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :ruby %> | 
					
						
							| 
									
										
										
										
											2020-03-21 15:32:52 +01:00
										 |  |  |           uses_from_macos "ruby" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :rust %> | 
					
						
							| 
									
										
										
										
											2019-09-25 14:29:09 +02:00
										 |  |  |           depends_on "rust" => :build | 
					
						
							| 
									
										
										
										
											2025-02-21 14:53:34 +01:00
										 |  |  |         <% elsif  @mode == :zig %> | 
					
						
							|  |  |  |           depends_on "zig" => :build | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode.nil? %> | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |           # depends_on "cmake" => :build | 
					
						
							|  |  |  |         <% end  %> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-30 12:51:58 +08:00
										 |  |  |         <% if  @mode == :perl || :python || :ruby %> | 
					
						
							| 
									
										
										
										
											2019-09-25 21:52:16 +02:00
										 |  |  |           # Additional dependency | 
					
						
							| 
									
										
										
										
											2019-09-25 13:41:56 +02:00
										 |  |  |           # resource "" do | 
					
						
							|  |  |  |           #   url "" | 
					
						
							|  |  |  |           #   sha256 "" | 
					
						
							|  |  |  |           # end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <% end  %> | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |           def install | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% if  @mode == :cmake %> | 
					
						
							| 
									
										
										
										
											2021-03-15 03:22:41 +00:00
										 |  |  |             system "cmake", "-S", ".", "-B", "build", *std_cmake_args | 
					
						
							|  |  |  |             system "cmake", "--build", "build" | 
					
						
							|  |  |  |             system "cmake", "--install", "build" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :autotools %> | 
					
						
							| 
									
										
										
										
											2023-12-28 15:55:22 -05:00
										 |  |  |             # Remove unrecognized options if they cause configure to fail | 
					
						
							| 
									
										
										
										
											2021-03-08 12:57:35 -08:00
										 |  |  |             # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method | 
					
						
							| 
									
										
										
										
											2023-12-28 15:55:22 -05:00
										 |  |  |             system "./configure", "--disable-silent-rules", *std_configure_args | 
					
						
							| 
									
										
										
										
											2021-03-15 03:22:41 +00:00
										 |  |  |             system "make", "install" # if this fails, try separate make/make install steps | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :crystal %> | 
					
						
							| 
									
										
										
										
											2020-06-25 17:17:42 +02:00
										 |  |  |             system "shards", "build", "--release" | 
					
						
							|  |  |  |             bin.install "bin/#{name}" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :go %> | 
					
						
							| 
									
										
										
										
											2021-08-22 14:30:26 -04:00
										 |  |  |             system "go", "build", *std_go_args(ldflags: "-s -w") | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :meson %> | 
					
						
							| 
									
										
										
										
											2022-11-30 12:27:46 -08:00
										 |  |  |             system "meson", "setup", "build", *std_meson_args | 
					
						
							|  |  |  |             system "meson", "compile", "-C", "build", "--verbose" | 
					
						
							|  |  |  |             system "meson", "install", "-C", "build" | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :node %> | 
					
						
							| 
									
										
										
										
											2024-07-25 22:24:09 -07:00
										 |  |  |             system "npm", "install", *std_npm_args | 
					
						
							| 
									
										
										
										
											2020-07-12 21:25:01 -07:00
										 |  |  |             bin.install_symlink Dir["\#{libexec}/bin/*"] | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :perl %> | 
					
						
							| 
									
										
										
										
											2019-09-25 21:52:16 +02:00
										 |  |  |             ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5" | 
					
						
							|  |  |  |             ENV.prepend_path "PERL5LIB", libexec/"lib" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-30 11:10:23 +02:00
										 |  |  |             # Stage additional dependency (`Makefile.PL` style). | 
					
						
							| 
									
										
										
										
											2019-09-25 21:52:16 +02:00
										 |  |  |             # resource("").stage do | 
					
						
							|  |  |  |             #   system "perl", "Makefile.PL", "INSTALL_BASE=\#{libexec}" | 
					
						
							|  |  |  |             #   system "make" | 
					
						
							|  |  |  |             #   system "make", "install" | 
					
						
							|  |  |  |             # end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-30 11:10:23 +02:00
										 |  |  |             # Stage additional dependency (`Build.PL` style). | 
					
						
							| 
									
										
										
										
											2019-09-25 21:52:16 +02:00
										 |  |  |             # resource("").stage do | 
					
						
							|  |  |  |             #   system "perl", "Build.PL", "--install_base", libexec | 
					
						
							|  |  |  |             #   system "./Build" | 
					
						
							|  |  |  |             #   system "./Build", "install" | 
					
						
							|  |  |  |             # end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             bin.install name | 
					
						
							| 
									
										
										
										
											2020-12-28 14:17:36 -08:00
										 |  |  |             bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :python %> | 
					
						
							| 
									
										
										
										
											2019-09-24 19:34:34 +02:00
										 |  |  |             virtualenv_install_with_resources | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :ruby %> | 
					
						
							| 
									
										
										
										
											2020-03-21 15:32:52 +01:00
										 |  |  |             ENV["GEM_HOME"] = libexec | 
					
						
							| 
									
										
										
										
											2025-01-30 12:51:58 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-01 17:23:02 +08:00
										 |  |  |             system "bundle", "install", "-without", "development", "test" | 
					
						
							| 
									
										
										
										
											2020-03-21 15:32:52 +01:00
										 |  |  |             system "gem", "build", "\#{name}.gemspec" | 
					
						
							| 
									
										
										
										
											2025-01-30 12:51:58 +08:00
										 |  |  |             system "gem", "install", "\#{name}-\#{version}.gem" | 
					
						
							| 
									
										
										
										
											2020-03-21 15:32:52 +01:00
										 |  |  |             bin.install libexec/"bin/\#{name}" | 
					
						
							| 
									
										
										
										
											2020-12-28 14:17:36 -08:00
										 |  |  |             bin.env_script_all_files(libexec/"bin", GEM_HOME: ENV["GEM_HOME"]) | 
					
						
							| 
									
										
										
										
											2023-11-28 18:07:32 +00:00
										 |  |  |         <% elsif  @mode == :rust %> | 
					
						
							| 
									
										
										
										
											2020-06-22 13:24:41 +02:00
										 |  |  |             system "cargo", "install", *std_cargo_args | 
					
						
							| 
									
										
										
										
											2025-02-21 14:53:34 +01:00
										 |  |  |         <% elsif  @mode == :zig %> | 
					
						
							|  |  |  |             system "zig", "build", *std_zig_args | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         <% else  %> | 
					
						
							| 
									
										
										
										
											2023-12-28 15:55:22 -05:00
										 |  |  |             # Remove unrecognized options if they cause configure to fail | 
					
						
							| 
									
										
										
										
											2021-03-08 12:57:35 -08:00
										 |  |  |             # https://rubydoc.brew.sh/Formula.html#std_configure_args-instance_method | 
					
						
							| 
									
										
										
										
											2023-12-28 15:55:22 -05:00
										 |  |  |             system "./configure", "--disable-silent-rules", *std_configure_args | 
					
						
							| 
									
										
										
										
											2021-03-15 03:22:41 +00:00
										 |  |  |             # system "cmake", "-S", ".", "-B", "build", *std_cmake_args | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |         <% end  %> | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           test do | 
					
						
							|  |  |  |             # `test do` will create, run in and delete a temporary directory. | 
					
						
							|  |  |  |             # | 
					
						
							|  |  |  |             # This test will fail and we won't accept that! For Homebrew/homebrew-core | 
					
						
							|  |  |  |             # this will need to be a test that verifies the functionality of the | 
					
						
							|  |  |  |             # software. Run the test with `brew test #{name}`. Options passed | 
					
						
							|  |  |  |             # to `brew install` such as `--HEAD` also need to be provided to `brew test`. | 
					
						
							|  |  |  |             # | 
					
						
							|  |  |  |             # The installed folder is not in the path, so use the entire path to any | 
					
						
							| 
									
										
										
										
											2024-08-09 11:58:51 -07:00
										 |  |  |             # executables being tested: `system bin/"program", "do", "something"`. | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |             system "false" | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											2018-07-11 15:17:40 +02:00
										 |  |  |       ERB | 
					
						
							| 
									
										
										
										
											2024-04-30 11:10:23 +02:00
										 |  |  |       # <!-- vale on --> | 
					
						
							| 
									
										
										
										
											2018-06-03 15:28:48 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |