<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kiit Framework</title>
    <description>The latest articles on DEV Community by Kiit Framework (@kiit-dev).</description>
    <link>https://dev.to/kiit-dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F3553%2F09cac241-8d7d-4bfd-8be7-37e27ca7f095.png</url>
      <title>DEV Community: Kiit Framework</title>
      <link>https://dev.to/kiit-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kiit-dev"/>
    <language>en</language>
    <item>
      <title>Using an Application Identity</title>
      <dc:creator>kishore</dc:creator>
      <pubDate>Tue, 16 Feb 2021 02:33:12 +0000</pubDate>
      <link>https://dev.to/kiit-dev/using-an-application-identity-2f4k</link>
      <guid>https://dev.to/kiit-dev/using-an-application-identity-2f4k</guid>
      <description>&lt;p&gt;This post discusses using an &lt;strong&gt;application identity&lt;/strong&gt; ( a &lt;code&gt;convention based unique name to identify any app&lt;/code&gt; ) to organize, identify an application, and properly link the identity to the &lt;strong&gt;logs, metrics, alerts, and other diagnostics&lt;/strong&gt; of the application. This was designed for a Kotlin framework called &lt;a href="https://www.slatekit.com" rel="noopener noreferrer"&gt;Slate Kit&lt;/a&gt;; codebase at &lt;a href="https://github.com/slatekit/slatekit" rel="noopener noreferrer"&gt;Git&lt;/a&gt;, and code for this component here at &lt;a href="https://github.com/slatekit/slatekit/blob/main/src/lib/kotlin/slatekit-common/src/main/kotlin/slatekit/common/Identity.kt" rel="noopener noreferrer"&gt;Identity.kt&lt;/a&gt;. &lt;/p&gt;

&lt;h1&gt;
  
  
  Example
&lt;/h1&gt;

&lt;p&gt;We use the convention below to create a unique name representing the identity of any application. This name uniquely identifies an application, provides &lt;strong&gt;ownership, environment, version info&lt;/strong&gt; and is used to appropriately link it to various diagnostics( logs, alerts, metrics) when running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;{&lt;/span&gt;area&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;env&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;version&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;instance&lt;span class="o"&gt;}&lt;/span&gt;
signup.alerts.job.qat.v2.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Real-World
&lt;/h1&gt;

&lt;p&gt;We already have conventions for identifying various resources, some obvious examples in the real world are below. So why not have one for an application ?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;uri&lt;/strong&gt;: &lt;code&gt;https://github.com/slatekit/slatekit&lt;/code&gt; - account + repo &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ip&lt;/strong&gt; : &lt;code&gt;129.144.59.56&lt;/code&gt; - network + host &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;phone&lt;/strong&gt; : &lt;code&gt;800-123-4567&lt;/code&gt; - u.s phone format &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSN&lt;/strong&gt; :   &lt;code&gt;123-45-6789&lt;/code&gt; - u.s Social Security Number&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Use-cases
&lt;/h1&gt;

&lt;p&gt;The examples above clearly resolve the value to a computer or a person. This allows for supporting a lot of other things like lookup, ownership, tracing, and diagnostics. A production application usually involves the following&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ownership&lt;/strong&gt; : simply knowing who owns/manages an app&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;logs&lt;/strong&gt; : log for info, debug, warnings, errors&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;metrics&lt;/strong&gt;: metrics being sent to providers like newrelic/datadog&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;alerts&lt;/strong&gt; : alerts being sent out ( e.g. pagerduty, slack )&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An identity is especially useful for organizations that could have dozens to hundreds of applications. But even for small groups, startups, side projects, an identity can come in handy to &lt;strong&gt;distinguish between a background job, an api, or a bot&lt;/strong&gt; that may all be related to a specific product area or service. &lt;/p&gt;

&lt;h1&gt;
  
  
  Packages
&lt;/h1&gt;

