dansinker / tacofancy

community-driven taco repo. stars stars stars.
The Unlicense
1.29k stars 448 forks source link

Automation: Step 1, or Cake, anyone? #68

Closed knowtheory closed 10 years ago

knowtheory commented 10 years ago

This is really more of an "inb4" pull request. Also an attempt to start some discussion as to what people want.

I've hacked up the dumbest, quickest, most straightforward scripts to do two things:

  1. Automatically generate a table of contents/index of the recipes in the repository
  2. Generate an index of recipes grouped by ingredient. (at the moment the ingredient parsing/normalization is still missing)

There are two todos for the table of contents (TOC hence). Alternative sorting for the TOC (rather than alphanumeric) so as to preserve the current order of the index. The other is some way of tagging or otherwise indicating facts about recipes (like whether they're vegetarian friendly) so that info can be communicated through the TOC.

I'm particularly interested in opinions on the last point. Any suggestions? :D

dansinker commented 10 years ago

Then I'm gonna leave this open and let the discussion progress. Should loop in the crew from #61 for the discussion.

My two cents on the vegetarian tagging question though is that that is important. Mainly because vegetarians keep going through and adding the (v).

What about--and I am positive there is a smarter solution for this--instead of overly structuring the recipes (something I've said pretty regularly I'm against), there is a structured field in them. Literally just a "tags" line that would allow you to designate various things, of which right now this system really would only care about vegetarian, but which could be used later for other automated process.

EXAMPLE:

tags: vegetarian, tex-mex, cabbage

evz commented 10 years ago

:+1: for tags line. Simple to parse leaves things as clean and simple as possible.

knowtheory commented 10 years ago

Alright, so the table of contents now has a lil template, and recipes tagged as vegetarian.

I've updated all the vegetarian recipes to include a "tags:" line with comma separated values. The TOC generator currently just notes whether recipes are tagged with vegetarian. I'm happy either way if we decide to add more ceremony/structure to the tag line or not.

So the TOC looks like this now: https://github.com/knowtheory/tacofancy/blob/taco_cake/table_of_contents.md

If we wanna keep going down the tagging route there are a couple next steps:

  1. figuring out a convenient way for people to indicate how tags should show up in the TOC (the "(v)" for vegetarian thing)
  2. listing an index of recipes by tag probably.
  3. Spell checker for tags
  4. ???
  5. Eat delicious tacos.
dansinker commented 10 years ago

This kicks ass. How do we implement? What triggers the index generation?

raed667 commented 10 years ago

Can people provide their own indexes ?

dansinker commented 10 years ago

What would the benefit of multiple indexes within the repo be? On Nov 10, 2013 4:01 PM, "Raed667" notifications@github.com wrote:

Can people provide their own indexes ?

— Reply to this email directly or view it on GitHubhttps://github.com/sinker/tacofancy/pull/68#issuecomment-28163600 .

raed667 commented 10 years ago

sorry ment "tags" ... long night of booz talking (ehh typing) ..

dansinker commented 10 years ago

I believe the idea is that we could leverage tags in other ways. On Nov 10, 2013 4:03 PM, "Raed667" notifications@github.com wrote:

sorry ment "tags" ... long night of booz talking (ehh typing) ..

— Reply to this email directly or view it on GitHubhttps://github.com/sinker/tacofancy/pull/68#issuecomment-28163656 .

knowtheory commented 10 years ago

Yep, so it all happens through a coffeescript Cakefile. So if you have node.js installed, and coffeescript installed globally, all you have to do is type cake build:toc on the command line, and it'll generate the TOC for you to commit like any other file.

I'm trying to winnow the installation dependencies down though. I can get it down to just node.js (install node, then use npm install to get the dependencies), but then the invocation becomes

`npm bin`/cake build:toc

The steps past that will be either asking someone to run the script and commit it (either those adding the recipes, if they have node/coffeescript installed, or editors who can run the script after accepting a pull request), or by creating a little web service which generates the TOC & commits it when notified by Github (via a webhook) that there are new commits.

knowtheory commented 10 years ago

@Raed667 and yep, so folks can add whatever tags they want to recipes, but the build scripts don't do anything with them (yet). Building a little mapping for how tags should show up in the TOC would be neat. We could even stick icons/emoticons into the TOC if we want.

We could just use a JSON config file structured like this:

{
  "vegetarian": {
    "icon": "http://github.com/sinker/tacofancy/images/vegetarian_icon.png", 
    "abbreviation": "v" 
  }
}

or if we wanted to be even simpler just:

{
  "vegetarian": "v"
}
dansinker commented 10 years ago

+1 to a webservice that triggers via webhook.

meetar commented 10 years ago

If you don't already have a webhook for the index build trigger I'm fairly sure we can base it on the tacobot script.

knowtheory commented 10 years ago

@meetar Yep, the webhook part i'm less concerned about than reliably pulling from & committing to the repo (which is what i've been tinkering with).

btw, i hit up the github dudes, and managed to grab @tacobot on github here. So commits can come from there. :)

dansinker commented 10 years ago

Ted, pinging you back about this auto-index generation because jesus h christ, "please update index.md" is 80% of the feedback I have to give PRs.

knowtheory commented 10 years ago

Okay, i've got the taco_cake branch cleaned up and ready to merge.

Once merged, i'll flip my tacobot over to committing to the main repository. At that point, any time a push is made to the repository the tacobot automatically generate/update a table_of_contents by scanning through all the files in the repo .

If the tacobot's updated ToC is different from the one in the repo, it'll commit it and push.

This'll double the # of commits/pushes to the repo likely (unless folks run the script themselves).

dansinker commented 10 years ago

OK, so this is 100% ready to merge then?

knowtheory commented 10 years ago

Yep. The additional changes are adding tags and a little reformatting.

On Sunday, March 16, 2014, sinker notifications@github.com wrote:

OK, so this is 100% ready to merge then?

Reply to this email directly or view it on GitHubhttps://github.com/sinker/tacofancy/pull/68#issuecomment-37772830 .