Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
brauhaus-beerxml
Advanced tools
A plugin for Brauhaus.js that adds BeerXML 1.0 import and export capabilities. Features include:
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:
<script type="text/javascript" src="/scripts/brauhaus.min.js"></script>
<script type="text/javascript" src="/scripts/brauhaus-beerxml.min.js"></script>
<script type="text/javascript">
// Your code goes here!
// See below for an example...
</script>
For Node.js, you can easily install Brauhaus.js using npm
:
npm install brauhaus-beerxml
// The following lines are NOT required for web browser use
var Brauhaus = require('brauhaus');
require('brauhaus-beerxml');
var beerxml = '<recipes><recipe><name>Test Recipe</name>...</recipe></recipes>';
// Get a list of recipes
var recipes = Brauhaus.Recipe.fromBeerXml(beerxml);
console.log('There are ' + recipes.length + ' recipes.');
var r = recipes[0];
console.log('The first recipe is named ' + r.name);
// The following lines are NOT required for web browser use
var Brauhaus = require('brauhaus');
require('brauhaus-beerxml');
// Create a recipe
var r = new Brauhaus.Recipe({
name: 'My test brew',
description: 'A new test beer using Brauhaus.js!',
batchSize: 20.0,
boilSize: 10.0
});
// Add ingredients
r.add('fermentable', {
name: 'Extra pale malt',
color: 2.5,
weight: 4.2,
yield: 78.0
});
r.add('hop', {
name: 'Cascade hops',
weight: 0.028,
aa: 5.0,
use: 'boil',
form: 'pellet'
});
r.add('yeast', {
name: 'Wyeast 3724 - Belgian Saison',
type: 'ale',
form: 'liquid',
attenuation: 80
});
// Set up a simple infusion mash
r.mash = new Brauhaus.Mash({
name: 'My mash',
ph: 5.4
});
r.mash.addStep({
name: 'Saccharification',
type: 'Infusion',
time: 60,
temp: 68,
waterRatio: 2.75
});
// Print out BeerXML for the recipe
console.log(r.toBeerXml())
A beer recipe, containing ingredients like fermentables, spices, and yeast. Calculations can be made for bitterness, alcohol content, color, and more.
Get a list of recipes from BeerXML loaded as a string.
>>> xml = '<recipes><recipe><name>Test Recipe</name>...</recipe></recipes>'
>>> recipe = Brauhaus.Recipe.fromBeerXml(xml)[0]
<Brauhaus.Recipe object 'Test Recipe'>
Convert this recipe into BeerXML for export. Returns a BeerXML string.
>>> recipe.toBeerXml()
'<?xml version="1.0"><recipes><recipe>...</recipe></recipes>'
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-beerxml
npm install
Brauhaus uses the CoffeeScript Style Guide with the following exceptions:
When building brauhaus.js
with 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:
npm test
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:
cake coverage
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.
FAQs
A BeerXML import and export plugin for Brauhaus.js
The npm package brauhaus-beerxml receives a total of 1 weekly downloads. As such, brauhaus-beerxml popularity was classified as not popular.
We found that brauhaus-beerxml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.