Skip to content

Commit

Permalink
Merge pull request #68 from knowtheory/taco_cake
Browse files Browse the repository at this point in the history
Automation: Step 1, or Cake, anyone?
  • Loading branch information
dansinker committed Mar 17, 2014
2 parents aa03028 + df3e749 commit fcc2212
Show file tree
Hide file tree
Showing 38 changed files with 380 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
node_modules
149 changes: 149 additions & 0 deletions Cakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
FS = require 'fs'
Path = require 'path'
glob = require 'glob'

spacify = (str) -> str.replace(/_/g, ' ')
capitalize = (str) -> str.charAt(0).toUpperCase() + str.substring(1).toLowerCase();

task 'build', 'build ALL THE THINGS', () ->
invoke 'build:toc'
invoke 'build:ingredients'

task 'build:toc', 'build a table of contents', () ->
# pattern matching for files which shouldn't be indexed.
ignore = (file) -> file.match /^\.|readme|index|table_of_contents|node_modules/i

# Extract recipe info from a markdown file assuming:
# 1. a recipe's title is the (non-whitespace) first line
# 2. a recipe can optionally contain a line of tags which starts
# with "tags: " and is followed by a comma separated list of tag phrases.
recipe_info = (path) ->
text = (FS.readFileSync path, { encoding: 'utf8' })
lines = text.split("\n")
lines.shift() while lines[0].match(/^\s*$/)

