Skip to content

Instantly share code, notes, and snippets.

@ZPascal
ZPascal / hoge.rb
Last active August 18, 2023 14:06 — forked from minamijoyo/hoge.rb
Using GitHubPrivateRepositoryReleaseDownloadStrategy removed in brew v2
require "formula"
require_relative "lib/private_strategy"
class Hoge < Formula
homepage "https://github.com/yourcompany/hoge"
url "https://github.com/yourcompany/hoge/releases/download/v0.1.0/hoge_v0.1.0_darwin_amd64.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
sha256 "6de411ff3e4b1658a413dd6181fcXXXXXXXXXXXXXXXXXXXX"
head "https://github.com/yourcompany/hoge.git"
version "0.1.0"
# Method instrumentation decorator with Ruby 2.1's new "method definition returns method name" feature
class Module
def instrument(notification_name, mid)
meth = instance_method(mid)
define_method(mid) { |*args, &bk|
ActiveSupport::Notifications.instrument(notification_name) do
meth.bind(self).call(*args, &bk)
end
}