We’re making beer. I’m the brewery! Bender Bending Rodriguez from Futurama
A Clojure(Script) library to create randomized beer recipes!
The beta release of our SPA is now available!
This repository follows the guidelines and standards of the Wall Brew Open Source Policy.
A deployed copy of the most recent version of brew-bot can be found on clojars. To use it, add the following as a dependency in your project.clj file:
The next time you build your application, Leiningen or deps.edn should pull it automatically. Alternatively, you may clone or fork the repository to work with it directly.
This library heavily relies upon the common-beer-format and returns all recipes and ingredients to match its specification. Therefore, all arguments passed to functions in brew-bot are normalized to these standards as well. Most importantly, it assumes measurements are provided in the International System of Units, also known as the modern metric system. Since many brewing applications, especially those based in America, operate on Imperial Measurements, you may wish to add brewtility to any applications consuming this library to assist with conversions between systems of measure.
All functions necessary to generate a recipe are provided in the core namespace.
(:require [brew-bot.core :refer :all])
(def fermentables
(select-fermentables))
(def hops
(select-hops :random))
(def yeast
(select-yeasts :random {:count-cutoff 1}))
(def my-random-recipe
(ingredients->cbf-recipe-template fermentables hops yeast))
Each of the three functions select-fermentables
, select-hops
, and select-yeasts
support multiple arities:
common-beer-format
common-beer-format
These are the currently supported strategies:
:random
- Select ingredients at random with an even probability of selection and with replacement:weighted
- Select ingredients with a provided selection probability and with replacement. For example, {:galaxy 15.0, :el-dorado 5.0, :topaz 1.0}
. In this example, galaxy hops have a 71.43% chance of being selected (15.0 / (15.0 + 5.0 + 1.0)).These are the currently supported options:
2.26796
kilograms (5 pounds){:amber-liquid-extract 5.0 :biscuit-malt 15.0 ...}
. Only applicable for the :weighted
strategy:weighted
strategyAdditionally, per ingredient type, you may focus the possible ingredient selections. Hops also support two additional options for determining when hops are added and their primary use case.
true
true
true
true
true
#{:random :weighted :inferred}
to determine how hop timings and uses should be selected. Defaults to :random
{120 60.0 45 15.0 ...}
{"boil" 60 ...}
true
true
true
true
true
true
true
true
doo, a Leiningen plugin used to run ClojureScript tests in many JS environments, is already in project.clj
.
Karma is used as the test runner, and is included in package.json
.
To install Karma, simply install the Node package:
npm install
Then build the application and run the tests:
lein test-build
The tests will also execute on the JVM, to ensure the library is compatible for both runtime environments.
Copyright © Wall Brew Co
This software is provided for free, public use as outlined in the MIT License