&lt;p&gt;One way to typically identify a &lt;strong&gt;running&lt;/strong&gt; app is to simply use a &lt;strong&gt;git repo&lt;/strong&gt; and some type of &lt;strong&gt;namespace&lt;/strong&gt; ( e.g. java package name ) to serve as some form of identity. For example &lt;a href="https://github.com/slatekit/slatekit/blob/main/src/apps/kotlin/slatekit-samples/src/main/kotlin/slatekit/samples/Samples.kt#L1" rel="noopener noreferrer"&gt;slatekit.samples&lt;/a&gt;. But this is pretty vague doesn't contain useful information. It also says nothing about what &lt;strong&gt;type&lt;/strong&gt; of app it is, its &lt;strong&gt;environment, version&lt;/strong&gt; info, and/or some other attributes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;
&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="nn"&gt;:&lt;/span&gt; &lt;span class="n"&gt;slatekit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;samples&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The package name may be used in logs, metrics. &lt;code&gt;But a package name is a loose standard with not enough info, especially for a running app.&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Solution
&lt;/h1&gt;

&lt;p&gt;A simple solution is to come up with a &lt;strong&gt;strict&lt;/strong&gt; naming convention for the identity of app ( and enforced in code ) that can capture some important attributes to build the name or identity. I've decided on the following convention.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;{&lt;/span&gt;area&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;name&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;env&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;version&lt;span class="o"&gt;}&lt;/span&gt;.&lt;span class="o"&gt;{&lt;/span&gt;instance&lt;span class="o"&gt;}&lt;/span&gt;
signup.alerts.job.qat.v2.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This examples represents a background &lt;strong&gt;job&lt;/strong&gt; we use in the &lt;strong&gt;signup/registration&lt;/strong&gt; portion of an mobile app being worked on, that generates &lt;strong&gt;alerts, emails, sms&lt;/strong&gt; confirmations in a &lt;strong&gt;test/qat&lt;/strong&gt; environment. It also contains the version number and instance id ( which is newly generated as a simple uuid on each deployment ) and also distinguishers between multiple instances of the application.&lt;/p&gt;

&lt;h1&gt;
  
  
  Attributes
&lt;/h1&gt;

&lt;p&gt;I've decided to include the following attributes in the identity of an app. These parts can also be used to generate a short-form or long-form id for convenience.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attribute&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;area&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;signup&lt;/td&gt;
&lt;td&gt;product area / department&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;name&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;alerts&lt;/td&gt;
&lt;td&gt;name of the application&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;type&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;job&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cli , api , job , bot&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;env&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;qat&lt;/td&gt;
&lt;td&gt;&lt;code&gt;dev , qat , uat , pro&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ver&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;v2-1&lt;/td&gt;
&lt;td&gt;version of app&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;uuid&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;id&lt;/td&gt;
&lt;td&gt;instance id&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With these attributes, you can generate short or long form identities. For example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Short &lt;span class="nb"&gt;id&lt;/span&gt;
&lt;span class="c"&gt;# {area}.{name}.{type}.{env}&lt;/span&gt;
&lt;span class="s2"&gt;"signup.alerts.job.qat"&lt;/span&gt;

Version &lt;span class="nb"&gt;id&lt;/span&gt;
&lt;span class="c"&gt;# {area}.{name}.{type}.{env}&lt;/span&gt;
&lt;span class="s2"&gt;"signup.alerts.job.qat.v2"&lt;/span&gt;

Full Id
&lt;span class="c"&gt;# {area}.{name}.{type}.{env}.{version}.{instance}&lt;/span&gt;
&lt;span class="s2"&gt;"signup.alerts.job.qat.v2.4a3b300b-d0ac-4776-8a9c-31aa75e412b3"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Code
&lt;/h1&gt;

