To add a new formula, add the Formula directory and create the get_joke.This tutorial assumes basic knowledge on the part of the user on how to Quote: Homebrew Formulae is an online package browser for Homebrew – the macOS (and Linux) package manager. In my case, my username is pdabrowski6, and I added a repository called homebrew-get_joke, so the URL is the following: Īdd your repository and note the username and repository name as we would need them in the next step. Prefix your repository with homebrew- so it can be easily added to the Homebrew. In this step, we will prepare the repository, which will be used by Homebrew to install packages in the system.
Creating a Github repositoryĪs I mentioned above, it's easier to publish our package when our code is hosted on Github. Thanks to Github's extensive use, we can easily publish our packages and make them available for other users.
Homebrew is a free and open-source software package management system for macOS and Linux. Making the program available via Homebrew
Our little program is now ready so that we can show it to the world. He holds up the phone and money falls out. # => # => Joke #2: When John Norris calls 1-900 numbers, he doesn't get charged. bin / get_joke - r 2 - f John # => Joke #1: There is no theory of evolution, just a list of creatures John Norris allows to live. #!/usr/bin/env ruby require 'optparse' require 'net/http' require 'uri' require 'json' require 'rack' options = " end puts '' else puts 'Something went wrong, please try again' end Here is the part of the code responsible for preparing the proper request URL: The above variants can be combined to request five random jokes where Chuck Norris's name will be replaced with John Doe.