There are two ways to use Brauhaus.js - either in a web browser (client-side) or on e.g. Node.js (server-side).
To use Brauhaus.js in a web browser, simply download the following files and include them as you would any other script:
For Node.js, you can easily install Brauhaus.js plugins using
npm install brauhaus-styles
// The following line is NOT required for web browser usevar Brauhaus = ;// Import plugins here, e.g.;// Create a recipevar r =name: 'My test brew'description: 'A new test beer using Brauhaus.js!'batchSize: 200boilSize: 100style: Brauhaus;...
The styles plugin adds many pre-defined BJCP styles to Brauhaus.
An object where the keys are categories and the values are objects that contain a group of styles. The styles are objects with ranges for gravities, bitterness, color, and carbonation. The functions below are used to get information from these objects.
Get a list of BJCP style categories supported by Brauhaus.
>>> Brauhaus'Light Lager' 'Pilsner' 'Bock' ...
Get a list of styles for a particular category
>>> Brauhaus'Maibock / Helles Bock' 'DoppelBock' ...
Get an object representing a particular style.
>>> Brauhausname: 'Doppelbock'category: 'Bock'gu: 1072 1112fg: 1016 1024srm: 6 25ibu: 16 26abv: 7 10carb: 16 24
Contributions are welcome - just fork the project and submit a pull request when you are ready!
First, create a fork on GitHub. Then:
git clone ...cd brauhaus-stylesnpm install
Brauhaus uses the CoffeeScript Style Guide with the following exceptions:
cake build or
npm test you will see the output of CoffeeLint, a static analysis code quality tool for CoffeeScript. Please adhere to the warnings and errors to ensure your changes will build.
Before submitting a pull request, please add any relevant tests and run them via:
If you have PhantomJS installed and on your path then you can use:
CI=true npm test
Pull requests will automatically be tested by Travis CI both in Node.js 0.6/0.8/0.10 and in a headless webkit environment (PhantomJS). Changes that cause tests to fail will not be accepted. New features should be tested to be accepted.
New tests can be added in the
test directory. If you add a new file there, please don't forget to update the
test.html to include it!
You can generate a unit test code coverage report for unit tests using the following:
You can find an HTML report in the
coverage directory that is created. This report will show line-by-line code coverage information.
Please note that all contributions will be licensed under the MIT license in the following section.
Copyright (c) 2013 Daniel G. Taylor
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.