&lt;p&gt;The application identity is strictly enforced in code using the &lt;a href="https://github.com/slatekit/slatekit/blob/main/src/lib/kotlin/slatekit-common/src/main/kotlin/slatekit/common/Identity.kt" rel="noopener noreferrer"&gt;Identity.kt&lt;/a&gt; class and enums for the types, environments.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight kotlin"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * Simple Identity used to identity services / components
 * @param area    : area  | dept | org  - logical group 
 * @param service : user1 | job  | svc  - name of app/service
 * @param agent   : api   | app  | job  - type of app
 * @param env     : dev   | qat  | pro  - environment
 * @param instance: UUID                - for 2+ instances
 *
 *      = {area}.{service}.{agent}.{env}.{version}.{instance}
 * name = signup.alerts.job.qat
 * full = signup.alerts.job.qat.v2.4a3b300b-d0ac-4776-8a9c-31aa75e412b3
*/&lt;/span&gt;
&lt;span class="kd"&gt;data class&lt;/span&gt; &lt;span class="nc"&gt;SimpleIdentity&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;area&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;instance&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ULIDs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"LATEST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;desc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="k"&gt;override&lt;/span&gt; &lt;span class="kd"&gt;val&lt;/span&gt; &lt;span class="py"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;listOf&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Identity&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ... &lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Diagnostics
&lt;/h1&gt;

&lt;p&gt;We identify applications using this approach and use the full-id and use its attributes when linking it to slack alerts, logs and metrics. Here are some samples for Slack and Loggly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alerts
&lt;/h2&gt;

&lt;p&gt;Here is a sample Slack alert with the identity of the application that sent the alert in the &lt;strong&gt;origin&lt;/strong&gt; field.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi7tcnq76o37qv5lye763.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi7tcnq76o37qv5lye763.png" alt="Alt Text" width="598" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Logs
&lt;/h2&gt;

&lt;p&gt;Here is a simple example of a log entry with the identity of the application prefixed ( in both a local log file and sent to Loggly ).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;signup.alerts.job.qat.v2.2.0: 2021-02-15 17:25 INFO [main] app Beta user activated   , uuid=0a32988c-4eed-42dc-8ba7-b932d82da3f0, phase=2
signup.alerts.job.qat.v2.2.0: 2021-02-15 17:26 INFO [main] app user welcome mail sent, uuid=0a32988c-4eed-42dc-8ba7-b932d82da3f0, phase=2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the identity is enforced in code and in configurations for various diagnostics, we now have a way of easily identifying apps and connecting/searching diagnostics more easily!&lt;/p&gt;

&lt;h1&gt;
  
  
  Registry
&lt;/h1&gt;

&lt;p&gt;With application identities defined, you can also create a dashboard to serve as an &lt;strong&gt;application registry&lt;/strong&gt; that lists all applications running in your environments.&lt;/p&gt;

&lt;h1&gt;
  
  
  Customize
&lt;/h1&gt;

&lt;p&gt;All these attributes collectively provide a unique identity that can assist with ownership, and most importantly link with and provide insight into diagnostics and metrics. If you're using Kotlin for Server or Android, then checkout  &lt;a href="https://github.com/slatekit/slatekit/blob/main/src/lib/kotlin/slatekit-common/src/main/kotlin/slatekit/common/Identity.kt" rel="noopener noreferrer"&gt;Identity.kt&lt;/a&gt; or build your own!&lt;/p&gt;

</description>
      <category>identity</category>
      <category>application</category>
      <category>kotlin</category>
      <category>diagnostics</category>
    </item>
    <item>
      <title>How to create a Homebrew installer</title>
      <dc:creator>kishore</dc:creator>
      <pubDate>Mon, 18 Jan 2021 05:02:58 +0000</pubDate>
      <link>https://dev.to/kiit-dev/create-a-homebrew-installer-4p09</link>
      <guid>https://dev.to/kiit-dev/create-a-homebrew-installer-4p09</guid>
      <description>&lt;p&gt;This post discusses how to create a &lt;strong&gt;homebrew&lt;/strong&gt; installer to package any script, application or tool, in this case a Kotlin (Java) based application. This was done for a Kotlin framework called &lt;a href="https://www.slatekit.com" rel="noopener noreferrer"&gt;Slate Kit&lt;/a&gt;, and here on &lt;a href="https://github.com/slatekit/slatekit" rel="noopener noreferrer"&gt;Git&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Building scripts, applications and tools is a part of software engineering and a pretty common task. This process though typically involves a runnable application, installing, uninstalling, upgrading and packaging some dependencies/resources. This can be trivial or somewhat complex. Fortunately, there are package managers like &lt;strong&gt;homebrew&lt;/strong&gt; that handle most of the boilerplate. While homebrew is great, and easy to use as an end-user who installs software, I found the documentation and guides on creating an installer somewhat difficult to navigate.&lt;/p&gt;

