fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

Carlos D. Álvaro :apple:

Hi users!

I’m trying to create a cask and I would like to use an arbitrary Ruby method as explained in the official documentation: docs.brew.sh/Cask-Cookbook#arb

```ruby
cask "salt" do
module Utils
def self.patch_plist(plist_file)
```

However, brew linter is not happy with it:

```
Casks/salt.rb:2:3: W: Lint/ConstantDefinitionInBlock: Do not define constants this way within a block.
module Utils ...
```

Can someone tell me what I’m doing wrong? Thank you!

@homebrew

Homebrew DocumentationCask CookbookDocumentation for the missing package manager for macOS (or Linux).

In response to my self, I found a solution 🎉

You just have to define the `Utils` module outside the `cask` block.

Remember that your module does not include @homebrew's modules, so you would have to extend your module with those you need.

Here is my full cask: github.com/cdalvaro/homebrew-t

GitHubhomebrew-tap/Casks/salt.rb at eeccca3519c4094af10c068a39c6ff51605925dc · cdalvaro/homebrew-tap🍻 @cdalvaro's custom formulae for the @Homebrew package manager - cdalvaro/homebrew-tap