name = lines[0].match(/^(\s*#+\s*)?([^\n]+)$/)[2]
tags = text.match(/tags\s*:\s*([^\n]+)/i)?[1].split(',') || []
{ name: name, path: path, tags: tags }

section_info = (path) ->
name = capitalize(spacify(Path.basename(path)))
{ name: name, path: path, contents: index_dir(path) }

index_dir = (base, index = {}) ->
files = FS.readdirSync(base)
index.markdown = (recipe_info(Path.join(base, file)) for file in files when Path.extname(file).match(/md|markdown|mdown$/) and not ignore(file))
index.sections = (section_info(file) for file in files when FS.lstatSync(Path.join(base, file)).isDirectory() and not ignore(file))
return index

topic_sort = (sections) ->
sorted_sections = []
sort_order = ['full_tacos',
'base_layers',
'mixins',
'condiments',
'seasonings',
'shells',
'like_tacos']

# find the sections listed in the sorting index
# and place them in the correct positions in the
# sorted sections.
for section_path, sort_position in sort_order
do (section_path) ->
section_position = (section.path for section in sections).indexOf(section_path)
sorted_sections[sort_position] = sections[section_position] if section_position > -1

# add everything that isn't in the sorted order to the end of the sorted_sections
sorted_sections.concat(section for section in sections when sort_order.indexOf(section.path) == -1)
return sorted_sections

template_sections = (index, base, tabs = "") ->
#console.log("INDEX", index)
recipe_link = (recipe) ->
quick_tags = ""
quick_tags += " (v)" if recipe.tags.indexOf('vegetarian') >= 0
"[#{recipe.name}#{ quick_tags }](#{recipe.path})"

section_link = (section) ->
subsections = template_sections(section.contents, section.path, tabs + "\t")
"[#{section.name}](#{section.path}/#readme)\n#{ subsections }"

markup = ""
markup += "#{ tabs }* #{ section_link(section) }" for section in topic_sort(index.sections)
markup += "#{ tabs }* #{ recipe_link(recipe) }\n" for recipe in index.markdown
markup

console.log("generating table of contents...")
FS.writeFile 'table_of_contents.md', """
Table of Contents
=================
Welcome to the tacofancy table of contents. This table of contents was automatically created by
scanning through the tacofancy repository for recipes. Apologies to the newly unemployed index updaters.
Recipes marked with a (v) are tagged as vegetarian friendly, mostly to make [@dansinker](https://twitter.com/dansinker),
[@cjoh](https://twitter.com/cjoh) and [@knowtheory](https://twitter.com/knowtheory) sad.
If you'd like to tag more recipes, just look for (or add) a line in each recipe starting with "tags:". Add whatever
tags you like separated by commas.
#{template_sections(index_dir('.'))}
"""
console.log('done')


task 'build:ingredients', 'build an ingredient index.', () ->
# Find all markdown files in the repository.
glob '**/*.md', {}, (error, files) ->
is_ingredient = (line) ->
line.match /^(\*|-)\s+/i

parse_ingredient = (line) ->
ingredient = line.match(/^((\*|-)\s+)([^\n]+)$/)[3]
console.log ingredient
ingredient

extract_ingredients_from = (path) ->
contents = (FS.readFileSync path, { encoding: 'utf8' }).split("\n")
contents.shift() while contents[0].match(/^\s*$/)
lines = (line for line in contents when is_ingredient line )
#console.log lines.length
ingredients = (parse_ingredient(line) for line in lines)
#console.log(ingredients.length)
#console.log('"'+contents[0]+'":', contents[0].match /^\s*$/)
name = contents[0].match(/^(\s*#+\s*)?([^\n]+)$/)?[2]
{ path: path, ingredients: ingredients, name: name }

make_index = (recipes) ->
index = {}
#console.log(recipes)
for recipe in recipes
do (recipe) ->
#console.log(recipe)
if recipe.ingredients
for ingredient in recipe.ingredients
do (ingredient) ->
#console.log(ingredient)
index[ingredient] ||= []
index[ingredient].push { name: recipe.name, path: recipe.path }
return index

template_index = (index) ->
#console.log(index)
sections = for ingredient, recipes of index
path_list = ("* [#{recipe.name}](#{recipe.path})" for recipe in recipes).join('\n')
"## #{ingredient}\n\n#{path_list}\n"
"# Recipes listed by Ingredient\n\n#{sections.join "\n"}"

console.log('generating ingredient index...')
ingredients = make_index(extract_ingredients_from(file) for file in files when not file.match /(readme|index|table_of_contents).md$/i)
FS.writeFile 'IngredientIndex.md', template_index(ingredients)
console.log('completed')

"""
Random notes:
`ack --output='$1' "\(v[^(]+\(\/?([^)]+)" INDEX.md | xargs mate` will open the list of files currently
listed in the index as vegetarian assuming that you're on a *nix system, have "ack" installed, and use textmate.
"""
4 changes: 3 additions & 1 deletion base_layers/asian_marinade.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ For marinade mix:
* 1 teaspoon paprika
* Some chopped cilantro

Mix with sliced tofu or pork, marinate for 30 minutes and quickly sauté.
Mix with sliced tofu or pork, marinate for 30 minutes and quickly sauté.

tags: vegetarian
2 changes: 2 additions & 0 deletions base_layers/garlic_black_beans.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ Vegetarian/Vegan
4. Pour in the entire can of beans, don't drain or rinse them.
5. Simmer for about 15 minutes or until the bean broth has thickened to your liking. If the beans will be the main ingredient of your tacos, cook until the beans are just about totally dry. If you're using them in a mixture (like the [Black Bean, Potato, and Onion Tacos](/full_tacos/black_bean_potato_onion_tacos.md) ), let the broth stay a little bit runny.
6. Add a squeeze or two of lemon juice if you like.

tags: vegetarian, vegan
4 changes: 3 additions & 1 deletion base_layers/marinated_portobello.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Sometimes you're throwing a taco party and you need a vegetarian option. Sometim

Since a proper taco is never overstuffed, one decent-sized portobello should be enough for three servings. Multiply accordingly, and drop your mushrooms into a big Ziploc bag with enough [salsa verde](/condiments/simple_salsa_verde.md) to cover. Let everything sit in your fridge for a couple of hours.

Remove, season with just a touch of salt and cracked black pepper, then lay onto a grill (or a grill pan on your stovetop) over medium to medium-high heat for a few minutes on each side. Cut into thick slices, and you'll have a nice, earthy taco base.
Remove, season with just a touch of salt and cracked black pepper, then lay onto a grill (or a grill pan on your stovetop) over medium to medium-high heat for a few minutes on each side. Cut into thick slices, and you'll have a nice, earthy taco base.

tags: vegetarian
1 change: 1 addition & 0 deletions base_layers/rajas_poblanas.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ all hot and finish cooking any bits of chile that remain raw after the
skin removal process. When it looks close to done, lower the cooking heat
to a minimum and add the cream and cheese(s) and warm them for about 5 minutes.

tags: vegetarian
4 changes: 3 additions & 1 deletion base_layers/red_cabbage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Red Cabbage Filling
* 1/2 bunch of finely chopped cilantro
* 2-3 squeezed limes

1. Mix all ingredients in large bowl
1. Mix all ingredients in large bowl

tags: vegetarian
4 changes: 3 additions & 1 deletion base_layers/soyrizo.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ Soyrizo
* chopped potatoes
* green peppers

Throw some Soyrizo in a sauce pan with chopped potatoes and green peppers and brown for added bonus.
Throw some Soyrizo in a sauce pan with chopped potatoes and green peppers and brown for added bonus.

tags: vegetarian, vegan
4 changes: 3 additions & 1 deletion base_layers/swiss_chard.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ __Ingredients__
* 1 onion sliced thin
* 1/2 cup of chicken or vegetable broth

Slice up the chard into small slices. In a large skillet, heat the oil on medium-high. Cook the onions until soft, plus some garlic and red pepper flakes if you want. Put the chard in the skillet, add the broth. Cover the pan and reduce the heat to medium-low and cook until the greens are wilted and almost tender (about 5 minutes). Uncover, bring heat back to medium high and cook until almost dry. Salt as necessary. Enjoy.
Slice up the chard into small slices. In a large skillet, heat the oil on medium-high. Cook the onions until soft, plus some garlic and red pepper flakes if you want. Put the chard in the skillet, add the broth. Cover the pan and reduce the heat to medium-low and cook until the greens are wilted and almost tender (about 5 minutes). Uncover, bring heat back to medium high and cook until almost dry. Salt as necessary. Enjoy.

tags: vegetarian
4 changes: 3 additions & 1 deletion base_layers/zucchini_corn.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ __Directions__
4. Add diced tomatoes, cook for 8-10 minutes.
5. Add zucchini, cook until it's tender.
6. Add corn back in.
7. Add black beans, Epazote; add salt, pepper, and other seasonings to taste. Cook for 3-4 more minutes.
7. Add black beans, Epazote; add salt, pepper, and other seasonings to taste. Cook for 3-4 more minutes.

tags: vegetarian, vegan
4 changes: 3 additions & 1 deletion condiments/Pico_de_gallo.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ _Super Quick & Easy Pico_

Combine the tomatoes, cilantro and onion together in a bowl. Season to taste with salt and lime.

Reserve some of this mixture for kids, and then add as much jalapeño as you like to the remaining mixture for the non wimps.
Reserve some of this mixture for kids, and then add as much jalapeño as you like to the remaining mixture for the non wimps.

tags: vegetarian
2 changes: 2 additions & 0 deletions condiments/beet_salsa.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ Tired of plain ol' [Carne Asada Tacos](../base_layers/chooped_steak.md)? Get exo
* 1 or more lemons

Fry tomatoes, pepper(s), onion and garlic in a pan until they are brown and tomato skins are peeling away. Move ingredients to the blender and purèe. Chop beets to a blendable size and add to salsa. Add salt and pepper to taste. Squeeze in desired amount of lemon and blend one more time.

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/black_olives.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Black Olives
==========

Canned black olives add a sweet and cool meatiness to a traditional American taco.
Canned black olives add a sweet and cool meatiness to a traditional American taco.

tags: vegetarian
2 changes: 2 additions & 0 deletions condiments/chile_de_arbol_sauce.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ chopped onion and cilantro.

One non-obvious little point is that skipping the oil in the chile roasting-toasting
step seems to increase the spiciness of the final product.

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/chipotle_sauce.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ __Directions__

1. Drop all of this into a food processor, and blend away.
2. Let sit in fridge for 30 minutes or overnight for flavor melding.
3. Add to tacos, and anything else you'd like.
3. Add to tacos, and anything else you'd like.

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/guacamole.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ Just in case no one ever taught you how to deal with an avocado correctly, here'

To finish up your guacamole, mash your avocado up a bit and gently mix it into the magical citric-spice-tomato concoction. We're done here.

_Thanks to [The Awl](http://www.theawl.com/2010/02/half-baked-guacamole-by-the-ceviche-method) for limited inspiration regarding the limey and drinky parts._
_Thanks to [The Awl](http://www.theawl.com/2010/02/half-baked-guacamole-by-the-ceviche-method) for limited inspiration regarding the limey and drinky parts._

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/guacamole_simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ If you're not in the mood to be fussy, this could be considered a minimum-viable
7. Taste.
8. Adjust salt/lime/hot sauce as desired.

This recipe will support one average-size bag of chips, so adjust quantities based on expectations.
This recipe will support one average-size bag of chips, so adjust quantities based on expectations.

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/mango_avocado_salsa.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ __Directions__
1. Chop avocado and mango into bowl.
2. Squeeze the lime and half the orange in, add honey.
3. Add garlic (chopped or pressed) and pepper to taste.
4. Stir and enjoy!
4. Stir and enjoy!

tags: vegetarian
2 changes: 2 additions & 0 deletions condiments/pickled_red_onions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ Seriously. All the things. Pickle your fridge. Pickle your waffles. Make. Lots.
* __Toy cars — kid with an attitude? Pickle their favorite toy car. Let's see them try to cop a tude when their matchbox cars are soggy and briney
* __Cauliflower__ — personal favorite. Pickles in an hour, super delicious
* __Baby corn__ — baby corn is gross, but if you pickle it you can make jokes about how big all the other things you pickled are

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/roasted_tomatillo.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ Roasted Tomatillo and Mushroom Sauce
5. Put the blended tomatillo-chile mixture in a saucepan and bring it to a boil. Add the cooked mushrooms and bring it back to a boil. Then bring the heat down until the mixture is simmering. Cook for about 10 minutes. Add salt to taste.

---
A friend gave me this recipe a while back, but I can't remember who it was. Sorry, friend.
A friend gave me this recipe a while back, but I can't remember who it was. Sorry, friend.

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/salsa_sauce.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ From What's Cookin' Cookbook: A Recipe Collection from the Schlaback Family
* 1/2 c. vinegar
* 1 Tbsp. brown sugar

Mix and bring to a boil. Cook down 1 1/2 hours. Cold pack for 20 minutes.
Mix and bring to a boil. Cook down 1 1/2 hours. Cold pack for 20 minutes.

tags: vegetarian
4 changes: 3 additions & 1 deletion condiments/simple_salsa_verde.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ I got this base recipe from a vegan friend. If you can't find one of these peppe

You're in charge of the heat here. For a milder salsa, remove all the ribs and seeds inside the peppers. For medium, leave in a few ribs, and for hot, go nuts. Rough chop the peppers and tomatillos, then throw into a blender or food processor with salt and lime juice. Pulse to desired consistency.

As with most salsas, this will taste better if you let it sit in the fridge for a few hours before eating. It's great on chips or drizzled over steak or pork tacos.
As with most salsas, this will taste better if you let it sit in the fridge for a few hours before eating. It's great on chips or drizzled over steak or pork tacos.

tags: vegetarian, vegan
10 changes: 5 additions & 5 deletions full_tacos/asian_style_tacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Asian Style Tacos

If you like a lighter asian style taco with no cheese, give this one a try.

* Using the [asian marinade](../base_layers/asian_marinade.md), prepare some tofu or sliced pork
* Make some guacamole (add in a teaspoon of sesame oil and toasted sesame seeds to your recipe)
* Top with [asian pickled veggies](../condiments/pickled_vegetables.md)
* And [cabbage slaw](../condiments/asian_cabbage.md)
* *__NOM__*
1. Using the [asian marinade](../base_layers/asian_marinade.md), prepare some tofu or sliced pork
2. Make some guacamole (add in a teaspoon of sesame oil and toasted sesame seeds to your recipe)
3. Top with [asian picked veggies](../condiments/pickled_vegetables.md)
4. And [cabbage slaw](../condiments/asian_cabbage.md)
5. __NOM__
4 changes: 3 additions & 1 deletion full_tacos/black_bean_potato_onion_tacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ Vegetarian; vegan if you omit the cheese
5. Add the garlic black beans and simmer until any bean broth is incorporated into the potato/onion mix.
6. Let cool a little bit before serving, potatoes retain heat really really well.

Serve on corn or flour tortillas. Hard or soft shell, doesn't matter. Sprinkle on salty cheese as desired.
Serve on corn or flour tortillas. Hard or soft shell, doesn't matter. Sprinkle on salty cheese as desired.

tags: vegetarian, vegan
4 changes: 3 additions & 1 deletion full_tacos/swiss_chard_tacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ Components:
* crumbled queso fresco or crema
* salsa

Of course, you could decide you want to add some grilled chicken or steak. Or you could _make it Monteiro_ and add tofu or other soy products.
Of course, you could decide you want to add some grilled chicken or steak. Or you could _make it Monteiro_ and add tofu or other soy products.

tags: vegetarian
4 changes: 3 additions & 1 deletion full_tacos/vegan_cabbage_tacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ Vegan Red Cabbage Tacos

1. Prepare [Red Cabbage Filling](/base_layers/red_cabbage.md)
2. Prepare [Garlic Black Beans](/base_layers/garlic_black_beans.md)
3. Serve in toasted corn tortillas, topped with optional veggies and a squeeze of lime.
3. Serve in toasted corn tortillas, topped with optional veggies and a squeeze of lime.

tags: vegetarian, vegan
4 changes: 3 additions & 1 deletion full_tacos/zucchini_corn_tacos.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Vegetarian; vegan without cheese

1. Prepare the [Zucchini & Corn Filling](/base_layers/zucchini_corn.md)
2. Add optional salsa (tomatillo is best, like the [Simple Salsa Verde](/condiments/simple_salsa_verde.md))
3. Serve in corn tortillas, topped with optional cheese (queso fresco if possible)
3. Serve in corn tortillas, topped with optional cheese (queso fresco if possible)

tags: vegetarian, vegan
2 changes: 2 additions & 0 deletions mixins/Corn_Salad.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Cut the corn off of the cob, and in a mixing bowl mix together corn, lime juice,

---
This is my first Github commit. I'm glad it's taco related.

tags: vegetarian
4 changes: 3 additions & 1 deletion mixins/drunken_greenbeans.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ Green beans are fine. Green beans cooked in beer are better. Maybe even the best

First peel and dice the garlic and sauté it in the olive oil. Before it gets all burned and ruined, add the beer and vegetable broth.

As the liquid comes to a boil, cut the green beans up. Add the green beans and a pinch of salt and let them simmer for about five minutes. If you like your beans on the softer side you can let it go a little longer. But the trick is to pull them right after the color starts to turn and you've just made a delicious addition to any taco.
As the liquid comes to a boil, cut the green beans up. Add the green beans and a pinch of salt and let them simmer for about five minutes. If you like your beans on the softer side you can let it go a little longer. But the trick is to pull them right after the color starts to turn and you've just made a delicious addition to any taco.

tags: vegetarian
4 changes: 3 additions & 1 deletion mixins/sweet_potato_and_apple_hash.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Sweet potatoes are my go-to taco punch-up. I was going my normal route of making
* A queeze of honey
* Pat o' butter

Mix this all into a pan, with about 1/4 cup of water, and boil it all up until the water goes away, toss in the butter, and continue to pan-fry until things get a little browned.
Mix this all into a pan, with about 1/4 cup of water, and boil it all up until the water goes away, toss in the butter, and continue to pan-fry until things get a little browned.

tags: vegetarian
1 change: 1 addition & 0 deletions mixins/traditional_taco_mixins.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Traditional Taco Mixins

Add ingredients to tacos in layers.

tags: vegetarian

Loading

0 comments on commit fcc2212

Please sign in to comment.