&lt;h1&gt;
  
  
  Terms
&lt;/h1&gt;

&lt;p&gt;Before we get into the details of coding an installer, we need to first understand some terms and concepts. Most of these are represented here at &lt;a href="https://docs.brew.sh/Formula-Cookbook#homebrew-terminology" rel="noopener noreferrer"&gt;Homebrew Terms&lt;/a&gt;. However, I want to elaborate on a few that are relevant for this post. These are also represented in the diagram below&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Package&lt;/strong&gt;: A package is not listed in the homebrew terminology section but it is basically the &lt;strong&gt;script, application or tool&lt;/strong&gt; that you want to install and use. This contains your executable and all the resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Formula&lt;/strong&gt;: A formula is a &lt;strong&gt;Ruby installation script&lt;/strong&gt; that defines and installs your package on Mac OS. Since homebrew is Ruby based, the formula is a Ruby script and it typically just moves your package executable and resources into the various install directories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tap&lt;/strong&gt;    : A tap is a git repository containing 1 or more Formulas. You direct homebrew to load your tap(git repo) as the source for your formulas. A tap must be prefixed with &lt;code&gt;homebrew-&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version&lt;/strong&gt;: The version number of your package to be installed, e.g. &lt;code&gt;v1.38.0&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Diagram
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff333h2e6sc0umhdcntcy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff333h2e6sc0umhdcntcy.png" alt="Alt Text" width="800" height="869"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Example
&lt;/h1&gt;

&lt;p&gt;This is a quick example of the entire process of setting up your tap, installing your package and then using your package. In this case the tap is &lt;code&gt;slatekit/slatekit&lt;/code&gt; ( homebrew automatically interprets this using the &lt;code&gt;homebrew-&lt;/code&gt; prefix, so this actually is &lt;code&gt;slatekit/homebrew-slatekit&lt;/code&gt;, the formula is also called &lt;code&gt;slatekit&lt;/code&gt; ( slatekit.rb ) and finally the executable script is &lt;strong&gt;slatekit&lt;/strong&gt; ( a bash script that runs the Kotlin application ).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Set tap (shortcut to github.com/slatekit/homebrew-slatekit)&lt;/span&gt;
:&amp;gt; brew tap slatekit/slatekit

&lt;span class="c"&gt;# Install formula slatekit.rb to install the package &lt;/span&gt;
:&amp;gt; brew &lt;span class="nb"&gt;install &lt;/span&gt;slatekit 

&lt;span class="c"&gt;# Finally use the package ( slatekit script )&lt;/span&gt;
:&amp;gt; slatekit new app &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Sample1"&lt;/span&gt; &lt;span class="nt"&gt;-packageName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"mycompany.apps"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 1: Package
&lt;/h1&gt;

&lt;p&gt;You need to first create your git repo for the actual package that you plan to install and use. Its libraries, dependencies, and resources need to be stored in one git repo. In this case its &lt;a href="https://github.com/slatekit/slatekit-cli" rel="noopener noreferrer"&gt;Slate Kit CLI&lt;/a&gt;. There is a file called &lt;strong&gt;slatekit&lt;/strong&gt; and this represents a shell script that is the actual tool that will be used. You also need to create a release of this package so there is a zip/tar containing all items in the repo, for example &lt;a href="https://github.com/slatekit/slatekit-cli/releases/tag/v1.34.5" rel="noopener noreferrer"&gt;v1.34.5&lt;/a&gt;. Since this is a Kotlin/Java based application, the repo contains the libraries( jars ) and some resources, and an executable. This Kotlin/Java application was originally built using gradle &lt;code&gt;'application'&lt;/code&gt; plugin and running &lt;code&gt;gradle distZip&lt;/code&gt; to package the slatekit shell script all the libraries.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 2: Tap
&lt;/h1&gt;

&lt;p&gt;You need to create another git repo containing the &lt;strong&gt;homebrew formula&lt;/strong&gt; that will perform the install. The tap can contain 1 or more formulas. In this example the &lt;strong&gt;tap&lt;/strong&gt; is &lt;a href="https://github.com/slatekit/homebrew-slatekit" rel="noopener noreferrer"&gt;slatekit/homebrew-slatekit&lt;/a&gt;. This tap provides homebrew a place to look for formulas. Some formulas are submitted to Homebrew for proper approval and available without requiring a tap ( later step ), but this example uses a custom tap so that you don't need to go through the approval process.&lt;br&gt;
&lt;strong&gt;NOTE&lt;/strong&gt;: The name of the git repo must start with &lt;code&gt;homebrew-&lt;/code&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Step 3: Formula
&lt;/h1&gt;

&lt;p&gt;Now you need to create a formula that defines your package and performs the installation steps. A formula contains a reference to the url/version of the package above, so brew can download the package and unzip it so the formula can install the contents. The &lt;strong&gt;formula&lt;/strong&gt; in this example is &lt;a href="https://github.com/slatekit/homebrew-slatekit/blob/main/slatekit.rb" rel="noopener noreferrer"&gt;slatekit.rb&lt;/a&gt;. The most relevant things in the formula are the url, sha, and the steps in the &lt;strong&gt;install&lt;/strong&gt; method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Slatekit&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;Formula&lt;/span&gt;
  &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="s2"&gt;"https://github.com/slatekit/slatekit-cli/archive/v1.34.5.tar.gz"&lt;/span&gt;
  &lt;span class="n"&gt;sha256&lt;/span&gt; &lt;span class="s2"&gt;"e95375f92a8c0e86082d9b22e11bd6a414ee0de9df77dda84d6bb6dc21061647"&lt;/span&gt;

  &lt;span class="c1"&gt;# ...&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;install&lt;/span&gt;
    &lt;span class="n"&gt;bin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;install&lt;/span&gt; &lt;span class="s1"&gt;'slatekit'&lt;/span&gt;
    &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;install&lt;/span&gt; &lt;span class="no"&gt;Dir&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"lib"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;install&lt;/span&gt; &lt;span class="no"&gt;Dir&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"conf"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;install&lt;/span&gt; &lt;span class="no"&gt;Dir&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"templates"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"Completed install"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are 2 ways to get the sha for the package url, e.g. the &lt;code&gt;e95375f92a8c0e86082d9b22e11bd6a414ee0de9df77dda84d6bb6dc21061647&lt;/code&gt; in the forumla above. &lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; https://github.com/slatekit/slatekit- cli/archive/v1.34.5.tar.gz &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 1.34.5.tar.gz
shasum &lt;span class="nt"&gt;-a&lt;/span&gt; 256 1.34.5.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option 2
&lt;/h3&gt;

&lt;p&gt;Run the brew create command below and the script is created in /usr/local/Homebrew/Library/taps/homebrew/homebrew-core/Formula/slatekit-cli.rb which will have the sha.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew create https://github.com/slatekit/slatekit- cli/archive/v1.34.5.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Process
&lt;/h1&gt;

&lt;p&gt;There a few important things regarding whats happening in the install step. This is where you specify what to install from the package version that was downloaded.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;version&lt;/strong&gt; since homebrew provides versioning of packages, this package directory will correspond to the version in the formula e.g. &lt;a href="https://github.com/slatekit/slatekit-cli/releases/tag/v1.34.5" rel="noopener noreferrer"&gt;v1.34.5&lt;/a&gt; and installed to &lt;code&gt;/usr/local/Cellar/slatkit/1.34.5&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;bin.install&lt;/strong&gt;: This call will move the &lt;strong&gt;slatekit&lt;/strong&gt; shell script to the bin directory &lt;code&gt;/usr/local/Cellar/slatkit/1.34.5/bin&lt;/code&gt;, make it executable, and available on the command line to call.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;prefix.install&lt;/strong&gt; This call will install the directory from the unzipped package into the folder for this version. e.g. the &lt;code&gt;lib&lt;/code&gt; directory from package is moved to  &lt;code&gt;/usr/local/Cellar/slatkit/1.34.5/lib&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Install
&lt;/h1&gt;

&lt;p&gt;Finally, once you have all this set up, you can simply run the following commands to install the tap and package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew tap slatekit/slatekit
brew &lt;span class="nb"&gt;install &lt;/span&gt;slatekit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first line &lt;code&gt;brew tap slatekit/slatekit&lt;/code&gt; is really a call to download the tap and formula from &lt;a href="https://github.com/slatekit/homebrew-slatekit" rel="noopener noreferrer"&gt;https://github.com/slatekit/homebrew-slatekit&lt;/a&gt;. The second call &lt;code&gt;brew install slatekit&lt;/code&gt; is call to run the formula &lt;a href="https://github.com/slatekit/homebrew-slatekit/blob/main/slatekit.rb" rel="noopener noreferrer"&gt;slatekit.rb&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;NOTE&lt;/strong&gt;:&lt;br&gt;
You may experience a few issues during install &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://discussions.apple.com/thread/251258165" rel="noopener noreferrer"&gt;Homebrew slow install&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://discourse.brew.sh/t/brew-install-very-slow-pauses-for-long-period-while-executing-usr-bin-sandbox-exec-in-post-install/7423" rel="noopener noreferrer"&gt;Homebrew issues on Mac OS Catalina&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  Execute
&lt;/h1&gt;

&lt;p&gt;Now with the package installed, you can immediately start using it. In this case, &lt;a href="https://github.com/slatekit/slatekit" rel="noopener noreferrer"&gt;slatekit&lt;/a&gt; generates new projects. So we can use it like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;slatekit new app &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"MyApp1"&lt;/span&gt; &lt;span class="nt"&gt;-packageName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"company1.apps"&lt;/span&gt;
slatekit new api &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"MyAPI1"&lt;/span&gt; &lt;span class="nt"&gt;-packageName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"company1.apis"&lt;/span&gt;
slatekit new job &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"MyJob1"&lt;/span&gt; &lt;span class="nt"&gt;-packageName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"company1.jobs"&lt;/span&gt;
slatekit new cli &lt;span class="nt"&gt;-name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"MyCLI1"&lt;/span&gt; &lt;span class="nt"&gt;-packageName&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"company1.apps"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Uninstall
&lt;/h1&gt;

&lt;p&gt;If you want to uninstall everything, you can do&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew uninstall slatekit
brew untap slatekit/slatekit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Upgrade
&lt;/h1&gt;

&lt;p&gt;Lastly, if you want to upgrade your package to a new version, then you simply have to publish a new version of your package, change the url, sha in your formula and then run the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew upgrade slatekit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Well, thats finally it. I created a homebrew installer to allow for a command line tool to generate &lt;a href="https://github.com/slatekit/slatekit" rel="noopener noreferrer"&gt;slatekit&lt;/a&gt; projects making it very easy for new users to get started quickly. It sounds like quite a lot at first, but there are only 3 concepts, the package( your script, app, tool), the tap (git repo for formulas), and the formula (installer). Hope this helps!&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>java</category>
      <category>homebrew</category>
      <category>install</category>
    </item>
  </channel>
</rss>
